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