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. All advertising materials mentioning features or use of this software 20.\" must display the following acknowledgement: 21.\" This product includes software developed by the University of 22.\" California, Berkeley and its contributors. 23.\" 4. Neither the name of the University nor the names of its contributors 24.\" may be used to endorse or promote products derived from this software 25.\" without specific prior written permission. 26.\" 27.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 28.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37.\" SUCH DAMAGE. 38.\" 39.\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 40.\" 41.\" $FreeBSD$ 42.\" 43.Dd April 19, 1994 44.Dt BOOT 8 i386 45.Os 46.Sh NAME 47.Nm boot 48.Nd system bootstrapping procedures 49.Sh DESCRIPTION 50.Sy Power fail and crash recovery . 51Normally, the system will reboot itself at power-up or after crashes. 52An automatic consistency check of the file systems will be performed, 53and unless this fails, the system will resume multi-user operations. 54.Pp 55.Sy Cold starts . 56Most i386 PCs attempt to boot first from floppy disk drive 0 (sometimes 57known as drive A:) and, failing that, from hard disk drive 0 (sometimes 58known as drive C:, or as drive 0x80 to the BIOS). Some BIOSes allow 59you to change this default sequence, and may also include a CD-ROM 60drive as a boot device. 61.Pp 62By default, a three-stage bootstrap is employed, and control is 63automatically passed from the boot blocks (bootstrap stages one and 64two) to a separate third-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 70However, it is possible to dispense with the third stage altogether, 71either by specifying a kernel name in the boot block parameter 72file, 73.Pa /boot.config , 74or by hitting a key during a brief pause (while one of the characters 75.Sy - , 76.Sy \e , 77.Sy \&| , 78or 79.Sy / 80is displayed) before 81.Xr loader 8 82is invoked. Booting will also be attempted at stage two, if the 83third stage cannot be loaded. 84.Pp 85The remainder of this subsection deals only with the boot blocks. The 86.Xr loader 8 87program is documented separately. 88.Pp 89After the boot blocks have been loaded, 90you should see a prompt similar to the following: 91.Bd -literal 92>> FreeBSD/i386 BOOT 93Default: 0:ad(0,a)/kernel 94boot: 95.Ed 96.Pp 97The automatic boot will attempt to load 98.Pa /kernel 99from partition 100.Ql a 101of either the floppy or the hard disk. 102This boot may be aborted by typing any character on the keyboard 103at the 104.Ql boot: 105prompt. At this time, the following input will be accepted: 106.Bl -tag -width indent 107.It Ic \&? 108Give a short listing of the files in the root directory of the default 109boot device, as a hint about available boot files. (A 110.Ic ?\& 111may also be specified as the last segment of a path, in which case 112the listing will be of the relevant subdirectory.) 113.Pp 114.It Xo 115.Ar bios_drive : Ns Ar interface Ns Po 116.Ar unit , Ns Ar part Pc 117.Ar filename 118.Op Fl aCcDdghPprsv 119.Xc 120Specify boot file and flags. 121.Bl -tag -width indent 122.It Ar bios_drive 123The drive number as recognized by the BIOS. 1240 for the first drive, 1 for the second drive, etc. 125.It Ar interface 126The type of controller to boot from. Note that the controller is required 127to have BIOS support since the BIOS services are used to load the 128boot file image. 129.Pp 130The supported interfaces are: 131.Pp 132.Bl -tag -width "adXX" -compact 133.It ad 134ST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike 135controller 136.It fd 1375 1/4" or 3 1/2" High density floppies 138.It da 139SCSI disk on any supported SCSI controller 140.\".It cd 141.\"boot from CDROM 142.El 143.It Ar unit 144The unit number of the drive on the interface being used. 1450 for the first drive, 1 for the second drive, etc. 146.It Ar part 147The partition letter inside the 148.Bx 149portion of the disk. See 150.Xr disklabel 8 . 151By convention, only partition 152.Ql a 153contains a bootable image. If sliced disks are used 154.Pq Dq fdisk partitions , 155any slice can be booted from, with the default being the active slice 156or, otherwise, the first 157.Fx 158slice. 159.It Ar filename 160The pathname of the file to boot (relative to the root directory 161on the specified partition). Defaults to 162.Pa /kernel . 163Symbolic links are not supported (hard links are). 164.It Fl acCdDghPrsv 165Boot flags: 166.Pp 167.Bl -tag -width "-CXX" -compact 168.It Fl a 169during kernel initialization, 170ask for the device to mount as the root file system. 171.It Fl C 172boot from CDROM. 173.It Fl c 174run UserConfig to modify hardware parameters for the loaded 175kernel. If the kernel was built with one of 176.Dv USERCONFIG , INTRO_USERCONFIG , VISUAL_USERCONFIG 177options, 178remain in UserConfig regardless of any 179.Ic quit 180commands present in the script. 181.It Fl D 182toggle single and dual console configurations. In 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. In the dual console configuration, 187both the internal display and the serial port will become the console 188at the same time, regardless of the state of the 189.Fl h 190option. However, the dual console configuration takes effect only during 191the boot prompt. Once the kernel is loaded, the console specified 192by the 193.Fl h 194option becomes the only console. 195.It Fl d 196enter the DDB kernel debugger 197(see 198.Xr ddb 4 ) 199as early as possible in kernel initialization. 200.It Fl g 201use the GDB remote debugging protocol. 202.It Fl h 203toggle internal and serial consoles. You can use this to switch 204console devices. For instance, if you boot from the internal console, 205you can use the 206.Fl h 207option to force the kernel to use the serial port as its 208console device. Alternatively, if you boot from the serial port, 209you can use this option to force the kernel to use the internal display 210as the console instead. 211The serial port driver 212.Xr sio 4 213has a flag to override this option. 214If that flag is set, the serial port will always be used as the console, 215regardless of the 216.Fl h 217option described here. See the man page for 218.Xr sio 4 219for more details. 220.It Fl P 221probe the keyboard. If no keyboard is found, the 222.Fl D 223and 224.Fl h 225options are automatically set. 226.It Fl p 227pause after each attached device during the device probing phase. 228.It Fl r 229use the statically configured default for the device containing the 230root file system 231(see 232.Xr config 8 ) . 233Normally, the root file system is on the device 234that the kernel was loaded from. 235.It Fl s 236boot into single-user mode; if the console is marked as 237.Dq insecure 238(see 239.Xr ttys 5 ) , 240the root password must be entered. 241.It Fl v 242be verbose during device probing (and later). 243.El 244.El 245.El 246.Pp 247You may put a BIOS drive number, a controller type, a unit number, 248a partition, a kernel file name, and any valid option in 249.Pa /boot.config 250to set defaults. Enter them in one line just as you type at the 251.Ql boot: 252prompt. 253.Sh FILES 254.Bl -tag -width /boot/loader -compact 255.It Pa /boot.config 256parameters for the boot blocks (optional) 257.It Pa /boot/boot1 258first stage bootstrap file 259.It Pa /boot/boot2 260second stage bootstrap file 261.It Pa /boot/loader 262third stage bootstrap 263.It Pa /kernel 264default kernel 265.It Pa /kernel.old 266typical non-default kernel (optional) 267.El 268.Sh SEE ALSO 269.Xr ddb 4 , 270.Xr ttys 5 , 271.Xr boot0cfg 8 , 272.Xr btxld 8 , 273.Xr config 8 , 274.Xr disklabel 8 , 275.Xr halt 8 , 276.Xr loader 8 , 277.Xr reboot 8 , 278.Xr shutdown 8 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 "IMPORTANT NOTE" : 309Because of limitations imposed by the conventional 310disk interface provided by the BIOS, 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). When a 314.Dq Disk error 0x1 315is reported by the second-stage bootstrap, it generally means that this 316requirement has not been adhered to. 317.Sh BUGS 318The 319.Xr disklabel 5 320format used by this version of 321.Bx 322is quite 323different from that of other architectures. 324.Pp 325Due to space constraints, the keyboard probe initiated by the 326.Fl P 327option is simply a test that the BIOS has detected an 328.Dq extended 329keyboard. If an 330.Dq XT/AT 331keyboard (with no F11 and F12 keys, etc.) is attached, the probe will 332fail. 333.Pp 334Some features are not yet documented. 335