1.\" $OpenBSD: boot.8,v 1.54 2012/08/15 19:02:01 jmc 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: August 15 2012 $ 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.Sh COMMANDS 142The following commands are accepted at the 143.Nm 144prompt: 145.Bl -tag -width shorten 146.It boot Op Ar image Op Fl acds 147Boots the kernel image specified by 148.Ar image 149with any options given. 150Image specification consists of a pair 151.Ar device : Ns Ar filename ; 152either or both can be omitted (`:' is not needed if both are omitted), 153in which case values from 154.Nm 155variables will be used. 156.Pp 157When selecting the 158.Ar device 159to boot from, 160.Nm 161makes no distinction between SCSI and IDE type drives; 162they are detected as 163.Sq hd 164devices. 165Therefore, to boot kernel 166.Pa /bsd 167from slice 168.Sq a 169on the first hard drive 170.Pq irrespective of device type , 171specify 172.Dq boot hd0a:/bsd . 173.Bl -tag -width _a_ 174.It Fl a 175Causes the kernel to ask for the 176.Nm root 177device to use. 178.It Fl c 179Causes the kernel to go into 180.Xr boot_config 8 181before performing 182.Xr autoconf 4 183procedures. 184.It Fl d 185Causes the kernel to drop into 186.Xr ddb 4 187at the earliest convenient point. 188.It Fl s 189Causes the kernel to boot single-user. 190.El 191.It echo Op Ar args 192Displays 193.Ar args 194on the console device. 195.It help 196Prints a list of available commands and machine dependent 197commands, if any. 198.It machine Op Ar command 199Issues machine-dependent commands. 200These are defined for i386 architecture: 201.Bl -tag -width diskinfo 202.It Nm comaddr 203Set the I/O base address for the serial port to be used as serial console. 204.It Nm diskinfo 205Prints a list of hard disks installed on your system including: 206BIOS device number, and the BIOS geometry. 207.It Nm memory 208If used without any arguments, this command will print out 209the memory configuration as determined through BIOS routines. 210Otherwise the arguments specify how to modify the 211memory configuration. 212They take the form of: 213.Pp 214.Dl =<size>[KMG] 215.Dl [+-]<size>@<address> 216.Pp 217Meaning to add(+), exempt(-) or limit(=) the amount of memory specified by 218.Ar <size> 219at the location specified by 220.Ar <address> . 221Both size and base address can be specified as octal, 222decimal, or hexadecimal numbers, as accepted by the 223.Xr strtoul 3 224routine. 225.Pp 226The limit(=) option simply ignores any memory above the given 227memory limit. 228This is useful for testing kernels in an artificially 229constrained memory situation. 230For example, the following limits the kernel to using only 231memory below 64M: 232.Bd -unfilled -offset indent 233machine mem =64M 234.Ed 235.Pp 236Memory segments are not required to be adjacent to each other; 237the only requirement is that there is real physical memory under 238the range added. 239The following example adds 32M of memory right after the first 16M: 240.Bd -unfilled -offset indent 241machine mem +0x2000000@0x1000000 242.Ed 243.Pp 244Another useful command is to withdraw a range 245of memory from OS usage (it may have been wrongfully reported as 246useful by the BIOS). 247This example 248effectively excludes the 15\(en16M range from the map of useful memory: 249.Bd -unfilled -offset indent 250machine mem -0x100000@0xf00000 251.Ed 252.It Nm regs 253Prints contents of processor registers if compiled with 254.Em DEBUG . 255.El 256.It ls Op Ar directory 257Prints contents of the specified 258.Ar directory 259in long format including: attributes and file type, owner, group, 260size, filename. 261.It reboot 262Reboots the machine by initiating a warm boot procedure. 263.It set Op Ar varname Op Ar value 264If invoked without arguments, prints a list of variables and their values. 265If only 266.Ar varname 267is specified, displays contents of that variable. 268If 269.Ar varname 270and 271.Ar value 272are both specified, sets that variable to the given value. 273Variables include: 274.Pp 275.Bl -tag -compact -width boothow 276.It Nm addr 277Address at which to load the kernel. 278.It Nm debug 279Debug flag if 280.Nm 281was compiled with DEBUG defined. 282.It Nm device 283Boot device name (e.g., 284.Li fd0a , 285.Li hd0a ) . 286.It Nm howto 287Options to pass to the loaded kernel. 288.It Nm image 289File name containing the kernel image. 290.It Nm timeout 291Number of seconds boot will wait for human intervention before 292booting the default kernel image. 293.It Nm tty 294Active console device name (e.g., 295.Li com0 , 296.Li com1 , 297.Li pc0 ) . 298.El 299.It stty Op Ar device Op Ar speed 300Displays or sets the 301.Ar speed 302for a console 303.Ar device . 304If changing the baudrate for the currently active console, 305.Nm 306offers you five seconds of grace time before committing the change 307to allow you to change your terminal's speed to match. 308If changing speed 309.Em not 310for the active console, the baudrate is set for the 311.Em next 312time you switch to a serial console. 313The baudrate value is not used for the 314.Li pc0 315console. 316.Pp 317The default baudrate is 9600bps. 318.It time 319Displays system time and date. 320.El 321.Sh FILES 322.Bl -tag -width /usr/mdec/biosbootxx -compact 323.It Pa /usr/mdec/biosboot 324first stage bootstrap 325.It Pa /usr/mdec/pxeboot 326PXE bootstrap 327.It Pa /boot 328system bootstrap 329.It Pa /etc/boot.conf 330system bootstrap's startup file 331.It Pa /bsd 332kernel image 333.It Pa /bsd.sp 334kernel image for single processor machines 335.It Pa /bsd.mp 336kernel image for multiprocessor machines 337.It Pa /bsd.rd 338kernel image for installation/recovery 339.El 340.Sh EXAMPLES 341Boot the default kernel: 342.Pp 343.Dl boot> boot 344.Pp 345Remove the 5 second pause at boot-time permanently, causing 346.Nm 347to load the kernel immediately without prompting: 348.Pp 349.Dl # echo \&"boot\&" > /etc/boot.conf 350.Pp 351Use serial console. 352A null modem cable should connect the specified serial port to a terminal. 353Useful for debugging. 354.Pp 355.Dl boot> set tty com0 356.Pp 357Invoke the serial console at every boot: 358.Pp 359.Dl # echo \&"set tty com0\&" > /etc/boot.conf 360.Pp 361Boot the kernel named 362.Pa /bsd 363from the second hard disk in 364.Dq User Kernel Configuration 365mode (see 366.Xr boot_config 8 ) . 367This mechanism allows for the explicit enabling and disabling of devices 368during the current boot sequence, as well as the modification 369of device parameters. 370Once booted, such changes can be made permanent by using 371.Xr config 8 Ns 's 372.Fl e 373option. 374.Pp 375.Dl boot> boot hd1a:/bsd -c 376.Sh SEE ALSO 377.Xr gzip 1 , 378.Xr autoconf 4 , 379.Xr ddb 4 , 380.Xr biosboot 8 , 381.Xr boot_config 8 , 382.Xr boot_i386 8 , 383.Xr fdisk 8 , 384.Xr installboot 8 , 385.Xr pxeboot 8 , 386.Xr reboot 8 387.Pp 388RFC 1950 describes the zlib library interface. 389.Pp 390The official home page for the version of zlib used in this 391operating system is at 392.Lk http://www.gzip.org/zlib/ . 393.Sh HISTORY 394This program was written by Michael Shalayeff for 395.Ox 2.1 . 396