1.\" $NetBSD: boot.8,v 1.30 2023/05/14 09:03:02 riastradh 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 15, 2020 36.Dt BOOT 8 x86 37.Os 38.Sh NAME 39.Nm boot 40.Nd 41system bootstrapping procedures 42.Sh DESCRIPTION 43Intel Architecture, 32-bit (IA-32) computers (the 44.Tn IBM PC 45and its clones) 46that can run 47.Nx Ns /i386 48or 49.Nx Ns /amd64 50can use any of the following boot procedures, depending on what the hardware and 51.Tn BIOS 52support: 53.Bl -tag -width "x86/pxeboot(8)" 54.It boot 55bootstrap 56.Nx 57from the system 58.Tn BIOS 59.It efiboot 60bootstrap 61.Nx 62from the system 63.Tn UEFI 64.It Xr x86/dosboot 8 65bootstrap 66.Nx 67from 68.Tn MS-DOS 69.It Xr x86/pxeboot 8 70network bootstrap 71.Nx 72from a 73.Tn TCP/IP 74.Tn LAN 75with 76.Tn DHCP , 77.Tn TFTP , 78and 79.Tn NFS . 80.El 81.Ss Power fail and crash recovery 82Normally, the system will reboot itself at power-up or after crashes. 83An automatic consistency check of the file systems will be performed, 84and unless this fails, the system will resume multi-user operations. 85.Ss Cold starts 86The 386 87.Tn "PC AT" 88clones attempt to boot the floppy disk drive A (otherwise known as drive 890) first, and failing that, attempt to boot the hard disk C (otherwise 90known as hard disk controller 1, drive 0). 91The 92.Nx 93bootblocks are loaded and started either by the 94.Tn BIOS , 95or by a boot selector program (such as OS-BS, BOOTEASY, the OS/2 Boot Menu or 96.Nx Ns 's 97.No boot-selecting 98master boot record - see 99.Xr x86/mbr 8 ) . 100.Ss Normal Operation 101Once running, a banner similar to the following will appear: 102.Bd -literal -offset indent 103>> NetBSD BIOS Boot, revision 3.0 104>> (user@buildhost, builddate) 105>> Memory: 637/15360 k 106Press return to boot now, any other key for boot menu 107booting hd0a:netbsd - starting in 5 108.Ed 109.Pp 110After a countdown, the system image listed will be loaded. 111In the example above, it will be 112.Dq Li hd0a:netbsd 113which is the file 114.Pa /netbsd 115on partition 116.Dq Li a 117of the 118.Nx 119.Tn MBR 120partition of the first hard disk known to the 121.Tn BIOS 122.Po 123which is an 124.Tn IDE 125or similar device \(em see the 126.Sx BUGS 127section 128.Pc . 129.Pp 130Pressing a key within the time limit, or before the boot program starts, will 131enter interactive mode. 132When using a short or 0 timeout, it is often useful to interrupt the boot 133by holding down a shift key, as some BIOSes and BIOS extensions will drain the 134keystroke buffer at various points during POST. 135.Pp 136If present, the file 137.Pa /boot.cfg 138will be used to configure the behaviour of the boot loader including 139setting the timeout, choosing a console device, altering the banner 140text and displaying a menu allowing boot commands to be easily chosen. 141See 142.Xr boot.cfg 5 . 143.Ss Boot Protocol 144The 145.Nx Ns /x86 146boot loader can boot a kernel using either the native 147.Nx 148boot protocol, or the 149.Dq multiboot 150protocol (which is compatible with some other operating systems). 151In the native 152.Nx 153boot protocol, options are passed from the boot loader 154to the kernel via flag bits in the 155.Va boothowto 156variable (see 157.Xr boothowto 9 ) . 158In the multiboot protocol, options are passed from the boot loader 159to the kernel as strings. 160.Ss Diagnostic Output 161If the first stage boot fails to load the boot, it will print a terse 162message indicating the reason for the failure. 163The possible error messages and their cause are listed in 164.Xr x86/mbr 8 . 165.Pp 166If the first stage boot succeeds, the banner will be shown and the 167error messages should be self-explanatory. 168.Ss Interactive mode 169In interactive mode, the boot loader will present a prompt, allowing 170input of these commands: 171.\" NOTE: much of this text is duplicated in the MI boot.8. 172.\" Some of it is 173.\" also duplicated in the x86-specific x86/dosboot.8 and x86/pxeboot.8; 174.\" please try to keep all relevant files synchronized. 175.Bl -tag -width 04n -offset 04n 176.It Ic boot Oo Ar device Ns Ic \&: Oc Ns Oo Ar filename Oc Oo Fl 1234abcdmqsvxz Oc 177The default 178.Ar device 179will be set to the disk from which the boot loader was loaded. 180The partition is set to the first match in this list: 181.Bl -enum 182.It 183The first 184.Xr gpt 8 185partition with the 186.Va bootme 187attribute set. 188.It 189The partition from which the boot loader was loaded from, if that 190can be detected. 191.It 192The first partition with a file system that could be bootable. 193.It 194The first partition. 195.El 196.Pp 197To boot from an alternate disk, the full name of the device should 198be given at the prompt. 199.Ar device 200is of the form 201.Li NAME= Ns Ar partition_label 202when booting from a 203.Xr gpt 8 204partitioned disk. 205Otherwise, the syntax is 206.Xo Ar xd\^ Ns 207.Op Ar N\^ Ns Op Ar x 208.Xc 209where 210.Ar xd 211is the device from which to boot, 212.Ar N 213is the unit number, and 214.Ar x 215is the partition letter. 216.Pp 217In the latter case, the following list of supported devices may 218vary from installation to installation: 219.Bl -hang 220.It hd 221Hard disks as numbered by the BIOS. 222This includes ST506, IDE, ESDI, RLL disks on a WD100[2367] or 223lookalike controller(s), and SCSI disks 224on SCSI controllers recognized by the BIOS. 225.It fd 226Floppy drives as numbered by the BIOS. 227.It cd 228CD-ROM drives as numbered by the BIOS. 229.It raid 230RAIDframe configured from hard disks recognized by the BIOS. 231Only RAID level 1 sets are supported by bootstrap code. 232If the RAID is partitioned, the first partition is used, or the 233first 234.Xr gpt 8 235partition that has the 236.Va bootme 237attribute set. 238Inner RAIDframe partitions can also be given to the 239.Ic dev 240command using he 241.Li NAME= Ns Ar partition_label 242syntax. 243.El 244.Pp 245The default 246.Va filename 247is 248.Pa netbsd ; 249if the boot loader fails to successfully 250open that image, it then tries 251.Pa netbsd.gz 252(expected to be a kernel image compressed by gzip), followed by 253.Pa onetbsd , 254.Pa onetbsd.gz , 255.Pa netbsd.old , 256and finally 257.Pa netbsd.old.gz . 258Alternate system images can be loaded by just specifying the name of the image. 259.Pp 260Options are: 261.Bl -tag -width xxx 262.It Fl 1 263Sets the machine-dependent flag 264.Dv RB_MD1 265in 266.Va boothowto . 267In 268.Nx Ns /x86 , 269this disables multiprocessor boot; 270the kernel will boot in uniprocessor mode. 271.It Fl 2 272Sets the machine-dependent flag 273.Dv RB_MD2 274in 275.Va boothowto . 276In 277.Nx Ns /x86 , 278this disables ACPI. 279.It Fl 3 280Sets the machine-dependent flag 281.Dv RB_MD3 282in 283.Va boothowto . 284In 285.Nx Ns /amd64 , 286this disables SVS. 287.It Fl 4 288Sets the machine-dependent flag 289.Dv RB_MD4 290in 291.Va boothowto . 292In 293.Nx Ns /x86 , 294this has no effect. 295.It Fl a 296Sets the 297.Dv RB_ASKNAME 298flag in 299.Va boothowto . 300This causes the kernel to prompt for the root file system device, 301the system crash dump device, and the path to 302.Xr init 8 . 303.It Fl b 304Sets the 305.Dv RB_HALT 306flag in 307.Va boothowto . 308This causes subsequent reboot attempts to halt instead of rebooting. 309.It Fl c 310Sets the 311.Dv RB_USERCONF 312flag in 313.Va boothowto . 314This causes the kernel to enter the 315.Xr userconf 4 316device configuration manager as soon as possible during the boot. 317.Xr userconf 4 318allows devices to be enabled or disabled, and allows device locators 319(such as hardware addresses or bus numbers) 320to be modified before the kernel attempts to attach the devices. 321.It Fl d 322Sets the 323.Dv RB_KDB 324flag in 325.Va boothowto . 326Requests the kernel to enter debug mode, in which it 327waits for a connection from a kernel debugger; see 328.Xr ddb 4 . 329.It Fl m 330Sets the 331.Dv RB_MINIROOT 332flag in 333.Va boothowto . 334Informs the kernel that a mini-root file system is present in memory. 335.It Fl q 336Sets the 337.Dv AB_QUIET 338flag in 339.Va boothowto . 340Boot the system in quiet mode. 341.It Fl s 342Sets the 343.Dv RB_SINGLE 344flag in 345.Va boothowto . 346Boot the system in single-user mode. 347.It Fl v 348Sets the 349.Dv AB_VERBOSE 350flag in 351.Va boothowto . 352Boot the system in verbose mode. 353.It Fl x 354Sets the 355.Dv AB_DEBUG 356flag in 357.Va boothowto . 358Boot the system with debug messages enabled. 359.It Fl z 360Sets the 361.Dv AB_SILENT 362flag in 363.Va boothowto . 364Boot the system in silent mode. 365.El 366.It Ic consdev Ar dev\| Ns Oo Ns Ic \&, Ns Ar speed Oc 367[Not available for 368.Xr x86/dosboot 8 ] 369Immediately switch the console to the specified device 370.Ar dev 371and reprint the banner. 372.Ar dev 373must be one of 374.\" .Bl -item -width com[0123]kbd -offset indent -compact 375.Li pc , com0 , com1 , com2 , 376.Li com3 , com0kbd , com1kbd , com2kbd , 377.Li com3kbd , 378or 379.Li auto . 380See 381.Sx Console Selection Policy 382in 383.Xr x86/boot_console 8 . 384.Pp 385A 386.Ar speed 387for the serial port is optional and defaults to 9600. 388If a value of zero is specified, then the current baud rate (set by the 389BIOS) will be used. 390Setting the 391.Ar speed 392with the 393.Li pc 394device is not possible. 395.It Ic dev Op Ar device 396Set the default drive and partition for subsequent file system 397operations. 398Without an argument, print the current setting. 399.Ar device 400is of the form specified in 401.Ic boot . 402.It Ic devpath 403[Only available for UEFI boot] Dump UEFI device paths. 404.It Ic efivar 405[Only available for UEFI boot] Dump UEFI environment variables from NVRAM. 406.It Ic fs Ar file 407[Only available for BIOS and UEFI boot] 408Load a file system image from the specified 409.Ar file , 410and request the kernel to use it as the root file system. 411The 412.Xr makefs 8 413utility may be used to create suitable file system images. 414.It Ic gop Op Va mode_index 415[Only available for UEFI boot] Without argument, list the available 416video modes. If an argument is given, select a video mode. 417.It Ic help 418Print an overview about commands and arguments. 419.It Ic load Ar module Op Ar arguments 420[Not available for 421.Xr x86/dosboot 8 ] 422Load the specified kernel 423.Ar module , 424and pass it the specified 425.Ar arguments . 426If the module name is not an absolute path, 427.Bd -ragged -offset indent -compact 428.Pa /stand/ Ns Xo Ns 429.Aq Ar arch Ns 430.Pa / Ns 431.Aq Ar osversion Ns 432.Pa /modules/ Ns 433.Aq Ar module Ns 434.Pa / Ns 435.Aq Ar module Ns 436.Pa .kmod 437.Xc 438.Ed 439is used. 440Possible uses of the 441.Ic load 442command include loading a memory disk image before booting a kernel, 443or loading a 444.Tn Xen 445DOM0 kernel before booting the 446.Tn Xen 447hypervisor. 448See 449.Xr boot.cfg 5 450for examples. 451.Pp 452In addition to the 453.Cm boot 454options specified above, the 455.Tn Xen 456DOM0 kernel accepts 457.Po Ar arguments 458being separated with spaces 459.Pc : 460.Bl -tag -width xxx 461.It Ic bootdev Ns = Ns Ar dev Po or Ic root Ns = Ns Ar dev Pc 462Override the default boot device. 463.Ar dev 464is of the form 465.Li NAME= Ns Ar partition_label 466for 467.Xr gpt 8 468partitioned disks. 469It can also be a unit name 470.Pq Ql wd0 , 471or an interface name 472.Po Ql bge0 , 473.Ql wm0 , 474\&... 475.Pc 476for cases where the root file system has to be loaded 477from network (see the 478.Sx BUGS 479section in 480.Xr x86/pxeboot 8 ) . 481.It Ic console Ns = Ns Ar dev 482Console used by DOM0 kernel during boot. 483.Ar dev 484accepts the same values as the ones given for the 485.Cm consdev 486command. 487See 488.Sx Console Selection Policy 489in 490.Xr x86/boot_console 8 . 491.It Xo Ic ip Ns Li \&= Ns 492.Ar my_ip Ns Li \&: Ns Ar serv_ip Ns Li \&: Ns Ar gw_ip Ns Li \&: Ns 493.Ar mask Ns Li \&: Ns Ar host Ns Li \&: Ns Ar iface 494.Xc 495Specify various parameters for a network boot (IPs are in 496dot notation), 497each one separated by a colon: 498.Bl -tag -width xxxxxxx 499.It Ar my_ip 500address of the host 501.It Ar serv_ip 502address of the NFS server 503.It Ar gw_ip 504address of the gateway 505.It Ar mask 506network mask 507.It Ar host 508address of the host 509.It Ar iface 510interface 511.Po e.g., Dq Li xennet0 512or 513.Dq Li eth0 514.Pc 515.El 516.It Ic nfsroot Ns = Ns Ar address Ns Li \&: Ns Ar rootpath 517Boot the system with root on NFS. 518.Ar address 519is the address of the NFS server, and 520.Ar rootpath 521is the remote mount point for the root file system. 522.It Ic pciback.hide Ns = Ns Ar pcidevs 523Pass a list of PCI IDs for use with the PCI backend driver, 524.Xr pciback 4 . 525.Ar pcidevs 526is formed of multiple IDs (in 527.Ar bus Ns Li \&: Ns Ar device Ns Li \&. Ns Ar function 528notation), 529each ID being surrounded with brackets. 530PCI domain IDs are currently ignored. 531See 532.Xr pciback 4 . 533.El 534.It Ic ls Op Ar path 535[Not available for 536.Xr x86/pxeboot 8 ] 537Print a directory listing of 538.Ar path , 539containing inode number, filename, and file type. 540.Ar path 541can contain a device specification. 542.It Ic memmap 543[Only available for UEFI boot] Dump UEFI memory map. 544.It Ic menu 545[Only available for BIOS and UEFI boot] 546Display the boot menu and initiate a countdown, 547similarly to what would have happened if interactive mode 548had not been entered. 549.It Ic modules Bro Li \^on \ 550 No \(or Li off \ 551 No \(or Li enabled \ 552 No \(or Li disabled\^ \ 553 Brc 554[Not available for 555.Xr x86/dosboot 8 ] 556The values 557.Ql enabled , 558.Ql on 559will enable module loading for 560.Ic boot 561and 562.Ic multiboot , 563whereas 564.Ql disabled , 565.Ql off 566will turn off the feature. 567.It Ic mode Va fstype 568[Only available for 569.Xr x86/dosboot 8 ] 570Switch file system type; 571.Va fstype 572should be one of 573.Ar dos 574or 575.Ar ufs . 576.It Ic multiboot Ar kernel Op Ar arguments 577[Not available for 578.Xr x86/dosboot 8 ] 579Boot the specified 580.Ar kernel , 581using the 582.Dq multiboot 583protocol instead of the native 584.Nx 585boot protocol. 586The 587.Ar kernel 588is specified in the same way as with the 589.Ic boot 590command. 591.Pp 592The multiboot protocol may be used in the following cases: 593.Bl -tag -width indent 594.It Nx Ns / Ns Xen No kernels 595The 596.Tn Xen 597DOM0 kernel must be loaded as a module using the 598.Ic load 599command, and the 600.Tn Xen 601hypervisor must be booted using the 602.Ic multiboot 603command. 604Options for the DOM0 kernel (such as 605.Dq -s 606for single user mode) must be passed as options to the 607.Ic load 608command. 609Options for the hypervisor (such as 610.Dq Li dom0_mem=256M 611to reserve 612.Pf 256 Tn MB 613of memory for DOM0) 614must be passed as options to the 615.Ic multiboot 616command. 617See 618.Xr boot.cfg 5 619for examples on how to boot 620.Nx Ns / Ns Xen. 621.It Nx No multiboot kernels 622A 623.Nx 624kernel that was built with 625.Cd options MULTIBOOT 626(see 627.Xr x86/multiboot 8 ) 628may be booted with either the 629.Ic boot 630or 631.Ic multiboot 632command, passing the same 633.Ar arguments 634in either case. 635.It Non- Ns Nx No kernels 636A kernel for a 637.No non- Ns Nx 638operating system that expects to be booted using the 639multiboot protocol (such as by the GNU 640.Dq GRUB 641boot loader) 642may be booted using the 643.Ic multiboot 644command. 645See the foreign operating system's documentation for the available 646.Ar arguments . 647.El 648.It Ic pkboot 649[Only available for BIOS and UEFI boot] Boot a kernel that has 650the 651.Cd KASLR 652option set, for Kernel Address Space Layout Randomizaton. 653.It Ic quit 654Reboot the system. 655.It Ic reloc Op Va default No \(or Va none No \(or Va address 656[Only UEFI boot] Sets where the kernel is copied by bootstrap 657before it is started. Values other than default require a kernel 658built with the 659.Cd SELFRELOC 660option, so that can relocate itself at the right address, 661otherwise a crash occurs at boot time. 662.Bl -tag -width default 663.It Va default 664Copy the kernel at ELF header load address, this is the historical 665behavior. 666.It Va none 667Leave the kernel where it was loaded and start it as is. 668.It Va address 669Copy the kernel at given 670.Va address . 671.El 672.It Ic rndseed Ar file 673[Only available for BIOS and UEFI boot] 674Load the specified 675.Ar file 676and request the kernel to use it as a seed for the 677.Xr rnd 4 678random number generator. 679The 680.Ar file 681should be in the private format used by 682.Xr rndctl 8 , 683and should have been saved by 684.Ql "rndctl -S" 685shortly before the previous shutdown. 686See the 687.Va random_seed 688and 689.Va random_file 690variables in 691.Xr rc.conf 5 , 692and the 693.Pa /etc/rc.d/random_seed 694script, for a way to manage the seed file. 695Using the same seed file on more then one host, 696or for more than one boot on the same host, 697will reduce the quality of random numbers 698and may impact system security. 699.It Ic root Ar spec 700[Only available for BIOS and UEFI boot] 701Pass an explicit root specification to the kernel. 702See BTINFO_ROOTDEVICE for details. 703.It Ic splash Ar file 704[Only available for BIOS and UEFI boot] 705Load a graphical image from the specified 706.Ar file 707and request the kernel to use it as a splash screen. 708The 709.Ar file 710should contain an image in one of these formats: 711JPEG (baseline only, not progressive), 712PNG (8-bit only), 713TGA, 714BMP (non-1bpp, non-RLE), 715GIF, 716PSD (composited view only), 717or 718PIC. 719.It Ic text Op Va mode_index 720[Only available UEFI boot] Without argument, list the available 721text modes (displayed as column x line in hexadecimal, therefore 722.Li 50x19 723means 724.Li 80 725columns and 726.Li 25 727lines). With an argument, select a text mode. 728.It Ic userconf Ar command 729[Not available for 730.Xr x86/dosboot 8 ] 731Pass command 732.Ar command 733to 734.Xr userconf 4 735at boot time. 736These commands are processed before the interactive 737.Xr userconf 4 738shell is executed, if requested. 739.It Ic version Op Ar full 740[Only available UEFI boot] Display UEFI bootstrap version. With the 741.Op full 742argumznt, also display information about UEFI itself. 743.It Ic vesa Bro Ar \^modenum \ 744 No \(or Li on \ 745 No \(or Li off \ 746 No \(or Li enabled \ 747 No \(or Li disabled \ 748 No \(or Li list Brc 749[Only available for BIOS and 750.Xr x86/pxeboot 8 ] 751Initialise the video card to the specified resolution and bit depth. 752The 753.Ar modenum 754should be in the form of 755.Ql 0x100 , 756.Ql 800x600 , 757.Ql 800x600x32 . 758The values 759.Ql enabled , 760.Ql on 761put the display into the default mode, and 762.Ql disabled , 763.Ql off 764returns the display into standard vga mode. 765The value 766.Ql list 767lists all supported modes. 768.El 769.Pp 770In an emergency, the bootstrap methods described in the 771.Nx 772installation notes for the x86 architectures 773can be used to boot from floppy or other media, 774or over the network. 775.Ss Locating the root file system 776The kernel uses information from the bootloader to locate the 777file system to mount as root. 778There are three methods: 779.Bl -tag -width 04n -offset 04n 780.\" XXX: what this .Va is supposed to mean? 781.It Dv BTINFO_ROOTDEVICE Va from 782.Xr boot.cfg 5 783or multiboot. 784The bootloader passes the root device name as driver, unit, and 785partition (like 786.Ql sd0a Ns ). 787This will be automatically substituted by a 788.Xr dk 4 789wedge if one is discovered. 790.Pp 791If the bootloader passes a wedge name as 792.Dq Li wedge: 793or 794.Dq Li NAME= 795followed by the name. 796The kernel will search for a 797.Xr dk 4 798device with that name. 799.It Dv BTINFO_BOOTWEDGE Va determined by bootblock 800The bootloader passes start offset and length of a hard disk partition 801and a offset, size and hash of a 802.Dq boot area . 803Then kernel searches 804all disks and wedges for a block sequence at that offset with a 805matching hash. 806If one is found, the kernel will look for a wedge 807on that device at the same offset. 808.Pp 809An additional partition number is provided if the bootloader also 810passed a 811.Dv BTINFO_BOOTDISK 812record. 813This (or partition 814.Ql a ) 815will be used 816by the kernel as a fallback if there is no matching wedge. 817.It Dv BTINFO_BOOTDISK Va determined by bootblock 818This uses the device number passed by the 819.Tn BIOS 820that distinguishes between floppy, hard drive and 821.Tn CD-ROM 822boot. 823.Bl -tag -width xxx 824.It Floppy 825The kernel searches for the 826.Xr fd 4 827device with the correct unit, the partition number is used 828to select a specific disk format. 829See 830.Xr fd 4 831for details. 832.It Hard drive 833The bootloader passed a partition number and disklabel 834data (offset, type, checksum, packname). 835The kernel searches 836all disks for a matching disklabel. 837If one is found, the 838kernel will use that device and partition number. 839.It Tn CDROM 840The 841.Tn BIOS 842does not distinguish between multiple 843.Tn CD 844devices. 845The kernel searches for the first 846.Xr cd 4 847device. 848So you can only boot from unit 0. 849.El 850.El 851.Sh FILES 852.Bl -tag -width /usr/mdec/bootxx_fstype -compact 853.It Pa /boot 854boot program code loaded by the primary bootstrap 855.It Pa /boot.cfg 856optional configuration file 857.It Pa /netbsd 858system code 859.It Pa /netbsd.gz 860gzip-compressed system code 861.It Pa /usr/mdec/boot 862master copy of the boot program (copy to /boot) 863.It Pa /usr/mdec/bootxx_fstype 864primary bootstrap for file system type fstype, copied to the start of 865the 866.Nx 867partition by 868.Xr installboot 8 . 869.It Pa /usr/mdec/bootia32.efi 870.It Pa /usr/mdec/bootx64.efi 871.Tn UEFI 872bootstraps for 873.Nx Ns /i386 874and 875.Nx Ns /amd64 , 876which should be copied to the 877.Pa /EFI/boot 878directory in a 879.Tn FAT 880formatted partition of type 881.Tn EFI 882(Either 883.Xr x86/mbr 8 884and 885.Xr gpt 8 , 886see the 887.Sx BUGS 888section). 889.Nx 890.Tn UEFI 891bootstrap reads its configuration from the 892.Pa /EFI/NetBSD/boot.cfg 893file in the 894.Tn EFI 895partition. 896.El 897.Sh SEE ALSO 898.Xr ddb 4 , 899.Xr fd 4 , 900.Xr pciback 4 , 901.Xr userconf 4 , 902.Xr boot.cfg 5 , 903.Xr halt 8 , 904.Xr installboot 8 , 905.Xr reboot 8 , 906.Xr rescue 8 , 907.Xr shutdown 8 , 908.Xr x86/boot_console 8 , 909.Xr x86/dosboot 8 , 910.Xr x86/mbr 8 , 911.Xr x86/multiboot 8 , 912.Xr x86/pxeboot 8 , 913.Xr boothowto 9 914.Sh BUGS 915The kernel file name must be specified before, not after, the boot options. 916Any 917.Ar filename 918specified after the boot options, e.g.: 919.Pp 920.Dl boot -d netbsd.test 921.Pp 922is ignored, and the default kernel is booted. 923.Pp 924Hard disks are always accessed by 925.Tn BIOS 926functions. 927Unit numbers are 928.Tn BIOS 929device numbers which might differ from numbering in the 930.Nx 931kernel or physical parameters 932.Po 933e.g., 934.Tn SCSI 935slave numbers 936.Pc . 937There isn't any distinction between 938.Dq sd 939and 940.Dq wd 941devices at the bootloader level. 942This is less a bug of the bootloader code than 943a shortcoming of the PC architecture. 944The default disk device's name printed in the starting message 945is derived from the 946.Dq type 947field of the 948.Nx 949disklabel (if it is a hard disk). 950.Pp 951.Tn UEFI 952implementations are supposed to support either 953.Xr x86/mbr 8 954or 955.Xr gpt 8 956partitioning, but some do not handle the latter. 957.Tn UEFI 958booting 959from a 960.Xr gpt 8 961partitioned disk is still possible in this case, by adding 962an overlapping 963.Tn EFI 964partition in the protective 965.Xr x86/mbr 8 966block. 967This can be achieved using the following commands 968(you must adapt the hard disk and 969.Tn EFI 970partition start end size to fit your setup): 971.Bd -literal -offset indent 972dd if=/dev/rwd0d bs=512 count=1 of=mbr 973fdisk -FIfaui1s 4/34/32768 -c /usr/mdec/mbr mbr 974dd if=mbr bs=512 count=1 of=/dev/rwd0d conv=notrunc 975.Ed 976.Pp 977The resulting 978.Xr x86/mbr 8 979partition table will look like this: 980.Bd -literal -offset indent 9810: GPT Protective MBR (sysid 238) 982 start 1, size 2097151 (1024 MB, Cyls 0-130/138/8) 983 PBR is not bootable: Bad magic number (0x0000) 9841: Primary DOS with 16 bit FAT <32M (sysid 4) 985 start 34, size 32768 (16 MB, Cyls 0/0/35-2/10/42), Active 9862: <UNUSED> 9873: <UNUSED> 988.Ed 989