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