1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software written and contributed 5.\" to Berkeley by William Jolitz. 6.\" 7.\" Almost completely rewritten for FreeBSD 2.1 by Joerg Wunsch. 8.\" 9.\" Substantially revised for FreeBSD 3.1 by Robert Nordier. 10.\" 11.\" Redistribution and use in source and binary forms, with or without 12.\" modification, are permitted provided that the following conditions 13.\" are met: 14.\" 1. Redistributions of source code must retain the above copyright 15.\" notice, this list of conditions and the following disclaimer. 16.\" 2. Redistributions in binary form must reproduce the above copyright 17.\" notice, this list of conditions and the following disclaimer in the 18.\" documentation and/or other materials provided with the distribution. 19.\" 4. Neither the name of the University nor the names of its contributors 20.\" may be used to endorse or promote products derived from this software 21.\" without specific prior written permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 36.\" 37.\" $FreeBSD$ 38.\" 39.Dd November 14, 2014 40.Dt BOOT 8 i386 41.Os 42.Sh NAME 43.Nm boot 44.Nd system bootstrapping procedures 45.Sh DESCRIPTION 46.Sy Power fail and crash recovery . 47Normally, the system will reboot itself at power-up or after crashes. 48An automatic consistency check of the file systems will be performed, 49and unless this fails, the system will resume multi-user operations. 50.Pp 51.Sy Cold starts . 52Most i386 PCs attempt to boot first from floppy disk drive 0 (sometimes 53known as drive A:) and, failing that, from hard disk drive 0 (sometimes 54known as drive C:, or as drive 0x80 to the BIOS). 55Some BIOSes allow 56you to change this default sequence, and may also include a CD-ROM 57drive as a boot device. 58.Pp 59Some newer PCs boot using UEFI firmware, not BIOS. 60That process is described 61in 62.Xr uefi 8 . 63.Pp 64By default, a three-stage bootstrap is employed, and control is 65automatically passed from the boot blocks (bootstrap stages one and 66two) to a separate third-stage bootstrap program, 67.Xr loader 8 . 68This third stage provides more sophisticated control over the booting 69process than it is possible to achieve in the boot blocks, which are 70constrained by occupying limited fixed space on a given disk or slice. 71.Pp 72However, it is possible to dispense with the third stage altogether, 73either by specifying a kernel name in the boot block parameter 74file, 75.Pa /boot.config , 76or, unless option 77.Fl n 78is set, by hitting a key during a brief pause (while one of the characters 79.Sy - , 80.Sy \e , 81.Sy \&| , 82or 83.Sy / 84is displayed) before 85.Xr loader 8 86is invoked. 87Booting will also be attempted at stage two, if the 88third stage cannot be loaded. 89.Pp 90The remainder of this subsection deals only with the boot blocks. 91The 92.Xr loader 8 93program is documented separately. 94.Pp 95After the boot blocks have been loaded, 96you should see a prompt similar to the following: 97.Bd -literal 98>> FreeBSD/i386 BOOT 99Default: 0:ad(0,a)/boot/loader 100boot: 101.Ed 102.Pp 103The automatic boot will attempt to load 104.Pa /boot/loader 105from partition 106.Ql a 107of either the floppy or the hard disk. 108This boot may be aborted by typing any character on the keyboard 109at the 110.Ql boot: 111prompt. 112At this time, the following input will be accepted: 113.Bl -tag -width indent 114.It Ic \&? 115Give a short listing of the files in the root directory of the default 116boot device, as a hint about available boot files. 117(A 118.Ic ?\& 119may also be specified as the last segment of a path, in which case 120the listing will be of the relevant subdirectory.) 121.It Xo 122.Sm off 123.Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) 124.Ar filename 125.Sm on 126.Op Fl aCcDdghmnPprsv 127.Op Fl S Ns Ar speed 128.Xc 129Specify boot file and flags. 130.Bl -tag -width indent 131.It Ar bios_drive 132The drive number as recognized by the BIOS. 1330 for the first drive, 1 for the second drive, etc. 134.It Ar interface 135The type of controller to boot from. 136Note that the controller is required 137to have BIOS support since the BIOS services are used to load the 138boot file image. 139.Pp 140The supported interfaces are: 141.Pp 142.Bl -tag -width "adXX" -compact 143.It ad 144ST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike 145controller 146.It fd 1475 1/4" or 3 1/2" High density floppies 148.It da 149SCSI disk on any supported SCSI controller 150.\".It cd 151.\"boot from CDROM 152.El 153.It Ar unit 154The unit number of the drive on the interface being used. 1550 for the first drive, 1 for the second drive, etc. 156.It Oo Ar slice , Oc Ns Ar part 157The partition letter inside the 158.Bx 159portion of the disk. 160See 161.Xr bsdlabel 8 . 162By convention, only partition 163.Ql a 164contains a bootable image. 165If sliced disks are used 166.Pq Dq fdisk partitions , 167any 168.Ar slice 169(1 for the first slice, 2 for the second slice, etc.\&) 170can be booted from, with the default (if not specified) being the active slice 171or, otherwise, the first 172.Fx 173slice. 174If 175.Ar slice 176is specified as 0, the first 177.Fx 178slice (also known as 179.Dq compatibility 180slice) is booted from. 181.It Ar filename 182The pathname of the file to boot (relative to the root directory 183on the specified partition). 184Defaults to 185.Pa /boot/kernel/kernel . 186Symbolic links are not supported (hard links are). 187.It Xo Op Fl aCcDdghmnPpqrsv 188.Op Fl S Ns Ar speed 189.Xc 190Boot flags: 191.Pp 192.Bl -tag -width "-CXX" -compact 193.It Fl a 194during kernel initialization, 195ask for the device to mount as the root file system. 196.It Fl C 197try to mount root file system from a CD-ROM. 198.It Fl c 199this flag is currently a no-op. 200.It Fl D 201boot with the dual console configuration. 202In the single 203configuration, the console will be either the internal display 204or the serial port, depending on the state of the 205.Fl h 206option below. 207In the dual console configuration, 208both the internal display and the serial port will become the console 209at the same time, regardless of the state of the 210.Fl h 211option. 212.It Fl d 213enter the DDB kernel debugger 214(see 215.Xr ddb 4 ) 216as early as possible in kernel initialization. 217.It Fl g 218use the GDB remote debugging protocol. 219.It Fl h 220force the serial console. 221For instance, if you boot from the internal console, 222you can use the 223.Fl h 224option to force the kernel to use the serial port as its 225console device. 226The serial port driver 227.Xr sio 4 228(but not 229.Xr uart 4 ) 230has a flag (0x20) to override this option. 231If that flag is set, the serial port will always be used as the console, 232regardless of the 233.Fl h 234option described here. 235.It Fl m 236mute the console to suppress all console input and output during the 237boot. 238.It Fl n 239ignore key press to interrupt boot before 240.Xr loader 8 241is invoked. 242.It Fl P 243probe the keyboard. 244If no keyboard is found, the 245.Fl D 246and 247.Fl h 248options are automatically set. 249.It Fl p 250pause after each attached device during the device probing phase. 251.It Fl q 252be quiet, 253do not write anything to the console unless automatic boot fails or 254is disabled. 255This option only affects second-stage bootstrap, 256to prevent next stages from writing to the console use in 257combination with the 258.Fl m 259option. 260.It Fl r 261use the statically configured default for the device containing the 262root file system 263(see 264.Xr config 8 ) . 265Normally, the root file system is on the device 266that the kernel was loaded from. 267.It Fl s 268boot into single-user mode; if the console is marked as 269.Dq insecure 270(see 271.Xr ttys 5 ) , 272the root password must be entered. 273.It Fl S Ns Ar speed 274set the speed of the serial console to 275.Ar speed . 276The default is 9600 unless it has been overridden by setting 277.Va BOOT_COMCONSOLE_SPEED 278in 279.Xr make.conf 5 280and recompiling and reinstalling the boot blocks. 281.It Fl v 282be verbose during device probing (and later). 283.El 284.El 285.El 286.Pp 287Use the 288.Pa /boot.config 289file to set the default configuration options for the boot block code. 290See 291.Xr boot.config 5 292for more information about the 293.Pa /boot.config 294file. 295.Sh FILES 296.Bl -tag -width /boot/loader -compact 297.It Pa /boot.config 298parameters for the boot blocks (optional) 299.It Pa /boot/boot1 300first stage bootstrap file 301.It Pa /boot/boot2 302second stage bootstrap file 303.It Pa /boot/loader 304third stage bootstrap 305.It Pa /boot/kernel/kernel 306default kernel 307.It Pa /boot/kernel.old/kernel 308typical non-default kernel (optional) 309.El 310.Sh DIAGNOSTICS 311When disk-related errors occur, these are reported by the second-stage 312bootstrap using the same error codes returned by the BIOS, for example 313.Dq Disk error 0x1 (lba=0x12345678) . 314Here is a partial list of these error codes: 315.Pp 316.Bl -tag -width "0x80" -compact 317.It 0x1 318Invalid argument 319.It 0x2 320Address mark not found 321.It 0x4 322Sector not found 323.It 0x8 324DMA overrun 325.It 0x9 326DMA attempt across 64K boundary 327.It 0xc 328Invalid media 329.It 0x10 330Uncorrectable CRC/ECC error 331.It 0x20 332Controller failure 333.It 0x40 334Seek failed 335.It 0x80 336Timeout 337.El 338.Pp 339.Sy "NOTE" : 340On older machines, or otherwise where EDD support (disk packet 341interface support) is not available, all boot-related files and 342structures (including the kernel) that need to be accessed during the 343boot phase must reside on the disk at or below cylinder 1023 (as the 344BIOS understands the geometry). 345When a 346.Dq Disk error 0x1 347is reported by the second-stage bootstrap, it generally means that this 348requirement has not been adhered to. 349.Sh SEE ALSO 350.Xr ddb 4 , 351.Xr boot.config 5 , 352.Xr make.conf 5 , 353.Xr ttys 5 , 354.Xr boot0cfg 8 , 355.Xr btxld 8 , 356.Xr config 8 , 357.Xr gpart 8 , 358.Xr gptboot 8 , 359.Xr halt 8 , 360.Xr loader 8 , 361.Xr nextboot 8 , 362.Xr reboot 8 , 363.Xr shutdown 8 , 364.Xr uefi 8 365.Sh BUGS 366The bsdlabel format used by this version of 367.Bx 368is quite 369different from that of other architectures. 370.Pp 371Due to space constraints, the keyboard probe initiated by the 372.Fl P 373option is simply a test that the BIOS has detected an 374.Dq extended 375keyboard. 376If an 377.Dq XT/AT 378keyboard (with no F11 and F12 keys, etc.) is attached, the probe will 379fail. 380