Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 May 2011 10:41:40 -0700
From:      "Devin Teske" <dteske@vicor.com>
To:        "'Lars Engels'" <lars.engels@0x20.net>
Cc:        'FreeBSD Hackers' <freebsd-hackers@freebsd.org>
Subject:   RE: [UPDATE] New Boot-Loader Menu -- version 1.4
Message-ID:  <000601cc0e70$5e960dc0$1bc22940$@vicor.com>
In-Reply-To: <20110509091902.GR47109@e-new.0x20.net>
References:  <65D3163B-427B-41F6-80B9-7BA4AF794939@vicor.com> <20110509091902.GR47109@e-new.0x20.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> -----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.
_____________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000601cc0e70$5e960dc0$1bc22940$>