BOOT.CFG(5) | File Formats Manual | BOOT.CFG(5) |
boot.cfg
—
configuration file for /boot
The file /boot.cfg is used to alter the
behaviour of the standard boot loader described in
boot(8). Configuration changes
include setting the timeout, choosing a console device, altering the banner
text and displaying a menu allowing boot commands to be easily chosen. If a
boot.cfg
file is not present, the system will boot
as normal.
The format of the file is a series of lines containing keyword/value pairs separated by an equals sign (‘=’). There should be no whitespace surrounding the equals sign. Lines beginning with a hash (‘#’) are comments and will be ignored.
The “banner
”,
“load
”,
“menu
”, and
“userconf
” keywords can be present
multiple times in the file to define additional items. See the description
for each keyword for guidance and limitations on using multiple entries.
boot.cfg
. If not specified, the default value will
be option 1, i.e. the first item.menu=Boot normally:boot menu=Boot single-user:boot -s menu=Boot with module foo:load /foo.kmod;boot menu=Boot with serial console:consdev com0;boot menu=:boot hd1a:netbsd -as
Each menu item will be prefixed by an ascending number when
displayed, i.e. the order in the boot.cfg
file
is important.
Each command is executed just as though the user had typed it
in and so can be any valid command that would be accepted at the normal
boot prompt. In addition, “prompt
”
can be used to drop to the normal boot prompt.
-S
flag to
rndctl(8) as an argument.
This file is used to seed the kernel entropy pool
rnd(9) very early in kernel
startup, so that high quality randomness is available to all kernel
modules. This argument should be supplied before any
“load
” commands that may load
executable modules.Here is an example boot.cfg
file:
banner=Welcome to NetBSD banner================== banner= banner=Please choose an option from the following menu: menu=Boot normally:boot menu=Boot single-user:boot -s menu=Boot from second disk:boot hd1a: menu=Boot with module foo:load /foo.kmod;boot menu=Boot with modules foo and bar:load /foo.kmod;load /bar.kmod;boot menu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M menu=Boot Xen with 256MB for dom0 (serial):load /netbsd-XEN3_DOM0 console=com0;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M console=com1 com1=115200,8n1 menu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M menu=Go to command line (advanced users only):prompt clear=1 timeout=-1 default=1 # Disable Direct Rendering Manager (DRM) drivers userconf=disable i915drmkms* userconf=disable nouveau* userconf=disable radeon* # Always load ramdisk module load=/miniroot.kmod
N.B. Xen counts serial ports from com1 upwards, but NetBSD counts from com0, so the appropriate device name must be used. Please see the Xen with serial console example above.
This will clear the screen and display:
Welcome to NetBSD ================= Please choose an option from the following menu: 1. Boot normally 2. Boot single-user 3. Boot from second disk 4. Boot with module foo 5. Boot with modules foo and bar 6. Boot Xen with 256 MB for dom0 7. Boot Xen with 256 MB for dom0 (serial) 8. Boot Xen with dom0 in single-user mode 9. Go to command line (advanced users only) Option [1]:
It will then wait for the user to type 1, 2, 3, 4, 5, 6, 7, 8 or 9 followed by Return. Pressing Return by itself will run option 1. There will be no timeout.
The boot.cfg
file appeared in
NetBSD 5.0.
The boot.cfg
extensions to
boot(8) were written by
Stephen Borrill
⟨sborrill@NetBSD.org⟩.
Support for boot.cfg
is currently for
NetBSD/i386 and NetBSD/amd64
only. It is hoped that its use will be extended to other appropriate ports
that use the boot(8)
interface.
November 24, 2020 | NetBSD 10.99 |