From owner-freebsd-hackers Sat Jan 11 13:32: 0 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AAD1B37B401 for ; Sat, 11 Jan 2003 13:31:57 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id B724643F6D for ; Sat, 11 Jan 2003 13:31:56 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h0BLVs1e001535; Sat, 11 Jan 2003 14:31:55 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 11 Jan 2003 14:30:26 -0700 (MST) Message-Id: <20030111.143026.40685845.imp@bsdimp.com> To: devans@hclb.demon.co.uk Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: boot2 no longer displays a prompt From: "M. Warner Losh" In-Reply-To: <1042319907snx@hclb.demon.co.uk> References: <1042319907snx@hclb.demon.co.uk> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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