From owner-freebsd-current@FreeBSD.ORG Fri Dec 16 13:57:19 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00DCA1065673 for ; Fri, 16 Dec 2011 13:57:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B48E78FC16 for ; Fri, 16 Dec 2011 13:57:18 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 6CD6E46B3B; Fri, 16 Dec 2011 08:57:18 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DC601B958; Fri, 16 Dec 2011 08:57:17 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org Date: Fri, 16 Dec 2011 08:57:16 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <94847CD1-4361-424C-A2F6-75CAE918E2A9@averesystems.com> In-Reply-To: <94847CD1-4361-424C-A2F6-75CAE918E2A9@averesystems.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112160857.16464.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 16 Dec 2011 08:57:18 -0500 (EST) Cc: Andrew Boyer Subject: Re: Idea for change to boot0 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2011 13:57:19 -0000 On Thursday, December 15, 2011 4:21:51 pm Andrew Boyer wrote: > These two changes allow you to set PXE as the default MBR boot selection, which enables you to write a 'reboot to the network' script. We've found it to be very useful. What do people think? I think these are good. One suggestion might be to let the you do 'boot0cfg -s pxe' (or PXE, just use strcasecmp) so it is more explicit and less of a magic number. I.e. something like: case 's': if (strcasecmp(optarg, "pxe") == 0) s_arg = 6; else s_arg = argtoi(optarg, 1, 6, 's'); break; I think that is less confusing as some folks might thing '-s 6' means booting from /dev/fooXs6 (which it doesn't). Also, the manpage for boot0cfg will need to be updated. Other than that I think this looks great. I have a slightly updated version below (I also wanted to keep the output of the default setting in "order" so the logic is slightly different): Index: sys/boot/i386/boot0/boot0.S =================================================================== --- sys/boot/i386/boot0/boot0.S (revision 228534) +++ sys/boot/i386/boot0/boot0.S (working copy) @@ -413,6 +413,7 @@ 3: #endif /* ONLY_F_KEYS */ #endif /* SIO */ +check_selection: cmpb $0x5,%al # F1..F6 or 1..6 ? #ifdef PXE /* enable PXE/INT18 using F6 */ jne 1f; @@ -421,7 +422,6 @@ #endif /* PXE */ jae beep # Not in F1..F5, beep -check_selection: /* * We have a selection. If it's a bad selection go back to complain. * The bits in MNUOPT were set when the options were printed. Index: usr.sbin/boot0cfg/boot0cfg.c =================================================================== --- usr.sbin/boot0cfg/boot0cfg.c (revision 228534) +++ usr.sbin/boot0cfg/boot0cfg.c (working copy) @@ -169,7 +169,10 @@ o_flag = 1; break; case 's': - s_arg = argtoi(optarg, 1, 5, 's'); + if (strcasecmp(optarg, "pxe") == 0) + s_arg = 6; + else + s_arg = argtoi(optarg, 1, 5, 's'); break; case 't': t_arg = argtoi(optarg, 1, 0xffff, 't'); @@ -472,8 +475,10 @@ printf("default_selection=F%d (", mbr[OFF_OPT] + 1); if (mbr[OFF_OPT] < 4) printf("Slice %d", mbr[OFF_OPT] + 1); + else if (mbr[OFF_OPT] == 4) + printf("Drive 1"); else - printf("Drive 1"); + printf("PXE"); printf(")\n"); } Index: usr.sbin/boot0cfg/boot0cfg.8 =================================================================== --- usr.sbin/boot0cfg/boot0cfg.8 (revision 228534) +++ usr.sbin/boot0cfg/boot0cfg.8 (working copy) @@ -146,6 +146,9 @@ .Ar slice . Values between 1 and 4 refer to slices; a value of 5 refers to the option of booting from a second disk. +The special string +.Dq PXE +or a value of 6 can be used to boot via PXE. .It Fl t Ar ticks Set the timeout value to .Ar ticks . -- John Baldwin