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