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. 198fae3551SRodney W. Grimes.\" 4. 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.\" 377f3dea24SPeter Wemm.\" $FreeBSD$ 38d16b647eSJoerg Wunsch.\" 39295a9701SRuslan Ermilov.Dd September 30, 2004 408fae3551SRodney W. Grimes.Dt BOOT 8 i386 418fae3551SRodney W. Grimes.Os 428fae3551SRodney W. Grimes.Sh NAME 438fae3551SRodney W. Grimes.Nm boot 44eb083802SRuslan Ermilov.Nd system bootstrapping procedures 458fae3551SRodney W. Grimes.Sh DESCRIPTION 468fae3551SRodney W. Grimes.Sy Power fail and crash recovery . 478fae3551SRodney W. GrimesNormally, the system will reboot itself at power-up or after crashes. 488fae3551SRodney W. GrimesAn automatic consistency check of the file systems will be performed, 498fae3551SRodney W. Grimesand unless this fails, the system will resume multi-user operations. 508fae3551SRodney W. Grimes.Pp 518fae3551SRodney W. Grimes.Sy Cold starts . 528dfcea8cSRobert NordierMost i386 PCs attempt to boot first from floppy disk drive 0 (sometimes 538dfcea8cSRobert Nordierknown as drive A:) and, failing that, from hard disk drive 0 (sometimes 549806e231SRuslan Ermilovknown as drive C:, or as drive 0x80 to the BIOS). 559806e231SRuslan ErmilovSome BIOSes allow 568dfcea8cSRobert Nordieryou to change this default sequence, and may also include a CD-ROM 57c65c062fSBruce Evansdrive as a boot device. 5889aeb8ceSRobert Nordier.Pp 5989aeb8ceSRobert NordierBy default, a three-stage bootstrap is employed, and control is 6089aeb8ceSRobert Nordierautomatically passed from the boot blocks (bootstrap stages one and 6189aeb8ceSRobert Nordiertwo) to a separate third-stage bootstrap program, 62e57c888fSAlexey Zelkin.Xr loader 8 . 638dfcea8cSRobert NordierThis third stage provides more sophisticated control over the booting 648dfcea8cSRobert Nordierprocess than it is possible to achieve in the boot blocks, which are 658dfcea8cSRobert Nordierconstrained by occupying limited fixed space on a given disk or slice. 6689aeb8ceSRobert Nordier.Pp 6789aeb8ceSRobert NordierHowever, it is possible to dispense with the third stage altogether, 6889aeb8ceSRobert Nordiereither by specifying a kernel name in the boot block parameter 6989aeb8ceSRobert Nordierfile, 7089aeb8ceSRobert Nordier.Pa /boot.config , 71038148d6SPierre Beyssacor, unless option 72038148d6SPierre Beyssac.Fl n 73038148d6SPierre Beyssacis set, by hitting a key during a brief pause (while one of the characters 74d0353b83SRuslan Ermilov.Sy - , 75d0353b83SRuslan Ermilov.Sy \e , 76d0353b83SRuslan Ermilov.Sy \&| , 7789aeb8ceSRobert Nordieror 78d0353b83SRuslan Ermilov.Sy / 7989aeb8ceSRobert Nordieris displayed) before 80e57c888fSAlexey Zelkin.Xr loader 8 819806e231SRuslan Ermilovis invoked. 829806e231SRuslan ErmilovBooting will also be attempted at stage two, if the 8389aeb8ceSRobert Nordierthird stage cannot be loaded. 8489aeb8ceSRobert Nordier.Pp 859e09a912SMike SilbersackMake note of the fact that 869e09a912SMike Silbersack.Pa /boot.config 879e09a912SMike Silbersackis read only from the 889e09a912SMike Silbersack.Ql a 899e09a912SMike Silbersackpartition. As a result, slices which are missing an 909e09a912SMike Silbersack.Ql a 919e09a912SMike Silbersackparition require user intervention during the boot process. 929e09a912SMike Silbersack.Pp 939806e231SRuslan ErmilovThe remainder of this subsection deals only with the boot blocks. 949806e231SRuslan ErmilovThe 95d0353b83SRuslan Ermilov.Xr loader 8 969ef416cfSRobert Nordierprogram is documented separately. 9789aeb8ceSRobert Nordier.Pp 98c65c062fSBruce EvansAfter the boot blocks have been loaded, 99c65c062fSBruce Evansyou should see a prompt similar to the following: 100c65c062fSBruce Evans.Bd -literal 10189aeb8ceSRobert Nordier>> FreeBSD/i386 BOOT 1029e09a912SMike SilbersackDefault: 0:ad(0,a)/boot/loader 103c65c062fSBruce Evansboot: 104c65c062fSBruce Evans.Ed 105c65c062fSBruce Evans.Pp 106c65c062fSBruce EvansThe automatic boot will attempt to load 1079e09a912SMike Silbersack.Pa /boot/loader 108d16b647eSJoerg Wunschfrom partition 109d16b647eSJoerg Wunsch.Ql a 110d16b647eSJoerg Wunschof either the floppy or the hard disk. 111d16b647eSJoerg WunschThis boot may be aborted by typing any character on the keyboard 112d16b647eSJoerg Wunschat the 113c65c062fSBruce Evans.Ql boot: 1149806e231SRuslan Ermilovprompt. 1159806e231SRuslan ErmilovAt this time, the following input will be accepted: 116d0353b83SRuslan Ermilov.Bl -tag -width indent 117d0353b83SRuslan Ermilov.It Ic \&? 118d16b647eSJoerg WunschGive a short listing of the files in the root directory of the default 1199806e231SRuslan Ermilovboot device, as a hint about available boot files. 1209806e231SRuslan Ermilov(A 121d0353b83SRuslan Ermilov.Ic ?\& 12289aeb8ceSRobert Nordiermay also be specified as the last segment of a path, in which case 12389aeb8ceSRobert Nordierthe listing will be of the relevant subdirectory.) 1248dfcea8cSRobert Nordier.Pp 125d0353b83SRuslan Ermilov.It Xo 126cd6ab711SRuslan Ermilov.Sm off 127cd6ab711SRuslan Ermilov.Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) 128cd6ab711SRuslan Ermilov.Sm on 129d0353b83SRuslan Ermilov.Ar filename 130bc6d68dfSPierre Beyssac.Op Fl aCcDdghmnPprsv 131d0353b83SRuslan Ermilov.Xc 132d16b647eSJoerg WunschSpecify boot file and flags. 133d0353b83SRuslan Ermilov.Bl -tag -width indent 134d0353b83SRuslan Ermilov.It Ar bios_drive 135c65c062fSBruce EvansThe drive number as recognized by the BIOS. 136c65c062fSBruce Evans0 for the first drive, 1 for the second drive, etc. 137d0353b83SRuslan Ermilov.It Ar interface 1389806e231SRuslan ErmilovThe type of controller to boot from. 1399806e231SRuslan ErmilovNote that the controller is required 140d16b647eSJoerg Wunschto have BIOS support since the BIOS services are used to load the 141d16b647eSJoerg Wunschboot file image. 1428fae3551SRodney W. Grimes.Pp 143c65c062fSBruce EvansThe supported interfaces are: 144d0353b83SRuslan Ermilov.Pp 145dba060d3SJoseph Koshy.Bl -tag -width "adXX" -compact 146dba060d3SJoseph Koshy.It ad 147d16b647eSJoerg WunschST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike 1488fae3551SRodney W. Grimescontroller 149d16b647eSJoerg Wunsch.It fd 150d16b647eSJoerg Wunsch5 1/4" or 3 1/2" High density floppies 1517af89e87SKazutaka YOKOTA.It da 152d16b647eSJoerg WunschSCSI disk on any supported SCSI controller 153c65c062fSBruce Evans.\".It cd 154c65c062fSBruce Evans.\"boot from CDROM 155d16b647eSJoerg Wunsch.El 156d0353b83SRuslan Ermilov.It Ar unit 157c65c062fSBruce EvansThe unit number of the drive on the interface being used. 158c65c062fSBruce Evans0 for the first drive, 1 for the second drive, etc. 159cd6ab711SRuslan Ermilov.It Oo Ar slice , Oc Ns Ar part 160753d686dSRuslan ErmilovThe partition letter inside the 161753d686dSRuslan Ermilov.Bx 1629806e231SRuslan Ermilovportion of the disk. 1639806e231SRuslan ErmilovSee 1649f4709d6SBrooks Davis.Xr bsdlabel 8 . 165d16b647eSJoerg WunschBy convention, only partition 166d16b647eSJoerg Wunsch.Ql a 1679806e231SRuslan Ermilovcontains a bootable image. 1689806e231SRuslan ErmilovIf sliced disks are used 169d16b647eSJoerg Wunsch.Pq Dq fdisk partitions , 170cd6ab711SRuslan Ermilovany 171cd6ab711SRuslan Ermilov.Ar slice 172cd6ab711SRuslan Ermilov(1 for the first slice, 2 for the second slice, etc.\&) 173cd6ab711SRuslan Ermilovcan be booted from, with the default (if not specified) being the active slice 174e57c888fSAlexey Zelkinor, otherwise, the first 175e57c888fSAlexey Zelkin.Fx 176e57c888fSAlexey Zelkinslice. 177cd6ab711SRuslan ErmilovIf 178cd6ab711SRuslan Ermilov.Ar slice 179cd6ab711SRuslan Ermilovis specified as 0, the first 180cd6ab711SRuslan Ermilov.Fx 181cd6ab711SRuslan Ermilovslice (also known as 182cd6ab711SRuslan Ermilov.Dq compatibility 183cd6ab711SRuslan Ermilovslice) is booted from. 184d0353b83SRuslan Ermilov.It Ar filename 185c65c062fSBruce EvansThe pathname of the file to boot (relative to the root directory 1869806e231SRuslan Ermilovon the specified partition). 1879806e231SRuslan ErmilovDefaults to 18889aeb8ceSRobert Nordier.Pa /kernel . 189d16b647eSJoerg WunschSymbolic links are not supported (hard links are). 190bc6d68dfSPierre Beyssac.It Fl aCcDdghmnPprsv 191d16b647eSJoerg WunschBoot flags: 192d0353b83SRuslan Ermilov.Pp 193c65c062fSBruce Evans.Bl -tag -width "-CXX" -compact 194d16b647eSJoerg Wunsch.It Fl a 195c65c062fSBruce Evansduring kernel initialization, 196a910f192SDima Dorfmanask for the device to mount as the root file system. 197c65c062fSBruce Evans.It Fl C 19852501c5eSRuslan Ermilovtry to mount root file system from a CD-ROM. 199d16b647eSJoerg Wunsch.It Fl c 20052501c5eSRuslan Ermilovthis flag is currently a no-op. 201c65c062fSBruce Evans.It Fl D 20252501c5eSRuslan Ermilovboot with the dual console configuration. 2039806e231SRuslan ErmilovIn the single 20452501c5eSRuslan Ermilovconfiguration, the console will be either the internal display 205c65c062fSBruce Evansor the serial port, depending on the state of the 206c65c062fSBruce Evans.Fl h 2079806e231SRuslan Ermilovoption below. 2089806e231SRuslan ErmilovIn the dual console configuration, 209c65c062fSBruce Evansboth the internal display and the serial port will become the console 210c65c062fSBruce Evansat the same time, regardless of the state of the 211c65c062fSBruce Evans.Fl h 2129806e231SRuslan Ermilovoption. 213d16b647eSJoerg Wunsch.It Fl d 214d16b647eSJoerg Wunschenter the DDB kernel debugger 215c4d9468eSRuslan Ermilov(see 216c4d9468eSRuslan Ermilov.Xr ddb 4 ) 217048362aaSDaniel O'Callaghanas early as possible in kernel initialization. 218c65c062fSBruce Evans.It Fl g 219c65c062fSBruce Evansuse the GDB remote debugging protocol. 220d16b647eSJoerg Wunsch.It Fl h 22152501c5eSRuslan Ermilovforce the serial console. 2229806e231SRuslan ErmilovFor instance, if you boot from the internal console, 223c65c062fSBruce Evansyou can use the 224c65c062fSBruce Evans.Fl h 225c65c062fSBruce Evansoption to force the kernel to use the serial port as its 2269806e231SRuslan Ermilovconsole device. 227688db407SKazutaka YOKOTAThe serial port driver 228688db407SKazutaka YOKOTA.Xr sio 4 22952501c5eSRuslan Ermilovhas a flag (0x20) to override this option. 230688db407SKazutaka YOKOTAIf that flag is set, the serial port will always be used as the console, 231688db407SKazutaka YOKOTAregardless of the 232688db407SKazutaka YOKOTA.Fl h 2339806e231SRuslan Ermilovoption described here. 2349806e231SRuslan ErmilovSee the man page for 235688db407SKazutaka YOKOTA.Xr sio 4 236688db407SKazutaka YOKOTAfor more details. 2379662d32cSRuslan Ermilov.It Fl m 2389662d32cSRuslan Ermilovmute the console. 239038148d6SPierre Beyssac.It Fl n 24010cb9bd3SRuslan Ermilovignore key press to interrupt boot before 24110cb9bd3SRuslan Ermilov.Xr loader 8 24210cb9bd3SRuslan Ermilovis invoked. 243c65c062fSBruce Evans.It Fl P 2449806e231SRuslan Ermilovprobe the keyboard. 2459806e231SRuslan ErmilovIf no keyboard is found, the 246c65c062fSBruce Evans.Fl D 247c65c062fSBruce Evansand 248c65c062fSBruce Evans.Fl h 249c65c062fSBruce Evansoptions are automatically set. 25028703190SGuido van Rooij.It Fl p 25128703190SGuido van Rooijpause after each attached device during the device probing phase. 252d16b647eSJoerg Wunsch.It Fl r 253c65c062fSBruce Evansuse the statically configured default for the device containing the 254c65c062fSBruce Evansroot file system 255c4d9468eSRuslan Ermilov(see 256c4d9468eSRuslan Ermilov.Xr config 8 ) . 257c65c062fSBruce EvansNormally, the root file system is on the device 258c65c062fSBruce Evansthat the kernel was loaded from. 259d16b647eSJoerg Wunsch.It Fl s 260d16b647eSJoerg Wunschboot into single-user mode; if the console is marked as 261d16b647eSJoerg Wunsch.Dq insecure 262c4d9468eSRuslan Ermilov(see 263c4d9468eSRuslan Ermilov.Xr ttys 5 ) , 2649448def9SPhilippe Charnierthe root password must be entered. 265d16b647eSJoerg Wunsch.It Fl v 266c65c062fSBruce Evansbe verbose during device probing (and later). 267d16b647eSJoerg Wunsch.El 268d16b647eSJoerg Wunsch.El 269d16b647eSJoerg Wunsch.El 270c65c062fSBruce Evans.Pp 271c65c062fSBruce EvansYou may put a BIOS drive number, a controller type, a unit number, 2728dfcea8cSRobert Nordiera partition, a kernel file name, and any valid option in 273c65c062fSBruce Evans.Pa /boot.config 2749806e231SRuslan Ermilovto set defaults. 2759806e231SRuslan ErmilovEnter them in one line just as you type at the 276c65c062fSBruce Evans.Ql boot: 277c65c062fSBruce Evansprompt. 2788fae3551SRodney W. Grimes.Sh FILES 279d0353b83SRuslan Ermilov.Bl -tag -width /boot/loader -compact 280c65c062fSBruce Evans.It Pa /boot.config 28189aeb8ceSRobert Nordierparameters for the boot blocks (optional) 2829ef416cfSRobert Nordier.It Pa /boot/boot1 2839ef416cfSRobert Nordierfirst stage bootstrap file 2849ef416cfSRobert Nordier.It Pa /boot/boot2 2859ef416cfSRobert Nordiersecond stage bootstrap file 28689aeb8ceSRobert Nordier.It Pa /boot/loader 2879ef416cfSRobert Nordierthird stage bootstrap 2881512a235STom Rhodes.It Pa /boot/kernel/kernel 289c65c062fSBruce Evansdefault kernel 2901512a235STom Rhodes.It Pa /boot/kernel.old/kernel 291c65c062fSBruce Evanstypical non-default kernel (optional) 2928fae3551SRodney W. Grimes.El 2938fae3551SRodney W. Grimes.Sh SEE ALSO 294d16b647eSJoerg Wunsch.Xr ddb 4 , 295d16b647eSJoerg Wunsch.Xr ttys 5 , 296042f27bdSTim Vanderhoek.Xr boot0cfg 8 , 2970513a60bSBrooks Davis.Xr bsdlabel 8 , 2988dfcea8cSRobert Nordier.Xr btxld 8 , 299c65c062fSBruce Evans.Xr config 8 , 3008fae3551SRodney W. Grimes.Xr halt 8 , 3019ef416cfSRobert Nordier.Xr loader 8 , 3028fae3551SRodney W. Grimes.Xr reboot 8 , 303af202156SWolfram Schneider.Xr shutdown 8 304e5da9b6bSRobert Nordier.Sh DIAGNOSTICS 305e5da9b6bSRobert NordierWhen disk-related errors occur, these are reported by the second-stage 306e5da9b6bSRobert Nordierbootstrap using the same error codes returned by the BIOS, for example 307e57c888fSAlexey Zelkin.Dq Disk error 0x1 (lba=0x12345678) . 308e57c888fSAlexey ZelkinHere is a partial list of these error codes: 3091252c1bbSRuslan Ermilov.Pp 3101252c1bbSRuslan Ermilov.Bl -tag -width "0x80" -compact 311e5da9b6bSRobert Nordier.It 0x1 312e5da9b6bSRobert NordierInvalid argument 313e5da9b6bSRobert Nordier.It 0x2 314e5da9b6bSRobert NordierAddress mark not found 315e5da9b6bSRobert Nordier.It 0x4 316e5da9b6bSRobert NordierSector not found 317e5da9b6bSRobert Nordier.It 0x8 318e5da9b6bSRobert NordierDMA overrun 319e5da9b6bSRobert Nordier.It 0x9 320e5da9b6bSRobert NordierDMA attempt across 64K boundary 321e5da9b6bSRobert Nordier.It 0xc 322e5da9b6bSRobert NordierInvalid media 323e5da9b6bSRobert Nordier.It 0x10 324e5da9b6bSRobert NordierUncorrectable CRC/ECC error 325e5da9b6bSRobert Nordier.It 0x20 326e5da9b6bSRobert NordierController failure 327e5da9b6bSRobert Nordier.It 0x40 328e5da9b6bSRobert NordierSeek failed 329e5da9b6bSRobert Nordier.It 0x80 330e5da9b6bSRobert NordierTimeout 331e5da9b6bSRobert Nordier.El 332e5da9b6bSRobert Nordier.Pp 3338a1917d0SRobert Nordier.Sy "NOTE" : 3348a1917d0SRobert NordierOn older machines, or otherwise where EDD support (disk packet 3358a1917d0SRobert Nordierinterface support) is not available, all boot-related files and 336e5da9b6bSRobert Nordierstructures (including the kernel) that need to be accessed during the 337e5da9b6bSRobert Nordierboot phase must reside on the disk at or below cylinder 1023 (as the 3389806e231SRuslan ErmilovBIOS understands the geometry). 3399806e231SRuslan ErmilovWhen a 340e5da9b6bSRobert Nordier.Dq Disk error 0x1 341e5da9b6bSRobert Nordieris reported by the second-stage bootstrap, it generally means that this 342e5da9b6bSRobert Nordierrequirement has not been adhered to. 3438fae3551SRodney W. Grimes.Sh BUGS 344d0353b83SRuslan ErmilovThe 3459f4709d6SBrooks Davis.Xr bsdlabel 5 346d0353b83SRuslan Ermilovformat used by this version of 3478fae3551SRodney W. Grimes.Bx 3488fae3551SRodney W. Grimesis quite 3498fae3551SRodney W. Grimesdifferent from that of other architectures. 350d16b647eSJoerg Wunsch.Pp 351c64dca10SRobert NordierDue to space constraints, the keyboard probe initiated by the 352c64dca10SRobert Nordier.Fl P 353c64dca10SRobert Nordieroption is simply a test that the BIOS has detected an 354c64dca10SRobert Nordier.Dq extended 3559806e231SRuslan Ermilovkeyboard. 3569806e231SRuslan ErmilovIf an 357c64dca10SRobert Nordier.Dq XT/AT 358c64dca10SRobert Nordierkeyboard (with no F11 and F12 keys, etc.) is attached, the probe will 359c64dca10SRobert Nordierfail. 360