xref: /openbsd-src/sys/arch/amd64/stand/boot/boot.8 (revision bf205b9638c7c57bbb1ea133d350e2e30f2ccf83)
1\"	$OpenBSD: boot.8,v 1.36 2024/11/05 09:42:48 miod Exp $
2.\"
3.\" Copyright (c) 1997-2001 Michael Shalayeff
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.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
19.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21.\" SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25.\" THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\"
28.Dd $Mdocdate: November 5 2024 $
29.Dt BOOT 8 amd64
30.Os
31.Sh NAME
32.Nm boot ,
33.Nm boot.conf
34.Nd amd64-specific second-stage bootstrap
35.Sh DESCRIPTION
36The main purpose of this program is to load the system kernel while dealing
37with the pitfalls of the PC BIOS architecture.
38.Pp
39As described in
40.Xr boot_amd64 8 ,
41this program is loaded by the
42.Xr biosboot 8
43primary bootstrap loader and provides a convenient way to load the kernel.
44This program acts as an enhanced boot monitor for PC systems, providing
45a common interface for the kernel to start from.
46.Pp
47Basic operations include:
48.Pp
49.Bl -bullet -compact
50.It
51Detecting and switching between multiple consoles.
52.It
53Loading kernels from any device supported by your system BIOS.
54.It
55Loading kernels compressed by
56.Xr gzip 1 .
57.It
58Passing system parameters queried from the BIOS to the kernel.
59.It
60Providing an interactive command line.
61.El
62.Pp
63The sequence of its operation is as follows: initialization,
64parsing the configuration file, then an interactive command line.
65While at the command line you have 5 seconds to type any commands, if needed.
66If time expires, the kernel will be loaded according to
67the current variable settings (see the
68.Ic set
69command).
70If the kernel load fails, a second attempt is made with the timeout increased
71by one second.
72The sequence of
73.Nm
74operations is as follows:
75.Bl -enum
76.It
77Set up a protected mode environment which catches and reports processor
78exceptions and provides a simple protected-mode BIOS interface.
79.It
80Probe for console devices, which includes the (default) PC VGA+Keyboard
81console
82.Pq Li pc0
83and up to four serial consoles
84.Pf ( Li com0
85through
86.Li com3 )
87connected to the serial ports.
88Display messages to the default console about the devices found.
89.It
90Detect memory.
91Conventional memory is detected by querying the BIOS.
92Extended memory is detected by probing page-by-page through the address
93space, rather than asking the BIOS; many BIOS's cannot report larger than
9464M of memory.
95All memory found is reported to the default console device.
96.It
97Probe for APM support in the BIOS.
98Display a message if support is present.
99.It
100If the file
101.Pa /etc/boot.conf
102exists on the filesystem
103.Nm
104was loaded from, open and parse it.
105Lines beginning with the
106.Sq #
107character,
108as well as whitespace at the beginning of lines,
109are ignored.
110The file may contain any commands
111.Nm
112accepts at the interactive prompt.
113Though default settings usually suffice, they can be changed here.
114.Pp
115.Pa boot.conf
116processing can be skipped, and the automatic boot cancelled, by holding
117down either Control key as
118.Nm
119starts.
120.It
121The header line
122.Pp
123.Dl >> OpenBSD/amd64 BOOT [x.xx]
124.Pp
125is displayed to the active console, where
126.Ar x.xx
127is the version number of the
128.Nm
129program, followed by the
130.Pp
131.Dl boot>
132.Pp
133prompt, which means you are in interactive mode and may enter commands.
134If you do not,
135.Nm
136will proceed to load the kernel with the current parameters after the
137timeout period has expired.
138.El
139.Pp
140By default,
141.Nm
142attempts to load the kernel executable
143.Pa /bsd .
144If it fails to find the kernel and no alternative kernel image has
145been specified, the system will be unable to boot.
146.Pp
147.Nm
148supports booting from
149.Xr softraid 4
150RAID 1, RAID 1C and CRYPTO volumes.
151.Sh COMMANDS
152The following commands are accepted at the
153.Nm
154prompt:
155.Bl -tag -width shorten
156.It Ic boot Oo Oo Ar device : Oc Ns Ar image Oc Op Fl acds
157Boots the specified kernel image
158with any options given.
159If
160.Ar device
161or
162.Ar image
163are omitted, values from
164.Nm
165variables will be used.
166.Pp
167When selecting the
168.Ar device
169to boot from,
170.Nm
171makes no distinction between SCSI and IDE type drives;
172they are detected as
173.Sq hd
174devices.
175Therefore, to boot kernel
176.Pa /bsd
177from slice
178.Sq a
179on the first hard drive
180.Pq irrespective of device type ,
181specify
182.Dq boot hd0a:/bsd .
183.Bl -tag -width _a_
184.It Fl a
185Causes the kernel to ask for the
186.Nm root
187device to use.
188.It Fl c
189Causes the kernel to go into
190.Xr boot_config 8
191before performing
192.Xr autoconf 4
193procedures.
194.It Fl d
195Causes the kernel to drop into
196.Xr ddb 4
197at the earliest convenient point.
198.It Fl s
199Causes the kernel to boot single-user.
200.El
201.It Ic echo Op Ar args
202Displays
203.Ar args
204on the console device.
205.It Ic help
206Prints a list of available commands and machine dependent
207commands, if any.
208.It Ic hexdump Ar addr size
209Show
210.Ar size
211bytes of memory at address
212.Ar addr .
213.It Ic ls Op Ar directory
214Prints contents of the specified
215.Ar directory
216in long format including: attributes and file type, owner, group,
217size, filename.
218.It Ic machine Op Ar command
219Issues machine-dependent commands.
220These are defined for amd64 architecture:
221.Bl -tag -width diskinfo
222.It Ic boot
223Boots the specified partition boot block in place of the original (MBR) boot
224block:
225.Bd -unfilled -offset indent
226machine boot hd0a
227.Ed
228.Pp
229Where
230.Ar a
231is the first MBR partition table entry, and
232.Ar d
233the last.
234.It Ic comaddr
235Set the I/O base address for the serial port to be used as serial console.
236.It Nm diskinfo
237Prints a list of hard disks installed on your system including:
238BIOS device number, and the BIOS geometry.
239.It Ic gop Op Ar mode
240On
241.Xr efifb 4
242systems,
243sets the video resolution in pixels to
244.Ar mode .
245If
246.Ar mode
247is not given,
248a list of available modes is shown.
249.It Ic idle Op Ar secs
250On
251.Xr efi 4
252systems,
253sets the timeout in seconds to power down the machine,
254if no input has been given at the
255.Xr softraid 4
256passphrase prompt.
257A value of 0 unsets the timeout.
258If
259.Ar secs
260is not given,
261the current timeout is shown.
262.It Ic memory
263If used without any arguments, this command will print out
264the memory configuration as determined through BIOS routines.
265Otherwise the arguments specify how to modify the
266memory configuration.
267They take the form of:
268.Pp
269.D1 =size[KMG]
270.D1 [+-]size@address
271.Pp
272Meaning to add(+), exempt(-) or limit(=) the amount of memory specified by
273.Ar size
274at the location specified by
275.Ar address .
276Both size and base address can be specified as octal,
277decimal, or hexadecimal numbers, as accepted by the
278.Xr strtoul 3
279routine.
280Memory size may be suffixed by K or k, for kilobytes;
281M or m, for megabytes;
282and G or g, for gigabytes.
283.Pp
284The limit(=) option simply ignores any memory above the given
285memory limit.
286This is useful for testing kernels in an artificially
287constrained memory situation.
288For example, the following limits the kernel to using only
289memory below 64MB:
290.Bd -unfilled -offset indent
291machine mem =64M
292.Ed
293.Pp
294Memory segments are not required to be adjacent to each other;
295the only requirement is that there is real physical memory under
296the range added.
297The following example adds 32MB of memory right after the first 16MB:
298.Bd -unfilled -offset indent
299machine mem +0x2000000@0x1000000
300.Ed
301.Pp
302Another useful command is to withdraw a range
303of memory from OS usage (it may have been wrongfully reported as
304useful by the BIOS).
305This example
306effectively excludes the 15\(en16MB range from the map of useful memory:
307.Bd -unfilled -offset indent
308machine mem -0x100000@0xf00000
309.Ed
310.It Ic regs
311Prints contents of processor registers if compiled with
312.Em DEBUG .
313.It Ic video Op Ar mode
314On EFI systems,
315sets the video resolution in columns and rows to
316.Ar mode .
317If
318.Ar mode
319is not given,
320a list of available modes is shown.
321.El
322.It Ic reboot
323Reboots the machine by initiating a warm boot procedure.
324.It Ic set Op Ar varname Op Ar value
325If invoked without arguments, prints a list of variables and their values.
326If only
327.Ar varname
328is specified, displays contents of that variable.
329If
330.Ar varname
331and
332.Ar value
333are both specified, sets that variable to the given value.
334Variables include:
335.Pp
336.Bl -tag -compact -width db_console
337.It Ic db_console
338Boolean (0 or 1) to permit entry into the kernel debugger before the
339.Em ddb.console
340sysctl gets effective.
341.It Ic debug
342Debug flag if
343.Nm
344was compiled with DEBUG defined.
345.It Ic device
346Boot device name (e.g.,
347.Li fd0a ,
348.Li hd0a ) .
349.It Ic howto
350Options to pass to the loaded kernel.
351.It Ic image
352File name containing the kernel image.
353.It Ic timeout
354Number of seconds boot will wait for human intervention before
355booting the default kernel image.
356.It Ic tty
357Active console device name (e.g.,
358.Li com0 ,
359.Li com1 ,
360.Li pc0 ) .
361.El
362.It Ic stty Op Ar device Op Ar speed
363Displays or sets the
364.Ar speed
365for a console
366.Ar device .
367If changing the baudrate for the currently active console,
368.Nm
369offers you five seconds of grace time before committing the change
370to allow you to change your terminal's speed to match.
371If changing speed
372.Em not
373for the active console, the baudrate is set for the
374.Em next
375time you switch to a serial console.
376The baudrate value is not used for the
377.Li pc0
378console.
379.Pp
380The default baudrate is 9600bps.
381.It Ic time
382Displays system time and date.
383.El
384.Sh FILES
385.Bl -tag -width /usr/mdec/biosbootxx -compact
386.It Pa /usr/mdec/biosboot
387first stage bootstrap
388.It Pa /usr/mdec/pxeboot
389PXE bootstrap
390.It Pa /boot
391system bootstrap
392.It Pa /etc/boot.conf
393system bootstrap's startup file
394.It Pa /bsd
395kernel image
396.It Pa /bsd.sp
397kernel image for single processor machines
398.It Pa /bsd.mp
399kernel image for multiprocessor machines
400.It Pa /bsd.rd
401kernel image for installation/recovery
402.El
403.Sh EXAMPLES
404Boot the default kernel:
405.Pp
406.Dl boot> boot
407.Pp
408Remove the 5 second pause at boot-time permanently, causing
409.Nm
410to load the kernel immediately without prompting:
411.Pp
412.Dl # echo \&"boot\&" > /etc/boot.conf
413.Pp
414Use serial console.
415A null modem cable should connect the specified serial port to a terminal.
416Useful for debugging.
417.Pp
418.Dl boot> set tty com0
419.Pp
420Invoke the serial console at every boot:
421.Pp
422.Dl # echo \&"set tty com0\&" > /etc/boot.conf
423.Pp
424Boot the kernel named
425.Pa /bsd
426from the second hard disk in
427.Dq User Kernel Configuration
428mode (see
429.Xr boot_config 8 ) .
430This mechanism allows for the explicit enabling and disabling of devices
431during the current boot sequence, as well as the modification
432of device parameters.
433Once booted, such changes can be made permanent by using
434.Xr config 8 Ns 's
435.Fl e
436option.
437.Pp
438.Dl boot> boot hd1a:/bsd -c
439.Sh SEE ALSO
440.Xr gzip 1 ,
441.Xr autoconf 4 ,
442.Xr ddb 4 ,
443.Xr efi 4 ,
444.Xr softraid 4 ,
445.Xr biosboot 8 ,
446.Xr boot_amd64 8 ,
447.Xr boot_config 8 ,
448.Xr fdisk 8 ,
449.Xr installboot 8 ,
450.Xr pxeboot 8 ,
451.Xr reboot 8
452.Sh HISTORY
453This program was written by Michael Shalayeff for
454.Ox 2.1
455on the i386 platform, and was later ported to the amd64 platform.
456