diff options
| author | drochner <drochner@NetBSD.org> | 2010-01-14 17:49:31 +0000 |
|---|---|---|
| committer | drochner <drochner@NetBSD.org> | 2010-01-14 17:49:31 +0000 |
| commit | 79f027bbd6493b7fb048ae236987e2bcbc118f10 (patch) | |
| tree | aea1a582506e1b5db318bcfc3405e9d2b42e2b14 /usr.sbin/installboot | |
| parent | aa0d6833111230f3d5d93b26a96751f03c1f70b7 (diff) | |
On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.
Diffstat (limited to 'usr.sbin/installboot')
| -rw-r--r-- | usr.sbin/installboot/arch/i386.c | 14 | ||||
| -rw-r--r-- | usr.sbin/installboot/installboot.8 | 16 | ||||
| -rw-r--r-- | usr.sbin/installboot/installboot.c | 6 | ||||
| -rw-r--r-- | usr.sbin/installboot/installboot.h | 4 |
4 files changed, 31 insertions, 9 deletions
diff --git a/usr.sbin/installboot/arch/i386.c b/usr.sbin/installboot/arch/i386.c index 189740f81db..67dab44195e 100644 --- a/usr.sbin/installboot/arch/i386.c +++ b/usr.sbin/installboot/arch/i386.c @@ -1,4 +1,4 @@ -/* $NetBSD: i386.c,v 1.34 2009/12/23 09:17:41 mbalmer Exp $ */ +/* $NetBSD: i386.c,v 1.35 2010/01/14 17:49:32 drochner Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(__lint) -__RCSID("$NetBSD: i386.c,v 1.34 2009/12/23 09:17:41 mbalmer Exp $"); +__RCSID("$NetBSD: i386.c,v 1.35 2010/01/14 17:49:32 drochner Exp $"); #endif /* !__lint */ #include <sys/param.h> @@ -80,12 +80,14 @@ static int i386_editboot(ib_params *); struct ib_mach ib_mach_i386 = { "i386", i386_setboot, no_clearboot, i386_editboot, IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR | - IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT }; + IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT | + IB_MODULES | IB_BOOTCONF }; struct ib_mach ib_mach_amd64 = { "amd64", i386_setboot, no_clearboot, i386_editboot, IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR | - IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT }; + IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT | + IB_MODULES | IB_BOOTCONF }; /* * Attempting to write the 'labelsector' (or a sector near it - within 8k?) @@ -272,6 +274,10 @@ update_i386_boot_params(ib_params *params, struct x86_boot_params *bpp) } if (params->flags & IB_KEYMAP) strlcpy(bp.bp_keymap, params->keymap, sizeof bp.bp_keymap); + if (params->flags & IB_MODULES) + bp.bp_flags ^= htole32(X86_BP_FLAGS_LOADMODULES); + if (params->flags & IB_BOOTCONF) + bp.bp_flags ^= htole32(X86_BP_FLAGS_READBOOTCONF); if (params->flags & (IB_NOWRITE | IB_VERBOSE)) show_i386_boot_params(&bp); diff --git a/usr.sbin/installboot/installboot.8 b/usr.sbin/installboot/installboot.8 index 775a498c591..08b771eab19 100644 --- a/usr.sbin/installboot/installboot.8 +++ b/usr.sbin/installboot/installboot.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: installboot.8,v 1.73 2009/05/07 07:09:49 lukem Exp $ +.\" $NetBSD: installboot.8,v 1.74 2010/01/14 17:49:32 drochner Exp $ .\" .\" Copyright (c) 2002-2009 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 12, 2008 +.Dd January 11, 2010 .Dt INSTALLBOOT 8 .Os .Sh NAME @@ -305,6 +305,18 @@ disklabel should use no more than 4 partitions. .Sy [ amd64 , .Sy i386 ] Set the timeout before the automatic boot begins to the given number of seconds. +. +.It Sy modules +.Sy [ amd64 , +.Sy i386 ] +(Don't) load kernel modules. +. +.It Sy bootconf +.Sy [ amd64 , +.Sy i386 ] +(Don't) read a +.Dq boot.cfg +file. .El . .It Fl t Ar fstype diff --git a/usr.sbin/installboot/installboot.c b/usr.sbin/installboot/installboot.c index 3b212a33560..7573a9fe91b 100644 --- a/usr.sbin/installboot/installboot.c +++ b/usr.sbin/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.33 2010/01/14 16:27:49 tsutsui Exp $ */ +/* $NetBSD: installboot.c,v 1.34 2010/01/14 17:49:32 drochner Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(__lint) -__RCSID("$NetBSD: installboot.c,v 1.33 2010/01/14 16:27:49 tsutsui Exp $"); +__RCSID("$NetBSD: installboot.c,v 1.34 2010/01/14 17:49:32 drochner Exp $"); #endif /* !__lint */ #include <sys/ioctl.h> @@ -87,6 +87,8 @@ const struct option { { "speed", IB_CONSPEED, OPT_INT, OFFSET(conspeed) }, { "sunsum", IB_SUNSUM, OPT_BOOL, 0 }, { "timeout", IB_TIMEOUT, OPT_INT, OFFSET(timeout) }, + { "modules", IB_MODULES, OPT_BOOL, 0 }, + { "bootconf", IB_BOOTCONF, OPT_BOOL, 0 }, { .name = NULL }, }; #undef OFFSET diff --git a/usr.sbin/installboot/installboot.h b/usr.sbin/installboot/installboot.h index 4c4b4c674d6..a206a7d946e 100644 --- a/usr.sbin/installboot/installboot.h +++ b/usr.sbin/installboot/installboot.h @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.h,v 1.36 2010/01/07 13:26:00 tsutsui Exp $ */ +/* $NetBSD: installboot.h,v 1.37 2010/01/14 17:49:32 drochner Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -65,6 +65,8 @@ typedef enum { IB_PASSWORD = 1<<18, /* i386 boot password */ IB_KEYMAP = 1<<19, /* i386 console keymap */ IB_CONSADDR = 1<<20, /* i386 console io address */ + IB_MODULES = 1<<21, /* i386: load modules */ + IB_BOOTCONF = 1<<22, /* i386: read boot.conf */ } ib_flags; typedef struct { |
