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