1.\" $OpenBSD: boot.8,v 1.60 2015/01/24 20:47:19 naddy 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: January 24 2015 $ 29.Dt BOOT 8 i386 30.Os 31.Sh NAME 32.Nm boot , 33.Nm boot.conf 34.Nd 35i386-specific second-stage bootstrap 36.Sh DESCRIPTION 37The main purpose of this program is to load the system kernel while dealing 38with the downfalls of the PC BIOS architecture. 39.Pp 40As described in 41.Xr boot_i386 8 , 42this program is loaded by the 43.Xr biosboot 8 44primary bootstrap loader and provides a convenient way to load the kernel. 45This program acts as an enhanced boot monitor for PC systems, providing 46a common interface for the kernel to start from. 47.Pp 48Basic operations include: 49.Pp 50.Bl -bullet -compact 51.It 52Detecting and switching between multiple consoles. 53.It 54Loading kernels from any device supported by your system BIOS. 55.It 56Loading kernels compressed by 57.Xr gzip 1 . 58.It 59Passing system parameters queried from the BIOS to the kernel. 60.It 61Providing an interactive command line. 62.El 63.Pp 64The sequence of its operation is as follows: initialization, 65parsing the configuration file, then an interactive command line. 66While at the command line you have 5 seconds to type any commands, if needed. 67If time expires, the kernel will be loaded according to 68the current variable settings (see the 69.Nm set 70command). 71Each time a kernel load fails, the timeout is increased by 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. 105This file may contain any commands 106.Nm 107accepts at the interactive prompt. 108Though default settings usually suffice, they can be changed here. 109.Pp 110.Pa boot.conf 111processing can be skipped, and the automatic boot cancelled, by holding 112down either Control key as 113.Nm 114starts. 115.It 116The header line 117.Pp 118.Dl >> OpenBSD/i386 BOOT [x.xx] 119.Pp 120is displayed to the active console, where 121.Ar x.xx 122is the version number of the 123.Nm 124program, followed by the 125.Pp 126.Dl boot> 127.Pp 128prompt, which means you are in interactive mode and may enter commands. 129If you do not, 130.Nm 131will proceed to load the kernel with the current parameters after the 132timeout period has expired. 133.El 134.Pp 135By default, 136.Nm 137attempts to load the kernel executable 138.Pa /bsd . 139If it fails to find the kernel and no alternative kernel image has 140been specified, the system will be unable to boot. 141.Pp 142.Nm 143supports booting from 144.Xr softraid 4 145RAID 1 and CRYPTO volumes. 146.Sh COMMANDS 147The following commands are accepted at the 148.Nm 149prompt: 150.Bl -tag -width shorten 151.It boot Oo Oo Ar device : Oc Ns Ar image Oc Op Fl acds 152Boots the specified kernel image 153with any options given. 154If 155.Ar device 156or 157.Ar image 158are omitted, values from 159.Nm 160variables will be used. 161.Pp 162When selecting the 163.Ar device 164to boot from, 165.Nm 166makes no distinction between SCSI and IDE type drives; 167they are detected as 168.Sq hd 169devices. 170Therefore, to boot kernel 171.Pa /bsd 172from slice 173.Sq a 174on the first hard drive 175.Pq irrespective of device type , 176specify 177.Dq boot hd0a:/bsd . 178.Bl -tag -width _a_ 179.It Fl a 180Causes the kernel to ask for the 181.Nm root 182device to use. 183.It Fl c 184Causes the kernel to go into 185.Xr boot_config 8 186before performing 187.Xr autoconf 4 188procedures. 189.It Fl d 190Causes the kernel to drop into 191.Xr ddb 4 192at the earliest convenient point. 193.It Fl s 194Causes the kernel to boot single-user. 195.El 196.It echo Op Ar args 197Displays 198.Ar args 199on the console device. 200.It help 201Prints a list of available commands and machine dependent 202commands, if any. 203.It machine Op Ar command 204Issues machine-dependent commands. 205These are defined for i386 architecture: 206.Bl -tag -width diskinfo 207.It Nm boot 208Boots the specified partition boot block in place of the original (MBR) boot 209block: 210.Bd -unfilled -offset indent 211machine boot hd0a 212.Ed 213.Pp 214Where 215.Ar a 216is the first MBR partition table entry, and 217.Ar d 218the last. 219.It Nm comaddr 220Set the I/O base address for the serial port to be used as serial console. 221.It Nm diskinfo 222Prints a list of hard disks installed on your system including: 223BIOS device number, and the BIOS geometry. 224.It Nm memory 225If used without any arguments, this command will print out 226the memory configuration as determined through BIOS routines. 227Otherwise the arguments specify how to modify the 228memory configuration. 229They take the form of: 230.Pp 231.D1 =size[KMG] 232.D1 [+-]size@address 233.Pp 234Meaning to add(+), exempt(-) or limit(=) the amount of memory specified by 235.Ar size 236at the location specified by 237.Ar address . 238Both size and base address can be specified as octal, 239decimal, or hexadecimal numbers, as accepted by the 240.Xr strtoul 3 241routine. 242Memory size may be suffixed by K or k, for kilobytes; 243M or m, for megabytes; 244and G or g, for gigabytes. 245.Pp 246The limit(=) option simply ignores any memory above the given 247memory limit. 248This is useful for testing kernels in an artificially 249constrained memory situation. 250For example, the following limits the kernel to using only 251memory below 64MB: 252.Bd -unfilled -offset indent 253machine mem =64M 254.Ed 255.Pp 256Memory segments are not required to be adjacent to each other; 257the only requirement is that there is real physical memory under 258the range added. 259The following example adds 32MB of memory right after the first 16MB: 260.Bd -unfilled -offset indent 261machine mem +0x2000000@0x1000000 262.Ed 263.Pp 264Another useful command is to withdraw a range 265of memory from OS usage (it may have been wrongfully reported as 266useful by the BIOS). 267This example 268effectively excludes the 15\(en16MB range from the map of useful memory: 269.Bd -unfilled -offset indent 270machine mem -0x100000@0xf00000 271.Ed 272.It Nm regs 273Prints contents of processor registers if compiled with 274.Em DEBUG . 275.El 276.It ls Op Ar directory 277Prints contents of the specified 278.Ar directory 279in long format including: attributes and file type, owner, group, 280size, filename. 281.It reboot 282Reboots the machine by initiating a warm boot procedure. 283.It set Op Ar varname Op Ar value 284If invoked without arguments, prints a list of variables and their values. 285If only 286.Ar varname 287is specified, displays contents of that variable. 288If 289.Ar varname 290and 291.Ar value 292are both specified, sets that variable to the given value. 293Variables include: 294.Pp 295.Bl -tag -compact -width boothow 296.It Nm addr 297Address at which to load the kernel. 298.It Nm debug 299Debug flag if 300.Nm 301was compiled with DEBUG defined. 302.It Nm device 303Boot device name (e.g., 304.Li fd0a , 305.Li hd0a ) . 306.It Nm howto 307Options to pass to the loaded kernel. 308.It Nm image 309File name containing the kernel image. 310.It Nm timeout 311Number of seconds boot will wait for human intervention before 312booting the default kernel image. 313.It Nm tty 314Active console device name (e.g., 315.Li com0 , 316.Li com1 , 317.Li pc0 ) . 318.El 319.It stty Op Ar device Op Ar speed 320Displays or sets the 321.Ar speed 322for a console 323.Ar device . 324If changing the baudrate for the currently active console, 325.Nm 326offers you five seconds of grace time before committing the change 327to allow you to change your terminal's speed to match. 328If changing speed 329.Em not 330for the active console, the baudrate is set for the 331.Em next 332time you switch to a serial console. 333The baudrate value is not used for the 334.Li pc0 335console. 336.Pp 337The default baudrate is 9600bps. 338.It time 339Displays system time and date. 340.El 341.Sh FILES 342.Bl -tag -width /usr/mdec/biosbootxx -compact 343.It Pa /usr/mdec/biosboot 344first stage bootstrap 345.It Pa /usr/mdec/pxeboot 346PXE bootstrap 347.It Pa /boot 348system bootstrap 349.It Pa /etc/boot.conf 350system bootstrap's startup file 351.It Pa /bsd 352kernel image 353.It Pa /bsd.sp 354kernel image for single processor machines 355.It Pa /bsd.mp 356kernel image for multiprocessor machines 357.It Pa /bsd.rd 358kernel image for installation/recovery 359.El 360.Sh EXAMPLES 361Boot the default kernel: 362.Pp 363.Dl boot> boot 364.Pp 365Remove the 5 second pause at boot-time permanently, causing 366.Nm 367to load the kernel immediately without prompting: 368.Pp 369.Dl # echo \&"boot\&" > /etc/boot.conf 370.Pp 371Use serial console. 372A null modem cable should connect the specified serial port to a terminal. 373Useful for debugging. 374.Pp 375.Dl boot> set tty com0 376.Pp 377Invoke the serial console at every boot: 378.Pp 379.Dl # echo \&"set tty com0\&" > /etc/boot.conf 380.Pp 381Boot the kernel named 382.Pa /bsd 383from the second hard disk in 384.Dq User Kernel Configuration 385mode (see 386.Xr boot_config 8 ) . 387This mechanism allows for the explicit enabling and disabling of devices 388during the current boot sequence, as well as the modification 389of device parameters. 390Once booted, such changes can be made permanent by using 391.Xr config 8 Ns 's 392.Fl e 393option. 394.Pp 395.Dl boot> boot hd1a:/bsd -c 396.Sh SEE ALSO 397.Xr gzip 1 , 398.Xr autoconf 4 , 399.Xr ddb 4 , 400.Xr softraid 4 , 401.Xr biosboot 8 , 402.Xr boot_config 8 , 403.Xr boot_i386 8 , 404.Xr fdisk 8 , 405.Xr installboot 8 , 406.Xr pxeboot 8 , 407.Xr reboot 8 408.Sh HISTORY 409This program was written by Michael Shalayeff for 410.Ox 2.1 . 411