xref: /netbsd-src/share/man/man5/boot.cfg.5 (revision c10cd063e1c81200cab209deb115c478262fd172)
1*c10cd063Sfcambus.\"	$NetBSD: boot.cfg.5,v 1.32 2022/04/15 16:30:09 fcambus Exp $
2d849e6b3Ssborrill.\"
3d849e6b3Ssborrill.\" Copyright (c) 2007 Stephen Borrill
4d849e6b3Ssborrill.\" All rights reserved.
5d849e6b3Ssborrill.\"
6d849e6b3Ssborrill.\" Redistribution and use in source and binary forms, with or without
7d849e6b3Ssborrill.\" modification, are permitted provided that the following conditions
8d849e6b3Ssborrill.\" are met:
9d849e6b3Ssborrill.\" 1. Redistributions of source code must retain the above copyright
10d849e6b3Ssborrill.\"    notice, this list of conditions and the following disclaimer.
11d849e6b3Ssborrill.\" 2. Redistributions in binary form must reproduce the above copyright
12d849e6b3Ssborrill.\"    notice, this list of conditions and the following disclaimer in the
13d849e6b3Ssborrill.\"    documentation and/or other materials provided with the distribution.
14d849e6b3Ssborrill.\" 3. The name of the author may not be used to endorse or promote products
15d849e6b3Ssborrill.\"    derived from this software without specific prior written permission
16d849e6b3Ssborrill.\"
17d849e6b3Ssborrill.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18d849e6b3Ssborrill.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19d849e6b3Ssborrill.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20d849e6b3Ssborrill.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21d849e6b3Ssborrill.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22d849e6b3Ssborrill.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23d849e6b3Ssborrill.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24d849e6b3Ssborrill.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25d849e6b3Ssborrill.\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26d849e6b3Ssborrill.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27d849e6b3Ssborrill.\"
28a0c0a132Skim.Dd November 24, 2020
293a63ee36Ssborrill.Dt BOOT.CFG 5
30d849e6b3Ssborrill.Os
31d849e6b3Ssborrill.Sh NAME
32d849e6b3Ssborrill.Nm boot.cfg
33d849e6b3Ssborrill.Nd configuration file for /boot
34d849e6b3Ssborrill.Sh DESCRIPTION
3513a39ab5SwizThe file
3613a39ab5Swiz.Pa /boot.cfg
37d849e6b3Ssborrillis used to alter the behaviour of the standard boot loader described in
38d849e6b3Ssborrill.Xr boot 8 .
39d849e6b3SsborrillConfiguration changes include setting the timeout, choosing a console device,
40d849e6b3Ssborrillaltering the banner text and displaying a menu allowing boot commands to be
41d849e6b3Ssborrilleasily chosen.
42d849e6b3SsborrillIf a
43d849e6b3Ssborrill.Nm
44d849e6b3Ssborrillfile is not present, the system will boot as normal.
45d849e6b3Ssborrill.Ss FILE FORMAT
46d849e6b3SsborrillThe format of the file is a series of lines containing keyword/value pairs
47d849e6b3Ssborrillseparated by an equals sign
48d849e6b3Ssborrill.Pq Sq = .
49d849e6b3SsborrillThere should be no whitespace surrounding the equals sign.
50d849e6b3SsborrillLines beginning with a hash
51d849e6b3Ssborrill.Pq Sq #
52d849e6b3Ssborrillare comments and will be ignored.
53d849e6b3Ssborrill.Pp
543eea9a90SkimThe
553eea9a90Skim.Dq Ic banner ,
563eea9a90Skim.Dq Ic load ,
573eea9a90Skim.Dq Ic menu ,
583eea9a90Skimand
593eea9a90Skim.Dq Ic userconf
603eea9a90Skimkeywords can be present multiple times in the file to define additional
61d849e6b3Ssborrillitems.
623eea9a90SkimSee the description for each keyword for guidance and limitations on
633eea9a90Skimusing multiple entries.
64d849e6b3Ssborrill.Bl -tag -width timeout
65d849e6b3Ssborrill.It Sy banner
66d849e6b3SsborrillThe text from banner lines is displayed instead of the standard welcome text
67d849e6b3Ssborrillby the boot loader.
68*c10cd063SfcambusUp to 12 lines can be defined.
69d849e6b3SsborrillNo special character sequences are recognised, so to specify a blank line, a
70d849e6b3Ssborrillbanner line with no value should be given.
7183d64e1dSchristos.It Sy clear
7283d64e1dSchristosIf nonzero, clear the screen before printing the banner.
7383d64e1dSchristosIf zero, do not clear the screen (the default).
7483d64e1dSchristos.It Sy consdev
7583d64e1dSchristosChanges the console device to that specified in the value.
7683d64e1dSchristosValid values are any of those that could be specified at the normal boot
7783d64e1dSchristosprompt with the consdev command.
7883d64e1dSchristos.It Sy default
7983d64e1dSchristosUsed to specify the default menu item  which will be chosen in the case of
8083d64e1dSchristosReturn being pressed or the timeout timer reaching zero.
8183d64e1dSchristosThe value is the number of the menu item as displayed.
8283d64e1dSchristosAs described above, the menu items are counted from 1 in the order listed in
8383d64e1dSchristos.Nm .
8483d64e1dSchristosIf not specified, the default value will be option 1, i.e. the first item.
8583d64e1dSchristos.It Sy format
8683d64e1dSchristosChanges how the menu options are displayed.
8783d64e1dSchristosShould be set to one of
8883d64e1dSchristos.Sq a
8983d64e1dSchristosfor automatic,
9083d64e1dSchristos.Sq l
9183d64e1dSchristosfor letters and
9283d64e1dSchristos.Sq n
9383d64e1dSchristosfor numbers.
9483d64e1dSchristosIf set to automatic (the default), menu options will be displayed numerically
9583d64e1dSchristosunless there are more than 9 options and the timeout is greater than zero.
9683d64e1dSchristosIf there are more than 9 options with a timeout greater than zero and
9783d64e1dSchristosthe format is set to number, only the first 9 options will be available.
9883d64e1dSchristos.It Sy load
9983d64e1dSchristosUsed to load kernel modules, which will be passed on to the kernel for
10083d64e1dSchristosinitialization during early boot.
10142b8a923SjmcneillThe argument is either the complete path and file name of the module to be
10242b8a923Sjmcneillloaded, or a symbolic module name.
10342b8a923SjmcneillWhen the argument is not an absolute path, the boot loader will first
10442b8a923Sjmcneillattempt to load
10501869ca4Swiz.Pa /stand/<machine>/<kernel_version>/modules/<name>/<name>.kmod .
10642b8a923SjmcneillIf that file does not exist, it will then attempt to load
10701869ca4Swiz.Pa /<name> .
10883d64e1dSchristosMay be used as many times as needed.
109d849e6b3Ssborrill.It Sy menu
110d849e6b3SsborrillUsed to define a menu item to be displayed to the end-user at boot time
111d849e6b3Ssborrillwhich allows a series of boot commands to be run without further typing.
112d849e6b3SsborrillThe value consists of the required menu text, followed by a colon
1134ee202cfSapb.Pq Sq \&:
114dac9aa49Ssborrilland then the desired command(s).
115dac9aa49SsborrillMultiple commands can be specified separated by a semi-colon.
1164ee202cfSapbIf the specified menu text is empty
1174ee202cfSapb(the colon appears immediately after the equals sign),
1184ee202cfSapbthen the displayed menu text is the same as the command.
119d849e6b3SsborrillFor example:
120d849e6b3Ssborrill.Bd -literal
121d849e6b3Ssborrillmenu=Boot normally:boot
122d849e6b3Ssborrillmenu=Boot single-user:boot -s
12367d1007eSsborrillmenu=Boot with module foo:load /foo.kmod;boot
12467d1007eSsborrillmenu=Boot with serial console:consdev com0;boot
1254ee202cfSapbmenu=:boot hd1a:netbsd -as
126d849e6b3Ssborrill.Ed
127d849e6b3Ssborrill.Pp
128d849e6b3SsborrillEach menu item will be prefixed by an ascending number when displayed,
129d849e6b3Ssborrilli.e. the order in the
130d849e6b3Ssborrill.Nm
131d849e6b3Ssborrillfile is important.
132d849e6b3Ssborrill.Pp
133dac9aa49SsborrillEach command is executed just as though the user had typed it in
134d849e6b3Ssborrilland so can be any valid command that would be accepted at the
135d849e6b3Ssborrillnormal boot prompt.
136d849e6b3SsborrillIn addition,
13713a39ab5Swiz.Dq Ic prompt
138d849e6b3Ssborrillcan be used to drop to the normal boot prompt.
1399b0d6e42Swiz.It Sy rndseed
1409b0d6e42SwizTakes the path to a random-seed file as written by the
1419b0d6e42Swiz.Fl S
1429b0d6e42Swizflag to
1439b0d6e42Swiz.Xr rndctl 8
1449b0d6e42Swizas an argument.
1459b0d6e42SwizThis file is used to seed the kernel entropy pool
1469b0d6e42Swiz.Xr rnd 9
1479b0d6e42Swizvery early in kernel startup, so that high quality randomness is
1489b0d6e42Swizavailable to all kernel modules.
1499b0d6e42SwizThis argument should be supplied
1509b0d6e42Swizbefore any
1519b0d6e42Swiz.Dq Ic load
1529b0d6e42Swizcommands that may load executable modules.
153d849e6b3Ssborrill.It Sy timeout
154d849e6b3SsborrillIf the value is greater than zero, this specifies the time in seconds
155d849e6b3Ssborrillthat the boot loader will wait for the end-user to choose a menu item.
156d849e6b3SsborrillDuring the countdown period, they may press Return to choose the default
157d849e6b3Ssborrilloption or press a number key corresponding to a menu option.
158d849e6b3SsborrillIf any other key is pressed, the countdown will stop and the user will be
159d849e6b3Ssborrillprompted to choose a menu option with no further time limit.
160d849e6b3SsborrillIf the timeout value is set to zero, the default option will be booted
161d849e6b3Ssborrillimmediately.
162d849e6b3SsborrillIf the timeout value is negative or is not a number, there will be no
163d849e6b3Ssborrilltime limit for the user to choose an option.
164dcf64914Suebayasi.It Sy userconf
165dcf64914SuebayasiPasses a
166dcf64914Suebayasi.Xr userconf 4
167dcf64914Suebayasicommand to the kernel at boot time.
1683eea9a90SkimMay be used as many times as needed.
169a16a8ca0Snjoly.El
170d849e6b3Ssborrill.Sh EXAMPLES
171d849e6b3SsborrillHere is an example
172d849e6b3Ssborrill.Nm
173d849e6b3Ssborrillfile:
174d849e6b3Ssborrill.Bd -literal -offset indent
175d849e6b3Ssborrillbanner=Welcome to NetBSD
176d849e6b3Ssborrillbanner==================
177d849e6b3Ssborrillbanner=
178d849e6b3Ssborrillbanner=Please choose an option from the following menu:
179d849e6b3Ssborrillmenu=Boot normally:boot
180d849e6b3Ssborrillmenu=Boot single-user:boot -s
181d849e6b3Ssborrillmenu=Boot from second disk:boot hd1a:
18267d1007eSsborrillmenu=Boot with module foo:load /foo.kmod;boot
18367d1007eSsborrillmenu=Boot with modules foo and bar:load /foo.kmod;load /bar.kmod;boot
184fb3d0718Ssborrillmenu=Boot Xen with 256MB for dom0:load /netbsd-XEN3_DOM0 console=pc;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
185fb3d0718Ssborrillmenu=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
186fb3d0718Ssborrillmenu=Boot Xen with dom0 in single-user mode:load /netbsd-XEN3_DOM0 -s;multiboot /usr/pkg/xen3-kernel/xen.gz dom0_mem=256M
187d849e6b3Ssborrillmenu=Go to command line (advanced users only):prompt
18857e23477Schristosclear=1
189d849e6b3Ssborrilltimeout=-1
190d849e6b3Ssborrilldefault=1
191a0c0a132Skim# Disable Direct Rendering Manager (DRM) drivers
1923eea9a90Skimuserconf=disable i915drmkms*
1933eea9a90Skimuserconf=disable nouveau*
1943eea9a90Skimuserconf=disable radeon*
195dac9aa49Ssborrill# Always load ramdisk module
1965d185a94Sadload=/miniroot.kmod
197d849e6b3Ssborrill.Ed
198d849e6b3Ssborrill.Pp
199fb3d0718SsborrillN.B. Xen counts serial ports from com1 upwards, but
200fb3d0718Ssborrill.Nx
201fb3d0718Ssborrillcounts from com0, so the appropriate device name must be used.
202fb3d0718SsborrillPlease see the Xen with serial console example above.
203fb3d0718Ssborrill.Pp
20457e23477SchristosThis will clear the screen and display:
205d849e6b3Ssborrill.Bd -literal -offset indent
206d849e6b3SsborrillWelcome to NetBSD
207d849e6b3Ssborrill=================
208d849e6b3Ssborrill
209d849e6b3SsborrillPlease choose an option from the following menu:
210d849e6b3Ssborrill
211d849e6b3Ssborrill      1. Boot normally
212d849e6b3Ssborrill      2. Boot single-user
213d849e6b3Ssborrill      3. Boot from second disk
214dac9aa49Ssborrill      4. Boot with module foo
215dac9aa49Ssborrill      5. Boot with modules foo and bar
2161c412f99Sjoerg      6. Boot Xen with 256 MB for dom0
217fb3d0718Ssborrill      7. Boot Xen with 256 MB for dom0 (serial)
218fb3d0718Ssborrill      8. Boot Xen with dom0 in single-user mode
219fb3d0718Ssborrill      9. Go to command line (advanced users only)
220d849e6b3Ssborrill
221d849e6b3SsborrillOption [1]:
222d849e6b3Ssborrill.Ed
223d849e6b3Ssborrill.Pp
224fb3d0718SsborrillIt will then wait for the user to type 1, 2, 3, 4, 5, 6, 7, 8 or 9 followed by
225fb3d0718SsborrillReturn.
226d849e6b3SsborrillPressing Return by itself will run option 1.
227d849e6b3SsborrillThere will be no timeout.
228d849e6b3Ssborrill.Sh SEE ALSO
229f97f79d2Sjruoho.Xr boot 8 ,
2307aeb582fSjruoho.Xr boothowto 9
231d849e6b3Ssborrill.Sh HISTORY
232d849e6b3SsborrillThe
233d849e6b3Ssborrill.Nm
23430adde54Swizfile appeared in
235d849e6b3Ssborrill.Nx 5.0 .
236d849e6b3Ssborrill.Sh AUTHORS
237d849e6b3SsborrillThe
238d849e6b3Ssborrill.Nm
239d849e6b3Ssborrillextensions to
240d849e6b3Ssborrill.Xr boot 8
241d849e6b3Ssborrillwere written by
242d849e6b3Ssborrill.An Stephen Borrill
243d849e6b3Ssborrill.Aq sborrill@NetBSD.org .
24413a39ab5Swiz.Sh BUGS
24513a39ab5SwizSupport for
24613a39ab5Swiz.Nm
24713a39ab5Swizis currently for
24813a39ab5Swiz.Nx Ns /i386
24913a39ab5Swizand
25013a39ab5Swiz.Nx Ns /amd64
25113a39ab5Swizonly.
25213a39ab5SwizIt is hoped that its use will be extended to other appropriate ports that
25313a39ab5Swizuse the
25413a39ab5Swiz.Xr boot 8
25513a39ab5Swizinterface.
256