Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 2003 14:30:26 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        devans@hclb.demon.co.uk
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: boot2 no longer displays a prompt
Message-ID:  <20030111.143026.40685845.imp@bsdimp.com>
In-Reply-To: <1042319907snx@hclb.demon.co.uk>
References:  <1042319907snx@hclb.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <1042319907snx@hclb.demon.co.uk>
            devans@hclb.demon.co.uk (Dave Evans) writes:
: At bootup, boot2 is the program which displays a - sign on the console
: and if you hit the space bar it comes up with a prompt allowing you to
: change the drive and partition of the loader program, e.g. 
: ad(0,e)/boot/loader.
: 
: At least that's how it used to work. Nowadays, judging from my current
: of October 20, 2002, the - sign is no longer displayed and boot2 goes
: straight through to the loader.
: 
: Is this a bug, perhaps fixed, or has the prompt been taken out to make
: room for UFS2 code?  I've looked through the commit logs and there
: is nothing to indicate the prompt has been taken out.

It appears that we set autoboot to 1.  If there is a /boot.config and
we cannot parse it, we set it to 0.  When set to 0 we prompt.
However, it looks like there might be a bug, or it might be a boot0cfg
issue:

    if (autoboot && !*kname) {
	memcpy(kname, PATH_BOOT3, sizeof(PATH_BOOT3));
	if (!keyhit(3*SECOND)) {
	    load();
	    memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL));
	}
    }

    /* Present the user with the boot2 prompt. */

The keyhit() code looks like:

static int
keyhit(unsigned ticks)
{
    uint32_t t0, t1;

    if (opts & 1 << RBX_NOINTR)
	return 0;
...
}

so when opts has the RBX_NOINTR set, it doesn't wait for a key press.
If you have 'n' set in /boot.config, then you should see this.  We set
opts = RB_BOOTINFO, which picks its information up from the boot
blocks (eg, shouldn't impact things).  However, RBX_NOINTR is defined
to be 0x1f, which is 31, which is the same as RB_BOOTINFO. -> That's
the bug.  Not sure quite what to do about it.

This was introduced:

revision 1.38
date: 2002/03/23 19:40:27;  author: pb;  state: Exp;  lines: +8 -2
Add option -n to i386 boot2 to disallow boot interruption by keypress.

PR:             i386/36016
Submitted by:   Thomas Quinot <thomas@cuivre.fr.eu.org>
Reviewed by:    rnordier
MFC after:      1 week

I think that the fix is as follows:

Index: boot2.c
===================================================================
RCS file: /cache/ncvs/src/sys/boot/i386/boot2/boot2.c,v
retrieving revision 1.60
diff -u -r1.60 boot2.c
--- boot2.c	20 Dec 2002 05:49:40 -0000	1.60
+++ boot2.c	11 Jan 2003 21:28:39 -0000
@@ -53,7 +53,7 @@
 #define RBX_PAUSE	0x12	/* -p */
 #define RBX_DUAL	0x1d	/* -D */
 #define RBX_PROBEKBD	0x1e	/* -P */
-#define RBX_NOINTR	0x1f	/* -n */
+#define RBX_NOINTR	0x1c	/* -n */
 
 #define RBX_MASK	0x2005ffff
 
or

Index: boot2.c
===================================================================
RCS file: /cache/ncvs/src/sys/boot/i386/boot2/boot2.c,v
retrieving revision 1.60
diff -u -r1.60 boot2.c
--- boot2.c	20 Dec 2002 05:49:40 -0000	1.60
+++ boot2.c	11 Jan 2003 21:29:22 -0000
@@ -109,7 +109,7 @@
 } dsk;
 static char cmd[512];
 static char kname[1024];
-static uint32_t opts = RB_BOOTINFO;
+static uint32_t opts = 0;
 static struct bootinfo bootinfo;
 static uint8_t ioctrl = IO_KEYBOARD;
 


I'm not sure which is more right.  I note that with the RBX_MASK we
have now that RB_BOOTINFO bit is never passed on down to the kernel.
I don't recall the history of the boot sequence enough to know if
that's too old or too new to be of consequence.

Warner



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030111.143026.40685845.imp>