From owner-freebsd-hackers@FreeBSD.ORG Mon May 9 17:42:26 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 923EC1065670 for ; Mon, 9 May 2011 17:42:26 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 5C27B8FC18 for ; Mon, 9 May 2011 17:42:26 +0000 (UTC) Received: from sbhfislrext02.fnfis.com ([192.168.249.140]) by SCSFISLTC02 (8.14.3/8.14.3) with ESMTP id p49HgMYW007179; Mon, 9 May 2011 12:42:22 -0500 Received: from sbhfisltcgw02.FNFIS.COM (Not Verified[10.132.248.122]) by sbhfislrext02.fnfis.com with MailMarshal (v6, 5, 4, 7535) id ; Mon, 09 May 2011 12:42:32 -0500 Received: from SBHFISLTCGW04.FNFIS.COM ([10.132.248.123]) by sbhfisltcgw02.FNFIS.COM with Microsoft SMTPSVC(6.0.3790.4675); Mon, 9 May 2011 12:42:22 -0500 Received: from dtwin ([10.132.254.136]) by SBHFISLTCGW04.FNFIS.COM over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 9 May 2011 12:42:20 -0500 From: "Devin Teske" To: "'Lars Engels'" References: <65D3163B-427B-41F6-80B9-7BA4AF794939@vicor.com> <20110509091902.GR47109@e-new.0x20.net> In-Reply-To: <20110509091902.GR47109@e-new.0x20.net> Date: Mon, 9 May 2011 10:41:40 -0700 Organization: Vicor, Inc. Message-ID: <000601cc0e70$5e960dc0$1bc22940$@vicor.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQDz/r0NBVB67BiLX0QruoJxa2/nHQMRrLZrlhxOTYA= Content-Language: en-us X-OriginalArrivalTime: 09 May 2011 17:42:21.0901 (UTC) FILETIME=[7336F7D0:01CC0E70] Cc: 'FreeBSD Hackers' Subject: RE: [UPDATE] New Boot-Loader Menu -- version 1.4 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 17:42:26 -0000 > -----Original Message----- > From: Lars Engels [mailto:lars.engels@0x20.net] > Sent: Monday, May 09, 2011 2:19 AM > To: Devin Teske > Cc: FreeBSD Hackers > Subject: Re: [UPDATE] New Boot-Loader Menu -- version 1.4 >=20 > On Thu, May 05, 2011 at 01:20:43AM -0700, Devin Teske wrote: > > Hello fellow -hackers, > > > > I'm so very proud to offer the latest update to my new boot loader > > menu -- version 1.4 -- addressing ACPI detection, bringing it in-line > > with HEAD. > > > > It took some work and a few days, but I got it! Have a look below for > > six different displays (three different scenarios -- i386 w/ ACPI, > > i386 w/o ACPI, and non-i386 -- each in both B&W and Color). > > >=20 > Hi Devin, >=20 > PC-BSD also has a slightly patched loader menu compared to the stock Free= BSD > version. Does PC-BSD have CVSweb that I can browse? Link? > I.E. you can also set unset verbose mode and ACPI with it. > Some days ago there was a proposal on a PC-BSD list to add an option to b= oot a > different kernel if one is found in /boot. > Would it be possible to addi this function to your boot menu? No need. The basic constructs are there already, we just need to expand on = them. Here's how I've implemented a hard-coded list of kernels to choose from for= our systems (to be implemented in /boot/menu.rc): \ Set kernel paths (see menu_caption[2] below) set kernel_prefix=3D"/kernels/" \ NOTE: We like to keep our kernels in `/kernels' set kernel[0]=3D"FIS-i386-8.1p1" set kernel[1]=3D"GENERIC-i386-8.1p1" set kernel_suffix=3D".kgz" \ NOTE: This is on our CD/DVD, so kernels are kgzip(8)'d \ Set default boot kernel set kernel=3D"${kernel_prefix}${kernel[0]}${kernel_suffix}" \ Initialize main menu constructs (variables are read by `menu.4th') set menu_caption[1]=3D"Boot [ENTER]" set menu_command[1]=3D"boot" set menu_caption[2][0]=3D"Kernel: ${kernel[0]} (1of2)" set menu_caption[2][1]=3D"Kernel: ${kernel[1]} (2of2)" set menu_caption[2]=3D"${menu_caption[2][0]}" set menu_command[2]=3D"cycle_kernel" \ ... rest of menu ... The magic is the "cycle_kernel" command (see `/boot/menu.4th'). The `cycle_= kernel' command is a wrapper to the `cycle_menuitem' command (similar to ho= w `toggle_verbose', `toggle_acpi', and `toggle_singleuser' are wrappers to = the `toggle_menuitem' command). Like the `toggle_menuitem' command, the `cy= cle_menuitem' command uses a system of internal state variables to track wh= ich menuitem text is to be displayed for that individual menuitem. Whereas = the `toggle_menuitem' command automatically toggles the text of a menuitem = between the `menu_caption[x]' and `toggled_text[x]' variables, the `cycle_m= enuitem' command automatically cycles through the `menu_caption[x][y]' vari= ables, cycling back to y=3D0 when it gets to an undefined `y' value. However, hard-coding an alternate kernel choice is something that I wouldn'= t condone for an actual release. Instead, what I would recommend is to dyna= mically allocate the kernel menu if/when multiple kernels are discovered/co= nfigured. That's something that is currently not coded (dynamic detection o= f kernels in /boot). > Or even better > work together with Kris Moore so we don't have two solutions for the same= task? I'd like to open a discussion with Kris Moore on how we could go about dete= cting additional kernels. Off the top of my head, here's a couple thoughts: a. We could test a battery of different kernel names (kernel, kernel.bak, k= ernel.orig, etc.) b. We could allow the user to set kernel1, kernel2, kernel3, etc. in loader= .conf(5) c. We could allow the user to set kernel=3D"kernel1;kernel2;kernel3;..." in= loader.conf(5) d. Some combination of the above. --=20 Devin P.S. I think it'd also be nice to someday offer the user a choice of bootin= g into a memory filesystem for rescue purposes. We've offered this to our u= sers for years with the following configuration: set root[0]=3D"" set root[1]=3D"rescue_mfsroot" set menu_caption[7][0]=3D"Root Image: Default (1of2)" set menu_caption[7][1]=3D"Root Image: Rescue (2of2)" set menu_caption[7]=3D"${menu_caption[7][0]}" set menu_command[7]=3D"cycle_root" _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. _____________