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