xref: /openbsd-src/sys/arch/amd64/stand/boot/boot.8 (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1.\"	$OpenBSD: boot.8,v 1.26 2015/11/23 18:38:37 mmcc 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 23 2015 $
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.Nm 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 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 echo Op Ar args
201Displays
202.Ar args
203on the console device.
204.It help
205Prints a list of available commands and machine dependent
206commands, if any.
207.It machine Op Ar command
208Issues machine-dependent commands.
209These are defined for amd64 architecture:
210.Bl -tag -width diskinfo
211.It Nm boot
212Boots the specified partition boot block in place of the original (MBR) boot
213block:
214.Bd -unfilled -offset indent
215machine boot hd0a
216.Ed
217.Pp
218Where
219.Ar a
220is the first MBR partition table entry, and
221.Ar d
222the last.
223.It Nm comaddr
224Set the I/O base address for the serial port to be used as serial console.
225.It Nm diskinfo
226Prints a list of hard disks installed on your system including:
227BIOS device number, and the BIOS geometry.
228.It Nm memory
229If used without any arguments, this command will print out
230the memory configuration as determined through BIOS routines.
231Otherwise the arguments specify how to modify the
232memory configuration.
233They take the form of:
234.Pp
235.D1 =size[KMG]
236.D1 [+-]size@address
237.Pp
238Meaning to add(+), exempt(-) or limit(=) the amount of memory specified by
239.Ar size
240at the location specified by
241.Ar address .
242Both size and base address can be specified as octal,
243decimal, or hexadecimal numbers, as accepted by the
244.Xr strtoul 3
245routine.
246Memory size may be suffixed by K or k, for kilobytes;
247M or m, for megabytes;
248and G or g, for gigabytes.
249.Pp
250The limit(=) option simply ignores any memory above the given
251memory limit.
252This is useful for testing kernels in an artificially
253constrained memory situation.
254For example, the following limits the kernel to using only
255memory below 64MB:
256.Bd -unfilled -offset indent
257machine mem =64M
258.Ed
259.Pp
260Memory segments are not required to be adjacent to each other;
261the only requirement is that there is real physical memory under
262the range added.
263The following example adds 32MB of memory right after the first 16MB:
264.Bd -unfilled -offset indent
265machine mem +0x2000000@0x1000000
266.Ed
267.Pp
268Another useful command is to withdraw a range
269of memory from OS usage (it may have been wrongfully reported as
270useful by the BIOS).
271This example
272effectively excludes the 15\(en16MB range from the map of useful memory:
273.Bd -unfilled -offset indent
274machine mem -0x100000@0xf00000
275.Ed
276.It Nm regs
277Prints contents of processor registers if compiled with
278.Em DEBUG .
279.El
280.It ls Op Ar directory
281Prints contents of the specified
282.Ar directory
283in long format including: attributes and file type, owner, group,
284size, filename.
285.It reboot
286Reboots the machine by initiating a warm boot procedure.
287.It set Op Ar varname Op Ar value
288If invoked without arguments, prints a list of variables and their values.
289If only
290.Ar varname
291is specified, displays contents of that variable.
292If
293.Ar varname
294and
295.Ar value
296are both specified, sets that variable to the given value.
297Variables include:
298.Pp
299.Bl -tag -compact -width boothow
300.It Nm addr
301Address at which to load the kernel.
302.It Nm debug
303Debug flag if
304.Nm
305was compiled with DEBUG defined.
306.It Nm device
307Boot device name (e.g.,
308.Li fd0a ,
309.Li hd0a ) .
310.It Nm howto
311Options to pass to the loaded kernel.
312.It Nm image
313File name containing the kernel image.
314.It Nm timeout
315Number of seconds boot will wait for human intervention before
316booting the default kernel image.
317.It Nm tty
318Active console device name (e.g.,
319.Li com0 ,
320.Li com1 ,
321.Li pc0 ) .
322.El
323.It stty Op Ar device Op Ar speed
324Displays or sets the
325.Ar speed
326for a console
327.Ar device .
328If changing the baudrate for the currently active console,
329.Nm
330offers you five seconds of grace time before committing the change
331to allow you to change your terminal's speed to match.
332If changing speed
333.Em not
334for the active console, the baudrate is set for the
335.Em next
336time you switch to a serial console.
337The baudrate value is not used for the
338.Li pc0
339console.
340.Pp
341The default baudrate is 9600bps.
342.It time
343Displays system time and date.
344.El
345.Sh FILES
346.Bl -tag -width /usr/mdec/biosbootxx -compact
347.It Pa /usr/mdec/biosboot
348first stage bootstrap
349.It Pa /usr/mdec/pxeboot
350PXE bootstrap
351.It Pa /boot
352system bootstrap
353.It Pa /etc/boot.conf
354system bootstrap's startup file
355.It Pa /bsd
356kernel image
357.It Pa /bsd.sp
358kernel image for single processor machines
359.It Pa /bsd.mp
360kernel image for multiprocessor machines
361.It Pa /bsd.rd
362kernel image for installation/recovery
363.El
364.Sh EXAMPLES
365Boot the default kernel:
366.Pp
367.Dl boot> boot
368.Pp
369Remove the 5 second pause at boot-time permanently, causing
370.Nm
371to load the kernel immediately without prompting:
372.Pp
373.Dl # echo \&"boot\&" > /etc/boot.conf
374.Pp
375Use serial console.
376A null modem cable should connect the specified serial port to a terminal.
377Useful for debugging.
378.Pp
379.Dl boot> set tty com0
380.Pp
381Invoke the serial console at every boot:
382.Pp
383.Dl # echo \&"set tty com0\&" > /etc/boot.conf
384.Pp
385Boot the kernel named
386.Pa /bsd
387from the second hard disk in
388.Dq User Kernel Configuration
389mode (see
390.Xr boot_config 8 ) .
391This mechanism allows for the explicit enabling and disabling of devices
392during the current boot sequence, as well as the modification
393of device parameters.
394Once booted, such changes can be made permanent by using
395.Xr config 8 Ns 's
396.Fl e
397option.
398.Pp
399.Dl boot> boot hd1a:/bsd -c
400.Sh SEE ALSO
401.Xr gzip 1 ,
402.Xr autoconf 4 ,
403.Xr ddb 4 ,
404.Xr softraid 4 ,
405.Xr biosboot 8 ,
406.Xr boot_amd64 8 ,
407.Xr boot_config 8 ,
408.Xr fdisk 8 ,
409.Xr installboot 8 ,
410.Xr pxeboot 8 ,
411.Xr reboot 8
412.Sh HISTORY
413This program was written by Michael Shalayeff for
414.Ox 2.1
415on the i386 platform, and was later ported to the amd64 platform.
416