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.\" 3. 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.Dd July 11, 2020 36.Dt BOOT 8 i386 37.Os 38.Sh NAME 39.Nm boot 40.Nd system bootstrapping procedures 41.Sh DESCRIPTION 42.Sy Power fail and crash recovery . 43Normally, the system will reboot itself at power-up or after crashes. 44An automatic consistency check of the file systems will be performed, 45and unless this fails, the system will resume multi-user operations. 46.Pp 47.Sy Cold starts . 48Most i386 PCs attempt to boot first from floppy disk drive 0 (sometimes 49known as drive A:) and, failing that, from hard disk drive 0 (sometimes 50known as drive C:, or as drive 0x80 to the BIOS). 51Some BIOSes allow 52you to change this default sequence, and may also include a CD-ROM 53drive as a boot device. 54.Pp 55Some newer PCs boot using UEFI firmware, not BIOS. 56That process is described 57in 58.Xr uefi 8 . 59.Pp 60A three-stage bootstrap is employed. 61Control is passed from the boot blocks (bootstrap stages one and two) to a 62third-stage bootstrap program, 63.Xr loader 8 . 64This third stage provides more sophisticated control over the booting 65process than it is possible to achieve in the boot blocks, which are 66constrained by occupying limited fixed space on a given disk or slice. 67.Pp 68The remainder of this subsection deals only with the boot blocks. 69The 70.Xr loader 8 71program is documented separately. 72.Pp 73After the boot blocks have been loaded, 74you should see a prompt similar to the following: 75.Bd -literal 76>> FreeBSD/x86 BOOT 77Default: 0:ad(0,a)/boot/loader 78boot: 79.Ed 80.Pp 81The automatic boot will attempt to load 82.Pa /boot/loader 83from partition 84.Ql a 85of either the floppy or the hard disk. 86This boot may be aborted by typing any character on the keyboard 87at the 88.Ql boot\&: 89prompt. 90At this time, the following input will be accepted: 91.Bl -tag -width indent 92.It Ic \&? 93Give a short listing of the files in the root directory of the default 94boot device, as a hint about available boot files. 95(A 96.Ic ?\& 97may also be specified as the last segment of a path, in which case 98the listing will be of the relevant subdirectory.) 99.It Xo 100.Sm off 101.Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) 102.Ar filename 103.Sm on 104.Op Fl aCcDdghmnPprsv 105.Op Fl S Ns Ar speed 106.Xc 107Specify boot file and flags. 108.Bl -tag -width indent 109.It Ar bios_drive 110The drive number as recognized by the BIOS. 1110 for the first drive, 1 for the second drive, etc. 112.It Ar interface 113The type of controller to boot from. 114Note that the controller is required 115to have BIOS support since the BIOS services are used to load the 116boot file image. 117.Pp 118The supported interfaces are: 119.Pp 120.Bl -tag -width "adXX" -compact 121.It ad 122ST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike 123controller 124.It fd 1255 1/4" or 3 1/2" High density floppies 126.It da 127SCSI disk on any supported SCSI controller 128.\".It cd 129.\"boot from CDROM 130.El 131.It Ar unit 132The unit number of the drive on the interface being used. 1330 for the first drive, 1 for the second drive, etc. 134.It Oo Ar slice , Oc Ns Ar part 135The partition letter inside the 136.Bx 137portion of the disk. 138See 139.Xr bsdlabel 8 . 140By convention, only partition 141.Ql a 142contains a bootable image. 143If sliced disks are used 144.Pq Dq fdisk partitions , 145any 146.Ar slice 147(1 for the first slice, 2 for the second slice, etc.\&) 148can be booted from, with the default (if not specified) being the active slice 149or, otherwise, the first 150.Fx 151slice. 152If 153.Ar slice 154is specified as 0, the first 155.Fx 156slice (also known as 157.Dq compatibility 158slice) is booted from. 159.It Ar filename 160The pathname of the file to boot (relative to the root directory 161on the specified partition). 162Defaults to 163.Pa /boot/kernel/kernel . 164Symbolic links are not supported (hard links are). 165.It Xo Op Fl aCcDdghmnPpqrsv 166.Op Fl S Ns Ar speed 167.Xc 168Boot flags: 169.Pp 170.Bl -tag -width "-CXX" -compact 171.It Fl a 172during kernel initialization, 173ask for the device to mount as the root file system. 174.It Fl C 175try to mount root file system from a CD-ROM. 176.It Fl c 177this flag is currently a no-op. 178.It Fl D 179boot with the dual console configuration. 180In the single 181configuration, the console will be either the internal display 182or the serial port, depending on the state of the 183.Fl h 184option below. 185In the dual console configuration, 186both the internal display and the serial port will become the console 187at the same time, regardless of the state of the 188.Fl h 189option. 190.It Fl d 191enter the DDB kernel debugger 192(see 193.Xr ddb 4 ) 194as early as possible in kernel initialization. 195.It Fl g 196use the GDB remote debugging protocol. 197.It Fl h 198force the serial console. 199For instance, if you boot from the internal console, 200you can use the 201.Fl h 202option to force the kernel to use the serial port as its 203console device. 204.It Fl m 205mute the console to suppress all kernel console input and output during the 206boot. 207.It Fl n 208ignore key press to interrupt boot before 209.Xr loader 8 210is invoked. 211.It Fl P 212probe the keyboard. 213If no keyboard is found, the 214.Fl D 215and 216.Fl h 217options are automatically set. 218.It Fl p 219pause after each attached device during the device probing phase. 220.It Fl q 221be quiet, 222do not write anything to the console unless automatic boot fails or 223is disabled. 224This option only affects second-stage bootstrap, 225to prevent next stages from writing to the console use in 226combination with the 227.Fl m 228option. 229.It Fl r 230use the statically configured default for the device containing the 231root file system 232(see 233.Xr config 8 ) . 234Normally, the root file system is on the device 235that the kernel was loaded from. 236.It Fl s 237boot into single-user mode; if the console is marked as 238.Dq insecure 239(see 240.Xr ttys 5 ) , 241the root password must be entered. 242.It Fl S Ns Ar speed 243set the speed of the serial console to 244.Ar speed . 245The default is 115200 unless it has been overridden by setting 246.Va BOOT_COMCONSOLE_SPEED 247in 248.Xr make.conf 5 249and recompiling and reinstalling the boot blocks. 250.It Fl v 251be verbose during device probing (and later). 252.El 253.El 254.El 255.Pp 256Use the 257.Pa /boot.config 258file to set the default configuration options for the boot block code. 259See 260.Xr boot.config 5 261for more information about the 262.Pa /boot.config 263file. 264.Sh FILES 265.Bl -tag -width /boot/loader -compact 266.It Pa /boot.config 267parameters for the boot blocks (optional) 268.It Pa /boot/boot1 269first stage bootstrap file 270.It Pa /boot/boot2 271second stage bootstrap file 272.It Pa /boot/loader 273third stage bootstrap 274.It Pa /boot/kernel/kernel 275default kernel 276.It Pa /boot/kernel.old/kernel 277typical non-default kernel (optional) 278.El 279.Sh DIAGNOSTICS 280When disk-related errors occur, these are reported by the second-stage 281bootstrap using the same error codes returned by the BIOS, for example 282.Dq Disk error 0x1 (lba=0x12345678) . 283Here is a partial list of these error codes: 284.Pp 285.Bl -tag -width "0x80" -compact 286.It 0x1 287Invalid argument 288.It 0x2 289Address mark not found 290.It 0x4 291Sector not found 292.It 0x8 293DMA overrun 294.It 0x9 295DMA attempt across 64K boundary 296.It 0xc 297Invalid media 298.It 0x10 299Uncorrectable CRC/ECC error 300.It 0x20 301Controller failure 302.It 0x40 303Seek failed 304.It 0x80 305Timeout 306.El 307.Pp 308.Sy "NOTE" : 309On older machines, or otherwise where EDD support (disk packet 310interface support) is not available, all boot-related files and 311structures (including the kernel) that need to be accessed during the 312boot phase must reside on the disk at or below cylinder 1023 (as the 313BIOS understands the geometry). 314When a 315.Dq Disk error 0x1 316is reported by the second-stage bootstrap, it generally means that this 317requirement has not been adhered to. 318.Sh SEE ALSO 319.Xr ddb 4 , 320.Xr boot.config 5 , 321.Xr make.conf 5 , 322.Xr mount.conf 5 , 323.Xr ttys 5 , 324.Xr boot0cfg 8 , 325.Xr btxld 8 , 326.Xr config 8 , 327.Xr efibootmgr 8 , 328.Xr efivar 8 , 329.Xr gpart 8 , 330.Xr gptboot 8 , 331.Xr gptzfsboot 8 , 332.Xr halt 8 , 333.Xr loader 8 , 334.Xr nextboot 8 , 335.Xr reboot 8 , 336.Xr shutdown 8 , 337.Xr uefi 8 , 338.Xr zfsbootcfg 8 339.Sh BUGS 340The bsdlabel format used by this version of 341.Bx 342is quite 343different from that of other architectures. 344.Pp 345Due to space constraints, the keyboard probe initiated by the 346.Fl P 347option is simply a test that the BIOS has detected an 348.Dq extended 349keyboard. 350If an 351.Dq XT/AT 352keyboard (with no F11 and F12 keys, etc.) is attached, the probe will 353fail. 354