Subject: 2nd stage boot menu (i386)
To: None <current-users@netbsd.org>
From: Stephen Borrill <netbsd@precedence.co.uk>
List: current-users
Date: 11/13/2007 15:40:18
I've been working on extending the 2nd stage boot loader so that it can 
display a menu of commands. This is configured from /boot.cnf which 
also allows a banner message, timeout and console device to be altered 
without having to use installboot. If no boot.cnf is present, then boot 
behaves as before.

I'm not set on boot.cnf as the filename, but it should remain in 8.3 
format. Perhaps boot.cfg.

The new /boot will work anywhere the old one will, e.g. CD, USB. This is 
particularly nice for giving a friendly menu on the install CD allowing 
selection of ACPI vs non-ACPI kernels.

For testing, please see:

ftp://ftp.netbsd.org/pub/NetBSD/misc/sborrill/

There's a patch, pre-compiled /boot and example boot.cnf file.

The example boot.cnf file contains:

banner=Welcome to NetBSD!
banner=Please choose from the following options
menu=Boot NetBSD normally:boot
menu=Boot NetBSD single user:boot -s
timeout=5

If timeout is set to n, there is no countdown (i.e. it'll wait for ever). 
If set to zero, it will boot immediately without prompting. The default 
can be set with a "default=X" line (the default default is 1 if you see 
what I mean :-) ).

The console device can be set with consdev=com0 for example.

The menu commands are in the format menu=DisplayText:BootLoaderCommand
and are displayed in the order they exist in the file counting from 1.
The commands are identical to those used interactively, except for one 
addition; if the command is "prompt" it will drop to the standard 
bootloader prompt. e.g.

menu=More boot options:prompt

For the fearful, there is a gzipped iso image which will just give you the 
option to boot from hd0a:

I need to create a boot.cnf(5) man page. I could add #ifdef SMALL too 
so that it can be shrunk for floppies (it adds around 1200 bytes to 
/boot) if this is deemed necessary.

Future improvements:
- link with jmcneill's bootprops so that a plist can be specified
- more interactive menu (I've a tiny curses menu which I could release
under a BSD licence and use as a basis - anyone know how about cursor
positioning at this BIOS stage?)
- Spread use more widely (e.g. other archs macppc/ofwboot.xcf?)
- Support tftp/nfs to get boot.cnf file

Any other objections before I commit?

-- 
Stephen