Add EMUL_NATIVEROOT so that native binaries can be told to search an

"emulation" directory before the real root. This makes easier to test
an amd64 kernel on the top of an i386 root filesystem prior a full
migration.
This commit is contained in:
manu 2014-02-02 04:28:42 +00:00
parent ee81b5bfee
commit 70aead41ff
2 changed files with 23 additions and 3 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: options.4,v 1.432 2013/10/13 22:34:13 wiz Exp $
.\" $NetBSD: options.4,v 1.433 2014/02/02 04:28:42 manu Exp $
.\"
.\" Copyright (c) 1996
.\" Perry E. Metzger. All rights reserved.
@ -450,6 +450,21 @@ Currently only some system calls which use
are adjusted and some binaries which use
.Xr sysctl 3
to retrieve network details would not work properly.
.It Cd options EMUL_NATIVEROOT=string
Just like emulated binaries first try to lookup files in
an emulation root (e.g.
.Pa /emul/linux )
before looking them up in real root, this option cause native
binaries to first look up files in an "emulation" directory too.
This can be useful to test an amd64 kernel on top of an i386 system
prior full migration: by unpacking the amd64 distribution in e.g.
.Pa /emul/netbsd64
and specifying that location as
.Cd EMUL_NATIVEROOT ,
native amd64 binaries can be run while the root filesystem remains
populated with i386 binaries. Beware of
.Pa /dev
incompatibilities between i386 and amd64 if you do this.
.It Cd options EXEC_ELF_NOTELESS
Run unidentified ELF binaries as
.Nx

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_exec.c,v 1.370 2014/01/25 19:44:11 christos Exp $ */
/* $NetBSD: kern_exec.c,v 1.371 2014/02/02 04:28:42 manu Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.370 2014/01/25 19:44:11 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.371 2014/02/02 04:28:42 manu Exp $");
#include "opt_exec.h"
#include "opt_execfmt.h"
@ -179,6 +179,11 @@ void syscall(void);
struct emul emul_netbsd = {
.e_name = "netbsd",
.e_path = NULL,
#ifdef EMUL_NATIVEROOT
.e_path = EMUL_NATIVEROOT,
#else
.e_path = NULL,
#endif
#ifndef __HAVE_MINIMAL_EMUL
.e_flags = EMUL_HAS_SYS___syscall,
.e_errno = NULL,