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 aCcDdghPrsv 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 BSD portion of the disk. See 148.Xr disklabel 8 . 149By convention, only partition 150.Ql a 151contains a bootable image. If sliced disks are used 152.Pq Dq fdisk partitions , 153any slice can be booted from, with the default being the active slice 154or, otherwise, the first 155.Fx 156slice. 157.It Ar filename 158The pathname of the file to boot (relative to the root directory 159on the specified partition). Defaults to 160.Pa /kernel . 161Symbolic links are not supported (hard links are). 162.It Fl acCdDghPrsv 163Boot flags: 164.Pp 165.Bl -tag -width "-CXX" -compact 166.It Fl a 167during kernel initialization, 168ask for the device to mount as the root file system. 169.It Fl C 170boot from CDROM. 171.It Fl c 172run UserConfig to modify hardware parameters for the loaded 173kernel. If the kernel was built with one of 174.Dv USERCONFIG , INTRO_USERCONFIG , VISUAL_USERCONFIG 175options, 176remain in UserConfig regardless of any 177.Ic quit 178commands present in the script. 179.It Fl D 180toggle single and dual console configurations. In the single 181configuration the console will be either the internal display 182or the serial port, depending on the state of the 183.Fl h 184option below. In the dual console configuration, 185both the internal display and the serial port will become the console 186at the same time, regardless of the state of the 187.Fl h 188option. However, the dual console configuration takes effect only during 189the boot prompt. Once the kernel is loaded, the console specified 190by the 191.Fl h 192option becomes the only console. 193.It Fl d 194enter the DDB kernel debugger 195.Pq see Xr ddb 4 196as early as possible in kernel initialization. 197.It Fl g 198use the GDB remote debugging protocol. 199.It Fl h 200toggle internal and serial consoles. You can use this to switch 201console devices. For 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. Alternatively, if you boot from the serial port, 206you can use this option to force the kernel to use the internal display 207as the console instead. 208The serial port driver 209.Xr sio 4 210has a flag to override this option. 211If that flag is set, the serial port will always be used as the console, 212regardless of the 213.Fl h 214option described here. See the man page for 215.Xr sio 4 216for more details. 217.It Fl P 218probe the keyboard. If no keyboard is found, the 219.Fl D 220and 221.Fl h 222options are automatically set. 223.It Fl r 224use the statically configured default for the device containing the 225root file system 226.Pq see Xr config 8 . 227Normally, the root file system is on the device 228that the kernel was loaded from. 229.It Fl s 230boot into single-user mode; if the console is marked as 231.Dq insecure 232.Pq see Xr ttys 5 , 233the root password must be entered. 234.It Fl v 235be verbose during device probing (and later). 236.El 237.El 238.El 239.Pp 240You may put a BIOS drive number, a controller type, a unit number, 241a partition, a kernel file name, and any valid option in 242.Pa /boot.config 243to set defaults. Enter them in one line just as you type at the 244.Ql boot: 245prompt. 246.Sh FILES 247.Bl -tag -width /boot/loader -compact 248.It Pa /boot.config 249parameters for the boot blocks (optional) 250.It Pa /boot/boot1 251first stage bootstrap file 252.It Pa /boot/boot2 253second stage bootstrap file 254.It Pa /boot/loader 255third stage bootstrap 256.It Pa /kernel 257default kernel 258.It Pa /kernel.old 259typical non-default kernel (optional) 260.El 261.Sh SEE ALSO 262.Xr ddb 4 , 263.Xr ttys 5 , 264.Xr boot0cfg 8 , 265.Xr btxld 8 , 266.Xr config 8 , 267.Xr disklabel 8 , 268.Xr halt 8 , 269.Xr loader 8 , 270.Xr reboot 8 , 271.Xr shutdown 8 272.Sh DIAGNOSTICS 273When disk-related errors occur, these are reported by the second-stage 274bootstrap using the same error codes returned by the BIOS, for example 275.Dq Disk error 0x1 (lba=0x12345678) . 276Here is a partial list of these error codes: 277.Pp 278.Bl -tag -width "0x80" -compact 279.It 0x1 280Invalid argument 281.It 0x2 282Address mark not found 283.It 0x4 284Sector not found 285.It 0x8 286DMA overrun 287.It 0x9 288DMA attempt across 64K boundary 289.It 0xc 290Invalid media 291.It 0x10 292Uncorrectable CRC/ECC error 293.It 0x20 294Controller failure 295.It 0x40 296Seek failed 297.It 0x80 298Timeout 299.El 300.Pp 301.Sy "IMPORTANT NOTE" : 302Because of limitations imposed by the conventional 303disk interface provided by the BIOS, all boot-related files and 304structures (including the kernel) that need to be accessed during the 305boot phase must reside on the disk at or below cylinder 1023 (as the 306BIOS understands the geometry). When a 307.Dq Disk error 0x1 308is reported by the second-stage bootstrap, it generally means that this 309requirement has not been adhered to. 310.Sh BUGS 311The 312.Xr disklabel 5 313format used by this version of 314.Bx 315is quite 316different from that of other architectures. 317.Pp 318Due to space constraints, the keyboard probe initiated by the 319.Fl P 320option is simply a test that the BIOS has detected an 321.Dq extended 322keyboard. If an 323.Dq XT/AT 324keyboard (with no F11 and F12 keys, etc.) is attached, the probe will 325fail. 326.Pp 327Some features are not yet documented. 328