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