1.\" $NetBSD: boot.cfg.5,v 1.25 2012/03/03 15:14:03 nonaka Exp $ 2.\" 3.\" Copyright (c) 2007 Stephen Borrill 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. The name of the author may not be used to endorse or promote products 15.\" derived from this software without specific prior written permission 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" 28.Dd November 28, 2011 29.Dt BOOT.CFG 5 30.Os 31.Sh NAME 32.Nm boot.cfg 33.Nd configuration file for /boot 34.Sh DESCRIPTION 35The file 36.Pa /boot.cfg 37is used to alter the behaviour of the standard boot loader described in 38.Xr boot 8 . 39Configuration changes include setting the timeout, choosing a console device, 40altering the banner text and displaying a menu allowing boot commands to be 41easily chosen. 42If a 43.Nm 44file is not present, the system will boot as normal. 45.Ss FILE FORMAT 46The format of the file is a series of lines containing keyword/value pairs 47separated by an equals sign 48.Pq Sq = . 49There should be no whitespace surrounding the equals sign. 50Lines beginning with a hash 51.Pq Sq # 52are comments and will be ignored. 53.Pp 54Some keywords can be present multiple times in the file to define additional 55items. 56Such keywords are noted below. 57.Pp 58.Bl -tag -width timeout 59.It Sy banner 60(may be present multiple times) 61The text from banner lines is displayed instead of the standard welcome text 62by the boot loader. 63Up to 10 lines can be defined. 64No special character sequences are recognised, so to specify a blank line, a 65banner line with no value should be given. 66.It Sy clear 67If nonzero, clear the screen before printing the banner. 68If zero, do not clear the screen (the default). 69.It Sy consdev 70Changes the console device to that specified in the value. 71Valid values are any of those that could be specified at the normal boot 72prompt with the consdev command. 73.It Sy default 74Used to specify the default menu item which will be chosen in the case of 75Return being pressed or the timeout timer reaching zero. 76The value is the number of the menu item as displayed. 77As described above, the menu items are counted from 1 in the order listed in 78.Nm . 79If not specified, the default value will be option 1, i.e. the first item. 80.It Sy format 81Changes how the menu options are displayed. 82Should be set to one of 83.Sq a 84for automatic, 85.Sq l 86for letters and 87.Sq n 88for numbers. 89If set to automatic (the default), menu options will be displayed numerically 90unless there are more than 9 options and the timeout is greater than zero. 91If there are more than 9 options with a timeout greater than zero and 92the format is set to number, only the first 9 options will be available. 93.It Sy load 94Used to load kernel modules, which will be passed on to the kernel for 95initialization during early boot. 96The argument is either the complete path and file name of the module to be 97loaded, or a symbolic module name. 98When the argument is not an absolute path, the boot loader will first 99attempt to load 100.Pa /stand/\*[Lt]machine\*[Gt]/\*[Lt]kernel_version\*[Gt]/modules/\*[Lt]name\*[Gt]/\*[Lt]name\*[Gt].kmod . 101If that file does not exist, it will then attempt to load 102.Pa /\*[Lt]name\*[Gt] . 103May be used as many times as needed. 104.It Sy menu 105(may be present multiple times) 106Used to define a menu item to be displayed to the end-user at boot time 107which allows a series of boot commands to be run without further typing. 108The value consists of the required menu text, followed by a colon 109.Pq Sq \&: 110and then the desired command(s). 111Multiple commands can be specified separated by a semi-colon. 112If the specified menu text is empty 113(the colon appears immediately after the equals sign), 114then the displayed menu text is the same as the command. 115For example: 116.Bd -literal 117menu=Boot normally:boot 118menu=Boot single-user:boot -s 119menu=Boot with module foo:load /foo.kmod;boot 120menu=Boot with serial console:consdev com0;boot 121menu=:boot hd1a:netbsd -as 122.Ed 123.Pp 124Each menu item will be prefixed by an ascending number when displayed, 125i.e. the order in the 126.Nm 127file is important. 128.Pp 129Each command is executed just as though the user had typed it in 130and so can be any valid command that would be accepted at the 131normal boot prompt. 132In addition, 133.Dq Ic prompt 134can be used to drop to the normal boot prompt. 135.It Sy timeout 136If the value is greater than zero, this specifies the time in seconds 137that the boot loader will wait for the end-user to choose a menu item. 138During the countdown period, they may press Return to choose the default 139option or press a number key corresponding to a menu option. 140If any other key is pressed, the countdown will stop and the user will be 141prompted to choose a menu option with no further time limit. 142If the timeout value is set to zero, the default option will be booted 143immediately. 144If the timeout value is negative or is not a number, there will be no 145time limit for the user to choose an option. 146.It Sy userconf 147Passes a 148.Xr userconf 4 149command to the kernel at boot time. 150.It Sy rndseed 151Takes the path to a random-seed file as written by the 152.Fl S 153flag to 154.Xr rndctl 8 155as an argument. 156This file is used to seed the kernel entropy pool 157.Xr rnd 9 158very early in kernel startup, so that high quality randomness is 159available to all kernel modules. 160This argument should be supplied 161before any 162.Dq Ic load 163commands that may load executable modules. 164.El 165.Sh EXAMPLES 166Here is an example 167.Nm 168file: 169.Bd -literal -offset indent 170banner=Welcome to NetBSD 171banner================== 172banner= 173banner=Please choose an option from the following menu: 174menu=Boot normally:boot 175menu=Boot single-user:boot -s 176menu=Boot from second disk:boot hd1a: 177menu=Boot with module foo:load /foo.kmod;boot 178menu=Boot with modules foo and bar:load /foo.kmod;load /bar.kmod;boot 179menu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M 180menu=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 181menu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M 182menu=Go to command line (advanced users only):prompt 183clear=1 184timeout=-1 185default=1 186userconf=disable ehci* 187# Always load ramdisk module 188load=/miniroot.kmod 189.Ed 190.Pp 191N.B. Xen counts serial ports from com1 upwards, but 192.Nx 193counts from com0, so the appropriate device name must be used. 194Please see the Xen with serial console example above. 195.Pp 196This will clear the screen and display: 197.Bd -literal -offset indent 198Welcome to NetBSD 199================= 200 201Please choose an option from the following menu: 202 203 1. Boot normally 204 2. Boot single-user 205 3. Boot from second disk 206 4. Boot with module foo 207 5. Boot with modules foo and bar 208 6. Boot Xen with 256 MB for dom0 209 7. Boot Xen with 256 MB for dom0 (serial) 210 8. Boot Xen with dom0 in single-user mode 211 9. Go to command line (advanced users only) 212 213Option [1]: 214.Ed 215.Pp 216It will then wait for the user to type 1, 2, 3, 4, 5, 6, 7, 8 or 9 followed by 217Return. 218Pressing Return by itself will run option 1. 219There will be no timeout. 220.Sh SEE ALSO 221.Xr boot 8 , 222.Xr boothowto 9 223.Sh HISTORY 224The 225.Nm 226file appeared in 227.Nx 5.0 . 228.Sh AUTHORS 229The 230.Nm 231extensions to 232.Xr boot 8 233were written by 234.An Stephen Borrill 235.Aq sborrill@NetBSD.org . 236.Sh BUGS 237Support for 238.Nm 239is currently for 240.Nx Ns /i386 241and 242.Nx Ns /amd64 243only. 244It is hoped that its use will be extended to other appropriate ports that 245use the 246.Xr boot 8 247interface. 248