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