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