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