Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src On i386/amd64, define two flag bits in the boot parameters w...
details: https://anonhg.NetBSD.org/src/rev/118fd9f5f35b
branches: trunk
changeset: 750794:118fd9f5f35b
user: drochner <drochner%NetBSD.org@localhost>
date: Thu Jan 14 17:49:31 2010 +0000
description:
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:
sys/arch/i386/stand/boot/boot2.c | 7 +++++--
sys/arch/i386/stand/lib/boot_params.S | 8 ++++++--
sys/arch/i386/stand/pxeboot/Makefile | 6 +++++-
sys/arch/i386/stand/pxeboot/main.c | 7 +++++--
sys/sys/bootblock.h | 4 +++-
usr.sbin/installboot/arch/i386.c | 14 ++++++++++----
usr.sbin/installboot/installboot.8 | 16 ++++++++++++++--
usr.sbin/installboot/installboot.c | 6 ++++--
usr.sbin/installboot/installboot.h | 4 +++-
9 files changed, 55 insertions(+), 17 deletions(-)
diffs (235 lines):
diff -r d9568437524c -r 118fd9f5f35b sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c Thu Jan 14 16:58:27 2010 +0000
+++ b/sys/arch/i386/stand/boot/boot2.c Thu Jan 14 17:49:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot2.c,v 1.45 2009/09/13 22:45:27 jmcneill Exp $ */
+/* $NetBSD: boot2.c,v 1.46 2010/01/14 17:49:31 drochner Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -291,6 +291,8 @@
#endif
gateA20();
+ boot_modules_enabled = !!(boot_params.bp_flags
+ & X86_BP_FLAGS_LOADMODULES);
if (boot_params.bp_flags & X86_BP_FLAGS_RESET_VIDEO)
biosvideomode();
@@ -308,7 +310,8 @@
default_filename = DEFFILENAME;
#ifndef SMALL
- parsebootconf(BOOTCONF);
+ if (boot_params.bp_flags & X86_BP_FLAGS_READBOOTCONF)
+ parsebootconf(BOOTCONF);
/*
* If console set in boot.cfg, switch to it.
diff -r d9568437524c -r 118fd9f5f35b sys/arch/i386/stand/lib/boot_params.S
--- a/sys/arch/i386/stand/lib/boot_params.S Thu Jan 14 16:58:27 2010 +0000
+++ b/sys/arch/i386/stand/lib/boot_params.S Thu Jan 14 17:49:31 2010 +0000
@@ -1,8 +1,12 @@
-/* $NetBSD: boot_params.S,v 1.4 2005/12/11 12:17:48 christos Exp $ */
+/* $NetBSD: boot_params.S,v 1.5 2010/01/14 17:49:31 drochner Exp $ */
/* Default boot parameters - must match struct x86_boot_params in bootblock.h */
- .long 0 /* flags */
+#ifdef BOOTPARAM_DEFFLAGS
+ .long BOOTPARAM_DEFFLAGS
+#else
+ .long 0x0c /* flags: bootconf+modules */
+#endif
.long 5 /* timeout in seconds */
.long 0 /* console device 0 => CONSDEV_PC */
.long 9600 /* serial baud rate */
diff -r d9568437524c -r 118fd9f5f35b sys/arch/i386/stand/pxeboot/Makefile
--- a/sys/arch/i386/stand/pxeboot/Makefile Thu Jan 14 16:58:27 2010 +0000
+++ b/sys/arch/i386/stand/pxeboot/Makefile Thu Jan 14 17:49:31 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2009/03/30 09:22:53 tsutsui Exp $
+# $NetBSD: Makefile,v 1.18 2010/01/14 17:49:31 drochner Exp $
S= ${.CURDIR}/../../../..
@@ -63,6 +63,10 @@
CPPFLAGS+= -DPASS_MEMMAP
CPPFLAGS+= -DEPIA_HACK
+# modules and boot.cfg need special DHCP server setup, disable
+# per default for compatibility with existing setups
+CPPFLAGS+= -DBOOTPARAM_DEFFLAGS=0
+
#CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
diff -r d9568437524c -r 118fd9f5f35b sys/arch/i386/stand/pxeboot/main.c
--- a/sys/arch/i386/stand/pxeboot/main.c Thu Jan 14 16:58:27 2010 +0000
+++ b/sys/arch/i386/stand/pxeboot/main.c Thu Jan 14 17:49:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.22 2009/12/13 23:01:42 jakllsch Exp $ */
+/* $NetBSD: main.c,v 1.23 2010/01/14 17:49:31 drochner Exp $ */
/*
* Copyright (c) 1996
@@ -130,9 +130,12 @@
initio(CONSDEV_PC);
#endif
gateA20();
+ boot_modules_enabled = !!(boot_params.bp_flags
+ & X86_BP_FLAGS_LOADMODULES);
#ifndef SMALL
- parsebootconf(BOOTCONF);
+ if (boot_params.bp_flags & X86_BP_FLAGS_READBOOTCONF)
+ parsebootconf(BOOTCONF);
/*
* If console set in boot.cfg, switch to it.
diff -r d9568437524c -r 118fd9f5f35b sys/sys/bootblock.h
--- a/sys/sys/bootblock.h Thu Jan 14 16:58:27 2010 +0000
+++ b/sys/sys/bootblock.h Thu Jan 14 17:49:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootblock.h,v 1.48 2009/10/26 14:22:47 tsutsui Exp $ */
+/* $NetBSD: bootblock.h,v 1.49 2010/01/14 17:49:31 drochner Exp $ */
/*-
* Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
@@ -1068,6 +1068,8 @@
/* values for bp_flags */
#define X86_BP_FLAGS_RESET_VIDEO 1
#define X86_BP_FLAGS_PASSWORD 2
+#define X86_BP_FLAGS_LOADMODULES 4
+#define X86_BP_FLAGS_READBOOTCONF 8
/* values for bp_consdev */
#define X86_BP_CONSDEV_PC 0
diff -r d9568437524c -r 118fd9f5f35b usr.sbin/installboot/arch/i386.c
--- a/usr.sbin/installboot/arch/i386.c Thu Jan 14 16:58:27 2010 +0000
+++ b/usr.sbin/installboot/arch/i386.c Thu Jan 14 17:49:31 2010 +0000
@@ -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 @@
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 @@
}
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 -r d9568437524c -r 118fd9f5f35b usr.sbin/installboot/installboot.8
--- a/usr.sbin/installboot/installboot.8 Thu Jan 14 16:58:27 2010 +0000
+++ b/usr.sbin/installboot/installboot.8 Thu Jan 14 17:49:31 2010 +0000
@@ -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 @@
.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 -r d9568437524c -r 118fd9f5f35b usr.sbin/installboot/installboot.c
--- a/usr.sbin/installboot/installboot.c Thu Jan 14 16:58:27 2010 +0000
+++ b/usr.sbin/installboot/installboot.c Thu Jan 14 17:49:31 2010 +0000
@@ -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 @@
{ "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 -r d9568437524c -r 118fd9f5f35b usr.sbin/installboot/installboot.h
--- a/usr.sbin/installboot/installboot.h Thu Jan 14 16:58:27 2010 +0000
+++ b/usr.sbin/installboot/installboot.h Thu Jan 14 17:49:31 2010 +0000
@@ -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 @@
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 {
Home |
Main Index |
Thread Index |
Old Index