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