1 .\" $NetBSD: installboot_nbsd.8,v 1.79 2011/11/03 20:09:18 martin Exp $
3 .\" Copyright (c) 2002-2009 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Luke Mewburn of Wasabi Systems.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd install disk bootstrap software
66 utility installs and removes
68 disk bootstrap software into a file system.
74 or disable an existing bootstrap in
77 On some architectures the options of an existing installed bootstrap,
78 or those of a bootstrap file can be changed.
79 Installing a new primary bootstrap will reset those options to default
84 disk bootstrap software consists of two parts: a
86 bootstrap program usually written into the disklabel area of the
91 bootstrap program that usually resides as an ordinary file in the file system.
93 When booting, the primary bootstrap program is loaded and invoked by
94 the machine's PROM or BIOS.
95 After receiving control of the system it loads and runs the secondary
96 bootstrap program, which in turn loads and runs the kernel.
97 The secondary bootstrap may allow control over various boot parameters
100 Perform the following steps to make a file system bootable:
103 Copy the secondary bootstrap (usually
104 .Pa /usr/mdec/boot. Ns Sy MACHINE
107 to the root directory of the target file system.
113 to install the primary bootstrap program
115 .Pa /usr/mdec/bootxx_ Ns Sy FSTYPE )
119 The following platforms do not require this step if the primary bootstrap
120 already exists and the secondary bootstrap file is just being updated:
130 The following platform does not require the first step since a
131 single bootstrap file is used.
132 The single bootstrap is installed like the primary bootstrap on
138 The options and arguments recognized by
142 .Bl -tag -width "optionsxxx"
145 When hard-coding the blocks of
151 instead of trying to determine the block numbers occupied by
155 If this option is supplied,
157 should refer to an actual secondary bootstrap (rather than the
158 file name of the one present in
160 so that its size can be determined.
167 instead of the default location for the machine and file system type.
173 Clear (remove) any existing bootstrap instead of installing one.
176 Edit the options of an existing bootstrap.
177 This can be use to change the options in bootxx_xxxfs files,
178 raw disk partitions, and the
185 show the current options.
191 to ignore some errors.
200 options, comma separated.
202 Supported options are (with the machines for they are valid in brackets):
204 .Bl -tag -offset indent -width alphasum
208 Recalculate and restore the Alpha checksum.
209 This is the default for
220 which must be a regular file in this case.
229 .It Sy command=\*[Lt]boot command\*[Gt]
231 Modify the default boot command line.
233 .It Sy console=\*[Lt]console name\*[Gt]
236 Set the console device, \*[Lt]console name\*[Gt] must be one of:
237 pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd or com3kbd.
239 .It Sy ioaddr=\*[Lt]ioaddr\*[Gt]
242 Set the IO address to be used for the console serial port.
243 Defaults to the IO address used by the system BIOS for the specified port.
245 .It Sy keymap=\*[Lt]keymap\*[Gt]
248 Set a boot time keyboard translation map.
249 Each character in \*[Lt]keymap\*[Gt] will be replaced by the one following it.
250 For example, an argument of
252 would swap the lowercase letters
260 (Don't) load kernel modules.
262 .It Sy password=\*[Lt]password\*[Gt]
265 Set the password which must be entered before the boot menu can be accessed.
270 Reset the video before booting.
272 .It Sy speed=\*[Lt]baud rate\*[Gt]
275 Set the baud rate for the serial console.
276 If a value of zero is specified, then the current baud rate (set by the
283 Recalculate and restore the Sun and
289 disklabel should use no more than 4 partitions.
291 .It Sy timeout=\*[Lt]seconds\*[Gt]
294 Set the timeout before the automatic boot begins to the given number of seconds.
302 The default operation is to attempt to auto-detect this setting.
303 The following file system types are currently supported by
306 .Bl -tag -offset indent -width raid
313 Mirrored RAIDframe File System.
318 Note: if a platform needs to hard-code the block offset of the secondary
319 bootstrap, it cannot be searched for on this file system type, and must
328 The path name of the device or file system image that
331 It is not necessary for
333 to be a currently mounted file system.
338 boot block to install.
339 The path name must refer to a file in a file system that is currently
345 boot block, relative to the root of
346 the file system in the device or image specified by the
349 Note that this may refer to a file in a file system that is not mounted.
354 directory of the file system, so the leading
359 Only certain combinations of
364 require that the name of the secondary bootstrap is
367 so that information such as the disk block numbers occupied
368 by the secondary bootstrap can be stored in the primary bootstrap.
370 .Bl -column "Platform" "File systems" -offset indent
371 .It Sy "Platform" Ta Sy "File systems"
372 .It macppc Ta ffs, raw
373 .It news68k Ta ffs, raw
374 .It newsmips Ta ffs, raw
375 .It sparc Ta ffs, raid, raw
382 exits 0 on success, and \*[Gt]0 if an error occurs.
386 uses the following environment variables:
388 .Bl -tag -width "MACHINE"
393 overriding the result from
401 ports will contain variations of the following files:
403 .Bl -tag -width /usr/mdec/bootxx_ustarfs
405 .It Pa /usr/mdec/bootxx_ Ns Sy FSTYPE
406 Primary bootstrap for file system type
408 Installed into the bootstrap area of the file system by
411 .It Pa /usr/mdec/bootxx_fat16
412 Primary bootstrap for
418 in that it doesn't require the filesystem to have been initialised with
420 .Ql reserved sectors .
421 It also uses the information in the
422 .Ql Boot Parameter Block
423 to get the media and filesytem properties.
425 .It Pa /usr/mdec/bootxx_ffsv1
426 Primary bootstrap for
434 to confirm the file system format is
437 .It Pa /usr/mdec/bootxx_ffsv2
438 Primary bootstrap for
443 to confirm the file system format is
446 .It Pa /usr/mdec/bootxx_lfsv1
447 Primary bootstrap for
451 .It Pa /usr/mdec/bootxx_lfsv2
452 Primary bootstrap for
455 (the default LFS version).
457 .It Pa /usr/mdec/bootxx_msdos
458 Primary bootstrap for
463 .It Pa /usr/mdec/bootxx_ustarfs
464 Primary bootstrap for
467 This is used by various install media.
469 .It Pa /usr/mdec/boot. Ns Sy MACHINE
470 Secondary bootstrap for machine type
472 This should be installed into the file system before
476 .It Pa /usr/mdec/boot
478 .Pa /usr/mdec/boot. Ns Sy MACHINE
480 .It Pa /boot. Ns Sy MACHINE
481 Installed copy of secondary bootstrap for machine type
485 Installed copy of secondary bootstrap.
486 Searched for by the primary bootstrap if
487 .Pa /boot. Ns Sy MACHINE
492 .Ss Nx Ns Tn /macppc files
494 .Bl -tag -width /usr/mdec/bootxx_ustarfs
496 .It Pa /usr/mdec/bootxx
500 .It Pa /usr/mdec/ofwboot
511 .Ss Nx Ns Tn /next68k files
513 .Bl -tag -width /usr/mdec/bootxx_ustarfs
515 .It Pa /usr/mdec/boot
521 .Ss Nx Ns Tn /sparc64 files
523 .Bl -tag -width /usr/mdec/bootxx_ustarfs
525 .It Pa /usr/mdec/bootblk
529 .It Pa /usr/mdec/ofwboot
543 Verbosely install the Berkeley Fast File System primary bootstrap on to disk
545 .Dl Ic installboot_nbsd -v /dev/rsd0c /usr/mdec/bootxx_ffs
548 partition (c on some ports, d on others) is used here, since the a partition
549 probably is already opened (mounted as
553 would not be able to access it.
555 Remove the primary bootstrap from disk
557 .Dl Ic installboot_nbsd -c /dev/rsd1c
560 Modify the command line to change the default from "netbsd -ASn2" to
562 .Dl Ic installboot_nbsd -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffs
564 .Ss Nx Ns Tn /ews4800mips
565 Install the System V Boot File System primary bootstrap on to disk
567 with the secondary bootstrap
569 already present in the SysVBFS partition on the disk:
570 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/bootxx_bfs
572 .Ss Nx Ns Tn /i386 and Nx Ns Tn /amd64
573 Install new boot blocks on an existing mounted root file system on
575 setting the timeout to five seconds, after copying a new secondary
577 .Dl Ic cp /usr/mdec/boot /boot
578 .Dl Ic installboot_nbsd -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv1
581 Create a bootable CD-ROM with an ISO9660
582 file system for an i386 system with a serial console:
584 .Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd
585 .Dl Ic cp /usr/mdec/boot cdrom/boot
586 .Dl Ic cp /usr/mdec/bootxx_cd9660 bootxx
587 .Dl Ic installboot_nbsd -o console=com0,speed=19200 -m i386 -e bootxx
588 .Dl Ic makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \
592 Create a bootable floppy disk with an FFSv1
593 file system for a small custom kernel (note: bigger kernels needing
594 multiple disks are handled with the ustarfs file system):
595 .Dl Ic newfs -s 1440k /dev/rfd0a
596 .Bd -ragged -offset indent-two -compact
598 Ignore the warnings that
600 displays; it can not write a disklabel,
601 which is not a problem for a floppy disk.
603 .Dl Ic mount /dev/fd0a /mnt
604 .Dl Ic cp /usr/mdec/boot /mnt/boot
605 .Dl Ic gzip -9 \*[Lt] sys/arch/i386/compile/mykernel/netbsd \*[Gt] /mnt/netbsd.gz
607 .Dl Ic installboot_nbsd -v /dev/rfd0a /usr/mdec/bootxx_ffsv1
610 Create a bootable FAT file system on
612 which should have the same offset and size as a FAT primary partition
613 in the Master Boot Record (MBR):
614 .Dl Ic newfs_msdos -r 16 /dev/rwd1a
615 .Bd -ragged -offset indent-two -compact
619 is to reserve space for the primary bootstrap.
628 the MBR partition type of the appropriate primary partition should be
629 changed to this value.
631 .Dl Ic mount -t msdos /dev/wd1a /mnt
632 .Dl Ic cp /usr/mdec/boot /mnt/boot
633 .Dl Ic cp path/to/kernel /mnt/netbsd
635 .Dl Ic installboot_nbsd -t raw /dev/rwd1a /usr/mdec/bootxx_msdos
637 Make the existing FAT16 filesystem on
640 This can be used to make USB memory bootable provided it has 512 byte
641 sectors and that the manufacturer correctly initialised the file system.
642 .Dl Ic mount -t msdos /dev/sd0e /mnt
643 .Dl Ic cp /usr/mdec/boot /mnt/boot
644 .Dl Ic cp path/to/kernel /mnt/netbsd
646 .Dl Ic installboot_nbsd /dev/rsd0e /usr/mdec/bootxx_fat16
647 It may also be necessary to use
649 to make the device itself bootable.
652 Switch the existing installed bootstrap to use a serial console without
653 reinstalling or altering other options such as timeout.
654 .Dl Ic installboot_nbsd -e -o console=com0 /dev/rwd0a
658 utility is only required for macppc machines with OpenFirmware version 2
660 OpenFirmware 3 cannot load bootblocks specified in the Apple partition
663 Install the Berkeley Fast File System primary bootstrap on to disk
665 .Dl Ic installboot_nbsd /dev/rwd0c /usr/mdec/bootxx /ofwboot
669 bootstrap is located in
670 .Pa /usr/mdec/ofwboot .
672 The primary bootstrap requires the raw
674 for the secondary bootstrap, not
676 which is used for the OpenFirmware to load kernels.
677 .Ss Nx Ns Tn /next68k
678 Install the bootstrap on to disk
680 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/boot
684 Install the Berkeley Fast File System primary bootstrap on to disk
686 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/bootxx_ffs
689 requires that this file system starts at block 0 of the disk.
691 Install the ISO 9660 primary bootstrap in the file
693 .Dl Ic installboot_nbsd -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660
695 Make an ISO 9660 filesystem in the file
697 and install the ISO 9660 primary bootstrap in the filesystem, where the
698 source directory for the ISO 9660 filesystem contains a kernel, the
701 and the secondary bootstrap
703 .Dl Ic mkisofs -o /tmp/cd-image -a -l -v iso-source-dir
705 .Dl 48 51 iso-source-dir/bootxx_cd9660
707 .Dl Ic installboot_nbsd -b `expr 48 \e* 4` /tmp/cd-image /usr/mdec/bootxx_cd9660
710 Install the Berkeley Fast File System primary bootstrap on to disk
712 with the secondary bootstrap
715 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/bootxx /boot
717 .Ss Nx Ns Tn /sparc64
718 Install the primary bootstrap on to disk
720 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/bootblk
724 bootstrap is located in
725 .Pa /usr/mdec/ofwboot .
727 .Ss Nx Ns Tn /sun2 and Nx Ns Tn /sun3
728 Install the Berkeley Fast File System primary bootstrap on to disk
730 with the secondary bootstrap
733 .Dl Ic installboot_nbsd /dev/rsd0c /usr/mdec/bootxx /boot
744 This implementation of
750 The machine independent portion of this implementation of
752 was written by Luke Mewburn.
753 The following people contributed to the various machine dependent
756 Chris Demetriou (alpha),
757 Matthew Fredette (sun2, sun3),
758 Matthew Green (sparc64),
760 Michael Hitch (amiga),
761 Paul Kranenburg (sparc),
763 Christian Limpach (next68k),
764 Luke Mewburn (macppc),
766 Izumi Tsutsui (news68k, newsmips),
768 UCHIYAMA Yasushi (ews4800mips).
771 There are not currently primary bootstraps to support all file systems
772 types which are capable of being the root file system.
774 If a disk has been converted from
778 without the contents of the disk erased, then the original
780 installation may be auto-detected instead of the
785 option must be provided.
790 primary bootstrap program can only load the secondary bootstrap program
791 from file systems starting at the beginning (block 0) of disks.
792 Similarly, the secondary bootstrap program can only load kernels from
793 file systems starting at the beginning of disks.
795 The size of primary bootstrap programs is restricted to 7.5KB, even
796 though some file systems (e.g., ISO 9660) are able to accommodate larger
800 The disk must have a boot partition large enough to hold the bootstrap code.
801 Currently the primary bootstrap must be a LIF format file.
803 .Ss Nx Ns Tn /i386 and Nx Ns Tn /amd64
804 The bootstrap must be installed in the
806 partition that starts at the beginning of the mbr partition.
807 If that is a valid filesystem and contains the
809 program then it will be used as the root filesystem, otherwise the
811 partition will be booted.
813 The size of primary bootstrap programs is restricted to 8KB, even
814 though some file systems (e.g., ISO 9660) are able to accommodate larger
818 Due to restrictions in
820 and the secondary bootstrap implementation, file systems where kernels exist
821 must start at the beginning of disks.
825 doesn't recognize an existing Apple partition map on the disk
826 and always writes a faked map to make disks bootable.
830 bootstrap program can't load kernels from
833 .Ss Nx Ns Tn /next68k
834 The size of bootstrap programs is restricted to the free space before
835 the file system at the beginning of the disk minus 8KB.
840 secondary bootstrap program can only load kernels from file
841 systems starting at the beginning of disks.
843 The size of primary bootstrap programs is restricted to 7.5KB, even
844 though some file systems (e.g., ISO 9660) are able to accommodate larger
847 .Ss Nx Ns Tn /sun2 and Nx Ns Tn /sun3
852 secondary bootstrap program can only load kernels from file
853 systems starting at the beginning of disks.
858 secondary bootstrap program can only load kernels from file systems
859 starting at the beginning of disks.
861 The size of primary bootstrap programs is restricted to 7.5KB, even
862 though some file systems (e.g., ISO 9660) are able to accommodate larger