18fae3551SRodney W. Grimes.\" Copyright (c) 1991, 1993 28fae3551SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 38fae3551SRodney W. Grimes.\" 48fae3551SRodney W. Grimes.\" This code is derived from software written and contributed 58fae3551SRodney W. Grimes.\" to Berkeley by William Jolitz. 68fae3551SRodney W. Grimes.\" 7d16b647eSJoerg Wunsch.\" Almost completely rewritten for FreeBSD 2.1 by Joerg Wunsch. 8d16b647eSJoerg Wunsch.\" 9e5da9b6bSRobert Nordier.\" Substantially revised for FreeBSD 3.1 by Robert Nordier. 10e5da9b6bSRobert Nordier.\" 118fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 128fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions 138fae3551SRodney W. Grimes.\" are met: 148fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 158fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 168fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 178fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 188fae3551SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 19fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 208fae3551SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 218fae3551SRodney W. Grimes.\" without specific prior written permission. 228fae3551SRodney W. Grimes.\" 238fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 248fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 258fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 268fae3551SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 278fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 288fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 298fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 308fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 318fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 328fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 338fae3551SRodney W. Grimes.\" SUCH DAMAGE. 348fae3551SRodney W. Grimes.\" 358fae3551SRodney W. Grimes.\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 368fae3551SRodney W. Grimes.\" 374f9917f5SAllan Jude.Dd July 11, 2020 388fae3551SRodney W. Grimes.Dt BOOT 8 i386 398fae3551SRodney W. Grimes.Os 408fae3551SRodney W. Grimes.Sh NAME 418fae3551SRodney W. Grimes.Nm boot 42eb083802SRuslan Ermilov.Nd system bootstrapping procedures 438fae3551SRodney W. Grimes.Sh DESCRIPTION 448fae3551SRodney W. Grimes.Sy Power fail and crash recovery . 458fae3551SRodney W. GrimesNormally, the system will reboot itself at power-up or after crashes. 468fae3551SRodney W. GrimesAn automatic consistency check of the file systems will be performed, 478fae3551SRodney W. Grimesand unless this fails, the system will resume multi-user operations. 488fae3551SRodney W. Grimes.Pp 498fae3551SRodney W. Grimes.Sy Cold starts . 508dfcea8cSRobert NordierMost i386 PCs attempt to boot first from floppy disk drive 0 (sometimes 518dfcea8cSRobert Nordierknown as drive A:) and, failing that, from hard disk drive 0 (sometimes 529806e231SRuslan Ermilovknown as drive C:, or as drive 0x80 to the BIOS). 539806e231SRuslan ErmilovSome BIOSes allow 548dfcea8cSRobert Nordieryou to change this default sequence, and may also include a CD-ROM 55c65c062fSBruce Evansdrive as a boot device. 5689aeb8ceSRobert Nordier.Pp 579d1334e0SEd MasteSome newer PCs boot using UEFI firmware, not BIOS. 589d1334e0SEd MasteThat process is described 599d1334e0SEd Mastein 609d1334e0SEd Maste.Xr uefi 8 . 619d1334e0SEd Maste.Pp 62b68e92ffSConrad MeyerA three-stage bootstrap is employed. 63b68e92ffSConrad MeyerControl is passed from the boot blocks (bootstrap stages one and two) to a 64b68e92ffSConrad Meyerthird-stage bootstrap program, 65e57c888fSAlexey Zelkin.Xr loader 8 . 668dfcea8cSRobert NordierThis third stage provides more sophisticated control over the booting 678dfcea8cSRobert Nordierprocess than it is possible to achieve in the boot blocks, which are 688dfcea8cSRobert Nordierconstrained by occupying limited fixed space on a given disk or slice. 6989aeb8ceSRobert Nordier.Pp 709806e231SRuslan ErmilovThe remainder of this subsection deals only with the boot blocks. 719806e231SRuslan ErmilovThe 72d0353b83SRuslan Ermilov.Xr loader 8 739ef416cfSRobert Nordierprogram is documented separately. 7489aeb8ceSRobert Nordier.Pp 75c65c062fSBruce EvansAfter the boot blocks have been loaded, 76c65c062fSBruce Evansyou should see a prompt similar to the following: 77c65c062fSBruce Evans.Bd -literal 78be1ef9beSIan Lepore>> FreeBSD/x86 BOOT 799e09a912SMike SilbersackDefault: 0:ad(0,a)/boot/loader 80c65c062fSBruce Evansboot: 81c65c062fSBruce Evans.Ed 82c65c062fSBruce Evans.Pp 83c65c062fSBruce EvansThe automatic boot will attempt to load 849e09a912SMike Silbersack.Pa /boot/loader 85d16b647eSJoerg Wunschfrom partition 86d16b647eSJoerg Wunsch.Ql a 87d16b647eSJoerg Wunschof either the floppy or the hard disk. 88d16b647eSJoerg WunschThis boot may be aborted by typing any character on the keyboard 89d16b647eSJoerg Wunschat the 90b392c965SMateusz Piotrowski.Ql boot\&: 919806e231SRuslan Ermilovprompt. 929806e231SRuslan ErmilovAt this time, the following input will be accepted: 93d0353b83SRuslan Ermilov.Bl -tag -width indent 94d0353b83SRuslan Ermilov.It Ic \&? 95d16b647eSJoerg WunschGive a short listing of the files in the root directory of the default 969806e231SRuslan Ermilovboot device, as a hint about available boot files. 979806e231SRuslan Ermilov(A 98d0353b83SRuslan Ermilov.Ic ?\& 9989aeb8ceSRobert Nordiermay also be specified as the last segment of a path, in which case 10089aeb8ceSRobert Nordierthe listing will be of the relevant subdirectory.) 101d0353b83SRuslan Ermilov.It Xo 102cd6ab711SRuslan Ermilov.Sm off 103cd6ab711SRuslan Ermilov.Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) 104d0353b83SRuslan Ermilov.Ar filename 105a00a2591SIan Dowse.Sm on 106bc6d68dfSPierre Beyssac.Op Fl aCcDdghmnPprsv 1078c81e137SRuslan Ermilov.Op Fl S Ns Ar speed 108d0353b83SRuslan Ermilov.Xc 109d16b647eSJoerg WunschSpecify boot file and flags. 110d0353b83SRuslan Ermilov.Bl -tag -width indent 111d0353b83SRuslan Ermilov.It Ar bios_drive 112c65c062fSBruce EvansThe drive number as recognized by the BIOS. 113c65c062fSBruce Evans0 for the first drive, 1 for the second drive, etc. 114d0353b83SRuslan Ermilov.It Ar interface 1159806e231SRuslan ErmilovThe type of controller to boot from. 1169806e231SRuslan ErmilovNote that the controller is required 117d16b647eSJoerg Wunschto have BIOS support since the BIOS services are used to load the 118d16b647eSJoerg Wunschboot file image. 1198fae3551SRodney W. Grimes.Pp 120c65c062fSBruce EvansThe supported interfaces are: 121d0353b83SRuslan Ermilov.Pp 122dba060d3SJoseph Koshy.Bl -tag -width "adXX" -compact 123dba060d3SJoseph Koshy.It ad 124d16b647eSJoerg WunschST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike 1258fae3551SRodney W. Grimescontroller 126d16b647eSJoerg Wunsch.It fd 127d16b647eSJoerg Wunsch5 1/4" or 3 1/2" High density floppies 1287af89e87SKazutaka YOKOTA.It da 129d16b647eSJoerg WunschSCSI disk on any supported SCSI controller 130c65c062fSBruce Evans.\".It cd 131c65c062fSBruce Evans.\"boot from CDROM 132d16b647eSJoerg Wunsch.El 133d0353b83SRuslan Ermilov.It Ar unit 134c65c062fSBruce EvansThe unit number of the drive on the interface being used. 135c65c062fSBruce Evans0 for the first drive, 1 for the second drive, etc. 136cd6ab711SRuslan Ermilov.It Oo Ar slice , Oc Ns Ar part 137753d686dSRuslan ErmilovThe partition letter inside the 138753d686dSRuslan Ermilov.Bx 1399806e231SRuslan Ermilovportion of the disk. 1409806e231SRuslan ErmilovSee 1419f4709d6SBrooks Davis.Xr bsdlabel 8 . 142d16b647eSJoerg WunschBy convention, only partition 143d16b647eSJoerg Wunsch.Ql a 1449806e231SRuslan Ermilovcontains a bootable image. 1459806e231SRuslan ErmilovIf sliced disks are used 146d16b647eSJoerg Wunsch.Pq Dq fdisk partitions , 147cd6ab711SRuslan Ermilovany 148cd6ab711SRuslan Ermilov.Ar slice 149cd6ab711SRuslan Ermilov(1 for the first slice, 2 for the second slice, etc.\&) 150cd6ab711SRuslan Ermilovcan be booted from, with the default (if not specified) being the active slice 151e57c888fSAlexey Zelkinor, otherwise, the first 152e57c888fSAlexey Zelkin.Fx 153e57c888fSAlexey Zelkinslice. 154cd6ab711SRuslan ErmilovIf 155cd6ab711SRuslan Ermilov.Ar slice 156cd6ab711SRuslan Ermilovis specified as 0, the first 157cd6ab711SRuslan Ermilov.Fx 158cd6ab711SRuslan Ermilovslice (also known as 159cd6ab711SRuslan Ermilov.Dq compatibility 160cd6ab711SRuslan Ermilovslice) is booted from. 161d0353b83SRuslan Ermilov.It Ar filename 162c65c062fSBruce EvansThe pathname of the file to boot (relative to the root directory 1639806e231SRuslan Ermilovon the specified partition). 1649806e231SRuslan ErmilovDefaults to 165a00a2591SIan Dowse.Pa /boot/kernel/kernel . 166d16b647eSJoerg WunschSymbolic links are not supported (hard links are). 16750d89fc5SMaxim Sobolev.It Xo Op Fl aCcDdghmnPpqrsv 1688c81e137SRuslan Ermilov.Op Fl S Ns Ar speed 169a00a2591SIan Dowse.Xc 170d16b647eSJoerg WunschBoot flags: 171d0353b83SRuslan Ermilov.Pp 172c65c062fSBruce Evans.Bl -tag -width "-CXX" -compact 173d16b647eSJoerg Wunsch.It Fl a 174c65c062fSBruce Evansduring kernel initialization, 175a910f192SDima Dorfmanask for the device to mount as the root file system. 176c65c062fSBruce Evans.It Fl C 17752501c5eSRuslan Ermilovtry to mount root file system from a CD-ROM. 178d16b647eSJoerg Wunsch.It Fl c 17952501c5eSRuslan Ermilovthis flag is currently a no-op. 180c65c062fSBruce Evans.It Fl D 18152501c5eSRuslan Ermilovboot with the dual console configuration. 1829806e231SRuslan ErmilovIn the single 18352501c5eSRuslan Ermilovconfiguration, the console will be either the internal display 184c65c062fSBruce Evansor the serial port, depending on the state of the 185c65c062fSBruce Evans.Fl h 1869806e231SRuslan Ermilovoption below. 1879806e231SRuslan ErmilovIn the dual console configuration, 188c65c062fSBruce Evansboth the internal display and the serial port will become the console 189c65c062fSBruce Evansat the same time, regardless of the state of the 190c65c062fSBruce Evans.Fl h 1919806e231SRuslan Ermilovoption. 192d16b647eSJoerg Wunsch.It Fl d 193d16b647eSJoerg Wunschenter the DDB kernel debugger 194c4d9468eSRuslan Ermilov(see 195c4d9468eSRuslan Ermilov.Xr ddb 4 ) 196048362aaSDaniel O'Callaghanas early as possible in kernel initialization. 197c65c062fSBruce Evans.It Fl g 198c65c062fSBruce Evansuse the GDB remote debugging protocol. 199d16b647eSJoerg Wunsch.It Fl h 20052501c5eSRuslan Ermilovforce the serial console. 2019806e231SRuslan ErmilovFor instance, if you boot from the internal console, 202c65c062fSBruce Evansyou can use the 203c65c062fSBruce Evans.Fl h 204c65c062fSBruce Evansoption to force the kernel to use the serial port as its 2059806e231SRuslan Ermilovconsole device. 2069662d32cSRuslan Ermilov.It Fl m 207408c1ff8SEd Mastemute the console to suppress all kernel console input and output during the 2084d05699bSMaxim Konovalovboot. 209038148d6SPierre Beyssac.It Fl n 21010cb9bd3SRuslan Ermilovignore key press to interrupt boot before 21110cb9bd3SRuslan Ermilov.Xr loader 8 21210cb9bd3SRuslan Ermilovis invoked. 213c65c062fSBruce Evans.It Fl P 2149806e231SRuslan Ermilovprobe the keyboard. 2159806e231SRuslan ErmilovIf no keyboard is found, the 216c65c062fSBruce Evans.Fl D 217c65c062fSBruce Evansand 218c65c062fSBruce Evans.Fl h 219c65c062fSBruce Evansoptions are automatically set. 22028703190SGuido van Rooij.It Fl p 22128703190SGuido van Rooijpause after each attached device during the device probing phase. 22250d89fc5SMaxim Sobolev.It Fl q 22350d89fc5SMaxim Sobolevbe quiet, 22450d89fc5SMaxim Sobolevdo not write anything to the console unless automatic boot fails or 22550d89fc5SMaxim Sobolevis disabled. 22650d89fc5SMaxim SobolevThis option only affects second-stage bootstrap, 22750d89fc5SMaxim Sobolevto prevent next stages from writing to the console use in 22850d89fc5SMaxim Sobolevcombination with the 22950d89fc5SMaxim Sobolev.Fl m 23050d89fc5SMaxim Sobolevoption. 231d16b647eSJoerg Wunsch.It Fl r 232c65c062fSBruce Evansuse the statically configured default for the device containing the 233c65c062fSBruce Evansroot file system 234c4d9468eSRuslan Ermilov(see 235c4d9468eSRuslan Ermilov.Xr config 8 ) . 236c65c062fSBruce EvansNormally, the root file system is on the device 237c65c062fSBruce Evansthat the kernel was loaded from. 238d16b647eSJoerg Wunsch.It Fl s 239d16b647eSJoerg Wunschboot into single-user mode; if the console is marked as 240d16b647eSJoerg Wunsch.Dq insecure 241c4d9468eSRuslan Ermilov(see 242c4d9468eSRuslan Ermilov.Xr ttys 5 ) , 2439448def9SPhilippe Charnierthe root password must be entered. 2448c81e137SRuslan Ermilov.It Fl S Ns Ar speed 245a00a2591SIan Dowseset the speed of the serial console to 246a00a2591SIan Dowse.Ar speed . 247*4722ceb7SEd MasteThe default is 115200 unless it has been overridden by setting 248a00a2591SIan Dowse.Va BOOT_COMCONSOLE_SPEED 249a00a2591SIan Dowsein 25008b91343SYaroslav Tykhiy.Xr make.conf 5 2514e9e907dSRuslan Ermilovand recompiling and reinstalling the boot blocks. 252d16b647eSJoerg Wunsch.It Fl v 253c65c062fSBruce Evansbe verbose during device probing (and later). 254d16b647eSJoerg Wunsch.El 255d16b647eSJoerg Wunsch.El 256d16b647eSJoerg Wunsch.El 257c65c062fSBruce Evans.Pp 25875803d7fSDaniel GerzoUse the 259c65c062fSBruce Evans.Pa /boot.config 26075803d7fSDaniel Gerzofile to set the default configuration options for the boot block code. 26175803d7fSDaniel GerzoSee 26275803d7fSDaniel Gerzo.Xr boot.config 5 26375803d7fSDaniel Gerzofor more information about the 26475803d7fSDaniel Gerzo.Pa /boot.config 26575803d7fSDaniel Gerzofile. 2668fae3551SRodney W. Grimes.Sh FILES 267d0353b83SRuslan Ermilov.Bl -tag -width /boot/loader -compact 268c65c062fSBruce Evans.It Pa /boot.config 26989aeb8ceSRobert Nordierparameters for the boot blocks (optional) 2709ef416cfSRobert Nordier.It Pa /boot/boot1 2719ef416cfSRobert Nordierfirst stage bootstrap file 2729ef416cfSRobert Nordier.It Pa /boot/boot2 2739ef416cfSRobert Nordiersecond stage bootstrap file 27489aeb8ceSRobert Nordier.It Pa /boot/loader 2759ef416cfSRobert Nordierthird stage bootstrap 2761512a235STom Rhodes.It Pa /boot/kernel/kernel 277c65c062fSBruce Evansdefault kernel 2781512a235STom Rhodes.It Pa /boot/kernel.old/kernel 279c65c062fSBruce Evanstypical non-default kernel (optional) 2808fae3551SRodney W. Grimes.El 281e5da9b6bSRobert Nordier.Sh DIAGNOSTICS 282e5da9b6bSRobert NordierWhen disk-related errors occur, these are reported by the second-stage 283e5da9b6bSRobert Nordierbootstrap using the same error codes returned by the BIOS, for example 284e57c888fSAlexey Zelkin.Dq Disk error 0x1 (lba=0x12345678) . 285e57c888fSAlexey ZelkinHere is a partial list of these error codes: 2861252c1bbSRuslan Ermilov.Pp 2871252c1bbSRuslan Ermilov.Bl -tag -width "0x80" -compact 288e5da9b6bSRobert Nordier.It 0x1 289e5da9b6bSRobert NordierInvalid argument 290e5da9b6bSRobert Nordier.It 0x2 291e5da9b6bSRobert NordierAddress mark not found 292e5da9b6bSRobert Nordier.It 0x4 293e5da9b6bSRobert NordierSector not found 294e5da9b6bSRobert Nordier.It 0x8 295e5da9b6bSRobert NordierDMA overrun 296e5da9b6bSRobert Nordier.It 0x9 297e5da9b6bSRobert NordierDMA attempt across 64K boundary 298e5da9b6bSRobert Nordier.It 0xc 299e5da9b6bSRobert NordierInvalid media 300e5da9b6bSRobert Nordier.It 0x10 301e5da9b6bSRobert NordierUncorrectable CRC/ECC error 302e5da9b6bSRobert Nordier.It 0x20 303e5da9b6bSRobert NordierController failure 304e5da9b6bSRobert Nordier.It 0x40 305e5da9b6bSRobert NordierSeek failed 306e5da9b6bSRobert Nordier.It 0x80 307e5da9b6bSRobert NordierTimeout 308e5da9b6bSRobert Nordier.El 309e5da9b6bSRobert Nordier.Pp 3108a1917d0SRobert Nordier.Sy "NOTE" : 3118a1917d0SRobert NordierOn older machines, or otherwise where EDD support (disk packet 3128a1917d0SRobert Nordierinterface support) is not available, all boot-related files and 313e5da9b6bSRobert Nordierstructures (including the kernel) that need to be accessed during the 314e5da9b6bSRobert Nordierboot phase must reside on the disk at or below cylinder 1023 (as the 3159806e231SRuslan ErmilovBIOS understands the geometry). 3169806e231SRuslan ErmilovWhen a 317e5da9b6bSRobert Nordier.Dq Disk error 0x1 318e5da9b6bSRobert Nordieris reported by the second-stage bootstrap, it generally means that this 319e5da9b6bSRobert Nordierrequirement has not been adhered to. 3206087df9eSRuslan Ermilov.Sh SEE ALSO 3216087df9eSRuslan Ermilov.Xr ddb 4 , 32275803d7fSDaniel Gerzo.Xr boot.config 5 , 32308b91343SYaroslav Tykhiy.Xr make.conf 5 , 3243d6a5b14SEdward Tomasz Napierala.Xr mount.conf 5 , 3256087df9eSRuslan Ermilov.Xr ttys 5 , 3266087df9eSRuslan Ermilov.Xr boot0cfg 8 , 3276087df9eSRuslan Ermilov.Xr btxld 8 , 3286087df9eSRuslan Ermilov.Xr config 8 , 329d046aae2SAllan Jude.Xr efibootmgr 8 , 330d046aae2SAllan Jude.Xr efivar 8 , 331b8c19fd7SEdward Tomasz Napierala.Xr gpart 8 , 33242c916d7SWarren Block.Xr gptboot 8 , 3334f9917f5SAllan Jude.Xr gptzfsboot 8 , 3346087df9eSRuslan Ermilov.Xr halt 8 , 3356087df9eSRuslan Ermilov.Xr loader 8 , 336f7eaf827SJoseph Koshy.Xr nextboot 8 , 3376087df9eSRuslan Ermilov.Xr reboot 8 , 3389d1334e0SEd Maste.Xr shutdown 8 , 339d046aae2SAllan Jude.Xr uefi 8 , 340d046aae2SAllan Jude.Xr zfsbootcfg 8 3418fae3551SRodney W. Grimes.Sh BUGS 342603c2b9bSSergey KandaurovThe bsdlabel format used by this version of 3438fae3551SRodney W. Grimes.Bx 3448fae3551SRodney W. Grimesis quite 3458fae3551SRodney W. Grimesdifferent from that of other architectures. 346d16b647eSJoerg Wunsch.Pp 347c64dca10SRobert NordierDue to space constraints, the keyboard probe initiated by the 348c64dca10SRobert Nordier.Fl P 349c64dca10SRobert Nordieroption is simply a test that the BIOS has detected an 350c64dca10SRobert Nordier.Dq extended 3519806e231SRuslan Ermilovkeyboard. 3529806e231SRuslan ErmilovIf an 353c64dca10SRobert Nordier.Dq XT/AT 354c64dca10SRobert Nordierkeyboard (with no F11 and F12 keys, etc.) is attached, the probe will 355c64dca10SRobert Nordierfail. 356