1.\" $NetBSD: boot.8,v 1.58 2011/05/31 03:43:47 uebayasi Exp $ 2.\" 3.\" Copyright (c) 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" This code is derived from software written and contributed 7.\" to Berkeley by William Jolitz. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. Neither the name of the University nor the names of its contributors 18.\" may be used to endorse or promote products derived from this software 19.\" without specific prior written permission. 20.\" 21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" SUCH DAMAGE. 32.\" 33.\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 34.\" 35.Dd May 26, 2011 36.Dt BOOT 8 i386 37.Os 38.Sh NAME 39.Nm boot 40.Nd 41system bootstrapping procedures 42.Sh DESCRIPTION 43.Tn IA-32 44computers 45.Po 46the 47.Tn IBM PC 48and its clones 49.Pc 50that can run 51.Nx Ns /i386 52can use any of the following boot procedures, depending on what the hardware and 53.Tn BIOS 54support: 55.Pp 56.Bl -tag -width "pxeboot(8)" 57.It boot 58bootstrap 59.Nx 60from the system 61.Tn BIOS 62.It Xr dosboot 8 63bootstrap 64.Nx 65from 66.Tn MS-DOS 67.It Xr w95boot 8 68bootstrap 69.Nx 70from 71.Tn Windows 95 72.It Xr pxeboot 8 73network bootstrap 74.Nx 75from a 76.Tn TCP/IP 77.Tn LAN 78with 79.Tn DHCP , 80.Tn TFTP , 81and 82.Tn NFS . 83.El 84.Ss Power fail and crash recovery 85Normally, the system will reboot itself at power-up or after crashes. 86An automatic consistency check of the file systems will be performed, 87and unless this fails, the system will resume multi-user operations. 88.Ss Cold starts 89The 386 90.Tn "PC AT" 91clones attempt to boot the floppy disk drive A (otherwise known as drive 920) first, and failing that, attempt to boot the hard disk C (otherwise 93known as hard disk controller 1, drive 0). 94The 95.Nx 96bootblocks are loaded and started either by the 97.Tn BIOS , 98or by a boot selector program (such as OS-BS, BOOTEASY, the OS/2 Boot Menu or 99.Nx Ns 's 100.No boot-selecting 101master boot record - see 102.Xr mbr 8 ) . 103.Ss Normal Operation 104Once running, a banner similar to the following will appear: 105.Bd -unfilled -offset indent 106\*[Gt]\*[Gt] NetBSD BIOS Boot, revision 3.0 107\*[Gt]\*[Gt] (user@buildhost, builddate) 108\*[Gt]\*[Gt] Memory: 637/15360 k 109Press return to boot now, any other key for boot menu 110booting hd0a:netbsd - starting in 5 111.Ed 112.Pp 113After a countdown, the system image listed will be loaded. 114In the example above, it will be 115.Dq Li hd0a:netbsd 116which is the file 117.Nm netbsd 118on partition 119.Dq a 120of the 121.Nx 122.Tn MBR 123partition of the first hard disk known to the 124.Tn BIOS 125.Po 126which is an 127.Tn IDE 128or similar device - see the 129.Sx BUGS 130section 131.Pc . 132.Pp 133Pressing a key within the time limit, or before the boot program starts, will 134enter interactive mode. 135When using a short or 0 timeout, it is often useful to interrupt the boot 136by holding down a shift key, as some BIOSes and BIOS extensions will drain the 137keystroke buffer at various points during POST. 138.Pp 139If present, the file 140.Pa /boot.cfg 141will be used to configure the behaviour of the boot loader including 142setting the timeout, choosing a console device, altering the banner 143text and displaying a menu allowing boot commands to be easily chosen. 144See 145.Xr boot.cfg 5 . 146.Pp 147The 148.Nx Ns /i386 149boot loader can boot a kernel using either the native 150.Nx 151boot protocol, or the 152.Dq multiboot 153protocol (which is compatible with some other operating systems). 154In the native 155.Nx 156boot protocol, options are passed from the boot loader 157to the kernel via flag bits in the 158.Va boothowto 159variable (see 160.Xr boothowto 9 ) . 161In the multiboot protocol, options are passed from the boot loader 162to the kernel as strings. 163.Ss Diagnostic Output 164If the first stage boot fails to load the boot, it will print a terse 165message indicating the reason for the failure. 166The possible error messages and their cause are listed in 167.Xr mbr 8 . 168.Pp 169If the first stage boot succeeds, the banner will be shown and the 170error messages should be self-explanatory. 171.Ss Interactive mode 172In interactive mode, the boot loader will present a prompt, allowing 173input of these commands: 174.\" NOTE: much of this text is duplicated in the MI boot.8. 175.\" Some of it is 176.\" also duplicated in the i386-specific dosboot.8 and pxeboot.8; 177.\" please try to keep all relevant files synchronized. 178.Bl -tag -width 04n -offset 04n 179.It Ic boot Oo Va device : Ns Oc Oo Va filename Oc Oo Fl 1234abcdmqsvxz Oc 180The default 181.Va device 182will be set to the disk that the boot loader was 183loaded from. 184To boot from an alternate disk, the full name of the device should 185be given at the prompt. 186.Va device 187is of the form 188.Xo Va xd 189.Op Va N Ns Op Va x 190.Xc 191where 192.Va xd 193is the device from which to boot, 194.Va N 195is the unit number, and 196.Va x 197is the partition letter. 198.Pp 199The following list of supported devices may vary from installation to 200installation: 201.Pp 202.Bl -hang -compact 203.It hd 204Hard disks as numbered by the BIOS. 205This includes ST506, IDE, ESDI, RLL disks on a WD100[2367] or 206lookalike controller(s), and SCSI disks 207on SCSI controllers recognized by the BIOS. 208.It fd 209Floppy drives as numbered by the BIOS. 210.El 211.Pp 212The default 213.Va filename 214is 215.Pa netbsd ; 216if the boot loader fails to successfully 217open that image, it then tries 218.Pa netbsd.gz 219(expected to be a kernel image compressed by gzip), followed by 220.Pa netbsd.old , 221.Pa netbsd.old.gz , 222.Pa onetbsd , 223and finally 224.Pa onetbsd.gz . 225Alternate system images can be loaded by just specifying the name of the image. 226.Pp 227Options are: 228.Bl -tag -width xxx 229.It Fl 1 230Sets the machine-dependent flag 231.Sy RB_MD1 232in 233.Va boothowto . 234In 235.Nx Ns /i386 , 236this disables multiprocessor boot; 237the kernel will boot in uniprocessor mode. 238.It Fl 2 239Sets the machine-dependent flag 240.Sy RB_MD2 241in 242.Va boothowto . 243In 244.Nx Ns /i386 , 245this disables ACPI. 246.It Fl 3 247Sets the machine-dependent flag 248.Sy RB_MD3 249in 250.Va boothowto . 251In 252.Nx Ns /i386 , 253this has no effect. 254.It Fl 4 255Sets the machine-dependent flag 256.Sy RB_MD4 257in 258.Va boothowto . 259In 260.Nx Ns /i386 , 261this has no effect. 262.It Fl a 263Sets the 264.Sy RB_ASKNAME 265flag in 266.Va boothowto . 267This causes the kernel to prompt for the root file system device, 268the system crash dump device, and the path to 269.Xr init 8 . 270.It Fl b 271Sets the 272.Sy RB_HALT 273flag in 274.Va boothowto . 275This causes subsequent reboot attempts to halt instead of rebooting. 276.It Fl c 277Sets the 278.Sy RB_USERCONF 279flag in 280.Va boothowto . 281This causes the kernel to enter the 282.Xr userconf 4 283device configuration manager as soon as possible during the boot. 284.Xr userconf 4 285allows devices to be enabled or disabled, and allows device locators 286(such as hardware addresses or bus numbers) 287to be modified before the kernel attempts to attach the devices. 288.It Fl d 289Sets the 290.Sy RB_KDB 291flag in 292.Va boothowto . 293Requests the kernel to enter debug mode, in which it 294waits for a connection from a kernel debugger; see 295.Xr ddb 4 . 296.It Fl m 297Sets the 298.Sy RB_MINIROOT 299flag in 300.Va boothowto . 301Informs the kernel that a mini-root file system is present in memory. 302.It Fl q 303Sets the 304.Sy AB_QUIET 305flag in 306.Va boothowto . 307Boot the system in quiet mode. 308.It Fl s 309Sets the 310.Sy RB_SINGLE 311flag in 312.Va boothowto . 313Boot the system in single-user mode. 314.It Fl v 315Sets the 316.Sy AB_VERBOSE 317flag in 318.Va boothowto . 319Boot the system in verbose mode. 320.It Fl x 321Sets the 322.Sy AB_DEBUG 323flag in 324.Va boothowto . 325Boot the system with debug messages enabled. 326.It Fl z 327Sets the 328.Sy AB_SILENT 329flag in 330.Va boothowto . 331Boot the system in silent mode. 332.El 333.It Ic consdev Va dev 334Immediately switch the console to the specified device 335.Va dev 336and reprint the banner. 337.Va dev 338must be one of 339.\" .Bl -item -width com[0123]kbd -offset indent -compact 340.Ar pc , com0 , com1 , com2 , 341.Ar com3 , com0kbd , com1kbd , com2kbd , 342.Ar com3kbd , 343or 344.Ar auto . 345See 346.Sx Console Selection Policy 347in 348.Xr boot_console 8 . 349.It Ic dev Op Va device 350Set the default drive and partition for subsequent filesystem 351operations. 352Without an argument, print the current setting. 353.Va device 354is of the form specified in 355.Cm boot . 356.It Ic help 357Print an overview about commands and arguments. 358.It Ic load Va module Op Ar arguments 359Load the specified kernel 360.Va module , 361and pass it the specified 362.Ar arguments . 363If the module name is not an absolute path, 364.Pa /stand/ Xo Ns 365.Aq Sy arch Ns 366.Pa / Ns 367.Aq Sy osversion Ns 368.Pa /modules/ Ns 369.Aq Sy module Ns 370.Pa / Ns 371.Aq Sy module Ns 372.Pa .kmod 373.Xc 374is used. 375Possible used of the 376.Ic load 377command include loading a memory disk image before booting a kernel, 378or loading a 379.Tn Xen 380DOM0 kernel before booting the 381.Tn Xen 382hypervisor. 383See 384.Xr boot.cfg 5 385for examples. 386.Pp 387In addition to the 388.Cm boot 389options specified above, the DOM0 kernel accepts 390.Po Ar arguments 391being separated with spaces 392.Pc : 393.Bl -tag -width xxx 394.It Ic bootdev Ns = Ns Ar dev Po or Ic root Ns = Ns Ar dev Pc 395Override the default boot device. 396.Ar dev 397can be a unit name 398.Po Dq wd0 399.Pc , 400or an interface name 401.Po Dq bge0 , 402.Dq wm0 , 403.Ns ... 404.Pc , 405for cases where the root file system has to be loaded 406from network (see the 407.Sx BUGS 408section in 409.Xr pxeboot 8 ) . 410.It Ic console Ns = Ns Ar dev 411Console used by DOM0 kernel during boot. 412.Ar dev 413accepts the same values as the ones given for the 414.Cm consdev 415command. 416See 417.Sx Console Selection Policy 418in 419.Xr boot_console 8 . 420.It Xo Ic ip Ns = Ns 421.Ar my_ip Ns : Ns Ar serv_ip Ns : Ns Ar gw_ip Ns : Ns 422.Ar mask Ns : Ns Ar host Ns : Ns Ar iface 423.Xc 424Specify various parameters for a network boot (IPs are in 425dot notation), 426each one separated by a colon: 427.Bl -tag -width xxxxxxx 428.It Va my_ip 429address of the host 430.It Va serv_ip 431address of the NFS server 432.It Va gw_ip 433address of the gateway 434.It Va mask 435network mask 436.It Va host 437address of the host 438.It Va iface 439interface 440.Po e.g. Dq xennet0 441or 442.Dq eth0 443.Pc 444.El 445.It Ic nfsroot Ns = Ns Ar address Ns : Ns Ar rootpath 446Boot the system with root on NFS. 447.Ar address 448is the address of the NFS server, and 449.Ar rootpath 450is the remote mount point for the root file system. 451.It Ic pciback.hide Ns = Ns Ar pcidevs 452Pass a list of PCI IDs for use with the PCI backend driver, 453.Xr pciback 4 . 454.Ar pcidevs 455is formed of multiple IDs (in bus:device.function notation), 456each ID being surrounded with brackets. 457PCI domain IDs are currently ignored. 458See 459.Xr pciback 4 . 460.El 461.It Ic load_mods Va mods_path_pattern 462Load modules specified by pattern like /some_path/mod*. 463.It Ic ls Op Pa path 464Print a directory listing of 465.Pa path , 466containing inode number, filename, and file type. 467.Pa path 468can contain a device specification. 469.It Ic modules Bro Ar on | off | enabled | disabled Brc 470The values 471.Ar enabled , on 472will enable module loading for 473.Cm boot 474and 475.Cm multiboot , 476whereas 477.Ar disabled , off 478will turn off the feature. 479.It Ic multiboot Va kernel Op Ar arguments 480Boot the specified 481.Va kernel , 482using the 483.Dq multiboot 484protocol instead of the native 485.Nx 486boot protocol. 487The 488.Va kernel 489is specified in the same way as with the 490.Ic boot 491command. 492.Pp 493The multiboot protocol may be used in the following cases: 494.Bl -tag -width indent 495.It Nx Ns / Ns Xen No kernels 496The 497.Tn Xen 498DOM0 kernel must be loaded as a module using the 499.Ic load 500command, and the 501.Tn Xen 502hypervisor must be booted using the 503.Ic multiboot 504command. 505Options for the DOM0 kernel (such as 506.Dq -s 507for single user mode) must be passed as options to the 508.Ic load 509command. 510Options for the hypervisor (such as 511.Dq dom0_mem=256M 512to reserve 256 MB of memory for DOM0) 513must be passed as options to the 514.Ic multiboot 515command. 516See 517.Xr boot.cfg 5 518for examples on how to boot 519.Nx Ns / Ns Xen. 520.It Nx No multiboot kernels 521A 522.Nx 523kernel that was built with 524.Cd options MULTIBOOT 525(see 526.Xr multiboot 8 ) 527may be booted with either the 528.Ic boot 529or 530.Ic multiboot 531command, passing the same 532.Ar arguments 533in either case. 534.It Non- Ns Nx No kernels 535A kernel for a 536.No non- Ns Nx 537operating system that expects to be booted using the 538multiboot protocol (such as by the GNU 539.Dq GRUB 540boot loader) 541may be booted using the 542.Ic multiboot 543command. 544See the foreign operating system's documentation for the available 545.Ar arguments . 546.El 547.It Ic quit 548Reboot the system. 549.It Ic userconf Va command 550Pass the 551.Va command 552to 553.Xr userconf 4 554at boot time . 555These commands are processed before the interactive 556.Xr userconf 4 557shell is executed, if requested . 558.It Ic vesa Bro Va modenum | Ar on | off | enabled | disabled | list Brc 559Initialise the video card to the specified resolution and bit depth. 560The 561.Va modenum 562should be in the form of 563.Ar 0x100 , 800x600 , 800x600x32 . 564The values 565.Ar enabled , on 566put the display into the default mode, and 567.Ar disabled , off 568returns the display into standard vga mode. 569The value 570.Ar list 571lists all supported modes. 572.El 573.Pp 574In an emergency, the bootstrap methods described in the 575.Nx 576installation notes for the i386 architecture 577can be used to boot from floppy or other media, 578or over the network. 579.Sh FILES 580.Bl -tag -width /usr/mdec/bootxx_fstype -compact 581.It Pa /boot 582boot program code loaded by the primary bootstrap 583.It Pa /boot.cfg 584optional configuration file 585.It Pa /netbsd 586system code 587.It Pa /netbsd.gz 588gzip-compressed system code 589.It Pa /usr/mdec/boot 590master copy of the boot program (copy to /boot) 591.It Pa /usr/mdec/bootxx_fstype 592primary bootstrap for filesystem type fstype, copied to the start of 593the 594.Nx 595partition by 596.Xr installboot 8 . 597.El 598.Sh SEE ALSO 599.Xr ddb 4 , 600.Xr pciback 4 , 601.Xr userconf 4 , 602.Xr boot.cfg 5 , 603.Xr boot_console 8 , 604.Xr dosboot 8 , 605.Xr halt 8 , 606.Xr installboot 8 , 607.Xr mbr 8 , 608.Xr multiboot 8 , 609.Xr pxeboot 8 , 610.Xr reboot 8 , 611.Xr shutdown 8 , 612.Xr w95boot 8 , 613.Xr boothowto 9 614.Sh BUGS 615The kernel file name must be specified before, not after, the boot options. 616Any 617.Ar filename 618specified after the boot options, e.g.: 619.Pp 620.Bd -unfilled -offset indent -compact 621.Cm boot -d netbsd.test 622.Ed 623.Pp 624is ignored, and the default kernel is booted. 625.Pp 626Hard disks are always accessed by 627.Tn BIOS 628functions. 629Unit numbers are 630.Tn BIOS 631device numbers which might differ from numbering in the 632.Nx 633kernel or physical parameters 634.Po 635e.g., 636.Tn SCSI 637slave numbers 638.Pc . 639There isn't any distinction between 640.Dq sd 641and 642.Dq wd 643devices at the bootloader level. 644This is less a bug of the bootloader code than 645a shortcoming of the PC architecture. 646The default disk device's name printed in the starting message 647is derived from the 648.Dq type 649field of the 650.Nx 651disklabel (if it is a hard disk). 652