NetBSD/usr.sbin/installboot/installboot.8

1109 lines
26 KiB
Groff

.\" $NetBSD: installboot.8,v 1.101 2021/02/25 03:44:27 rin Exp $
.\"
.\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Luke Mewburn of Wasabi Systems.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 25, 2021
.Dt INSTALLBOOT 8
.Os
.Sh NAME
.Nm installboot
.Nd install disk bootstrap software
.
.Sh SYNOPSIS
.Nm
.Op Fl fnv
.Op Fl B Ar s2bno
.Op Fl b Ar s1bno
.Op Fl m Ar machine
.Op Fl o Ar options
.Op Fl t Ar fstype
.Ar filesystem
.Ar primary
.Op Ar secondary
.Nm
.Fl c
.Op Fl fnv
.Op Fl m Ar machine
.Op Fl o Ar options
.Op Fl t Ar fstype
.Ar filesystem
.Nm
.Fl e
.Op Fl fnv
.Op Fl m Ar machine
.Op Fl o Ar options
.Ar bootstrap
.
.Sh DESCRIPTION
The
.Nm
utility installs and removes
.Nx
disk bootstrap software into a file system.
.Nm
can install
.Ar primary
into
.Ar filesystem ,
or disable an existing bootstrap in
.Ar filesystem .
.Pp
On some architectures the options of an existing installed bootstrap,
or those of a bootstrap file can be changed.
Installing a new primary bootstrap will reset those options to default
values.
.Pp
Generally,
.Nx
disk bootstrap software consists of two parts: a
.Dq primary
bootstrap program usually written into the disklabel area of the
file system by
.Nm ,
and a
.Dq secondary
bootstrap program that usually resides as an ordinary file in the file system.
.Pp
When booting, the primary bootstrap program is loaded and invoked by
the machine's PROM or BIOS.
After receiving control of the system it loads and runs the secondary
bootstrap program, which in turn loads and runs the kernel.
The secondary bootstrap may allow control over various boot parameters
passed to the kernel.
.Pp
Perform the following steps to make a file system bootable:
.Bl -enum
.It
Copy the secondary bootstrap (usually
.Pa /usr/mdec/boot. Ns Sy MACHINE
or
.Pa /usr/mdec/boot )
to the root directory of the target file system.
.
.It
Use
.Nm
to install the primary bootstrap program
(usually
.Pa /usr/mdec/bootxx_ Ns Sy FSTYPE )
into
.Ar filesystem .
.Pp
The following platforms do not require this step if the primary bootstrap
already exists and the secondary bootstrap file is just being updated:
.Sy alpha ,
.Sy amd64 ,
.Sy amiga ,
.Sy i386 ,
.Sy pmax ,
.Sy sparc64 ,
and
.Sy vax .
.Pp
The following platform does not require the first step since a
single bootstrap file is used.
The single bootstrap is installed like the primary bootstrap on
other platforms:
.Sy next68k .
.El
.Pp
Some platforms, typically embedded system platforms, are umbrella platforms
that support many different individual board types, each with their own
boot loader binary and installation procedure requirements.
On these platforms, it may be necessary to provide specific board type
information to
.Nm .
Information about known boards and their requirements is loaded from a
database at run-time.
Sometimes these platforms also require the use of 3rd-party boot loader
software, such as
.Sy U-boot .
To support these platforms,
.Nm
scans known locations for these 3rd-party boot loader packages for
database overlays that contain additional board-specific boot loader
installation information in a file called
.Sq installboot.plist .
.Pp
The following platforms have this requirement and utilize this database
overlay feature:
.Sy evbarm .
.Pp
The options and arguments recognized by
.Nm
are as follows:
.
.Bl -tag -width "optionsxxx"
.
.It Fl B Ar s2bno
When hard-coding the blocks of
.Ar secondary
into
.Ar primary ,
start from block
.Ar s2bno
instead of trying to determine the block numbers occupied by
.Ar secondary
by examining
.Ar filesystem .
If this option is supplied,
.Ar secondary
should refer to an actual secondary bootstrap (rather than the
file name of the one present in
.Ar filesystem )
so that its size can be determined.
.
.It Fl b Ar s1bno
Install
.Ar primary
at block number
.Ar s1bno
instead of the default location for the machine and file system type.
.Sy [ alpha ,
.Sy i386/amd64 (bootxx_fat16 only) ,
.Sy pmax ,
.Sy vax ]
.
.It Fl c
Clear (remove) any existing bootstrap instead of installing one.
.
.It Fl e
Edit the options of an existing bootstrap.
This can be used to change the options in bootxx_xxxfs files,
raw disk partitions, and the
.Pa pxeboot_ia32.bin
file.
With
.Fl v
and without
.Fl o ,
show the current options.
.Sy [ amd64 , i386 ]
.
.It Fl f
Forces
.Nm
to ignore some errors.
.
.It Fl m Ar machine
Use
.Ar machine
as the target machine type.
The default machine is determined from
.Xr uname 3
and then
.Ev MACHINE .
The following machines are currently supported by
.Nm :
.Bd -ragged -offset indent
.Sy alpha ,
.Sy amd64 ,
.Sy amiga ,
.Sy evbarm ,
.Sy ews4800mips ,
.Sy hp300 ,
.Sy hppa ,
.Sy i386 ,
.Sy landisk ,
.Sy macppc ,
.Sy news68k ,
.Sy newsmips ,
.Sy next68k ,
.Sy pmax ,
.Sy sparc ,
.Sy sparc64 ,
.Sy sun2 ,
.Sy sun3 ,
.Sy vax ,
.Sy x68k
.Ed
.
.
.It Fl n
Do not write to
.Ar filesystem .
.
.It Fl o Ar options
Machine specific
.Nm
options, comma separated.
.Pp
Supported options are (with the machines for they are valid in brackets):
.
.Bl -tag -offset indent -width alphasum
.
.It Sy alphasum
.Sy [ alpha ]
Recalculate and restore the Alpha checksum.
This is the default for
.Nx Ns /alpha .
.
.It Sy append
.Sy [ alpha ,
.Sy pmax ,
.Sy vax ]
Append
.Ar primary
to the end of
.Ar filesystem ,
which must be a regular file in this case.
.
.It Sy board=<board name>
.Sy [ evbarm ]
Specify the board type used to determine the correct boot loader image
and installation procedure.
If omitted,
.Nm
will attempt to guess the board type based on system information if run
natively.
.
.It Sy bootconf
.Sy [ amd64 ,
.Sy i386 ]
(Don't) read a
.Dq boot.cfg
file.
.
.It Sy command=<boot command>
.Sy [ amiga ]
Modify the default boot command line.
.
.It Sy console=<console name>
.Sy [ amd64 ,
.Sy i386 ]
Set the console device, <console name> must be one of:
pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd, com3kbd or auto.
.
.It Sy dtb=/path/to/dtb/file
.Sy [ evbarm ]
Attempt to determine the board type from information in the device tree
blob file at
.Pa /path/to/dtb/file .
If both
.Sy board
and
.Sy dtb
options are specified,
.Sy board
takes precendence.
.
.It Sy ioaddr=<ioaddr>
.Sy [ amd64 ,
.Sy i386 ]
Set the IO address to be used for the console serial port.
Defaults to the IO address used by the system BIOS for the specified port.
.
.It Sy keymap=<keymap>
.Sy [ amd64 ,
.Sy i386 ]
Set a boot time keyboard translation map.
Each character in <keymap> will be replaced by the one following it.
For example, an argument of
.Dq zyz
would swap the lowercase letters
.Sq y
and
.Sq z .
.
.It Sy media=<media type>
.Sy [ evbarm ]
Some boards require a different boot loader binary and/or installation
procedure depending on what type of media will be used to boot the system.
For such boards, this option is required, and omitting it will display a
usage message that lists the valid media types for the board.
For boards that do not require special media handling, this option is
not allowed.
Common values: sdmmc, emmc, usb.
.
.It Sy modules
.Sy [ amd64 ,
.Sy i386 ]
(Don't) load kernel modules.
.
.It Sy password=<password>
.Sy [ amd64 ,
.Sy i386 ]
Set the password which must be entered before the boot menu can be accessed.
.
.It Sy resetvideo
.Sy [ amd64 ,
.Sy i386 ]
Reset the video before booting.
.
.It Sy speed=<baud rate>
.Sy [ amd64 ,
.Sy i386 ]
Set the baud rate for the serial console.
If a value of zero is specified, then the current baud rate (set by the
BIOS) will be used.
.
.It Sy sunsum
.Sy [ alpha ,
.Sy pmax ,
.Sy vax ]
Recalculate and restore the Sun and
.Nx Ns /sparc
compatible checksum.
.Em Note :
The existing
.Nx Ns /sparc
disklabel should use no more than 4 partitions.
.
.It Sy timeout=<seconds>
.Sy [ amd64 ,
.Sy i386 ]
Set the timeout before the automatic boot begins to the given number of seconds.
.El
.
.It Fl t Ar fstype
Use
.Ar fstype
as the type of
.Ar filesystem .
The default operation is to attempt to auto-detect this setting.
The following file system types are currently supported by
.Nm :
.
.Bl -tag -offset indent -width raid
.
.It Sy ffs
.Bx
Fast File System.
.
.It Sy raid
Mirrored RAIDframe File System.
.
.It Sy raw
.Sq Raw
image.
Note: if a platform needs to hard-code the block offset of the secondary
bootstrap, it cannot be searched for on this file system type, and must
be provided with
.Fl B Ar s2bno .
.El
.
.It Fl v
Verbose operation.
.
.It Ar filesystem
The path name of the device or file system image that
.Nm
is to operate on.
It is not necessary for
.Ar filesystem
to be a currently mounted file system.
.
.It Ar primary
The path name of the
.Dq primary
boot block to install.
The path name must refer to a file in a file system that is currently
mounted.
.
.It Ar secondary
The path name of the
.Dq secondary
boot block, relative to the root of
the file system in the device or image specified by the
.Ar filesystem
argument.
Note that this may refer to a file in a file system that is not mounted.
Most systems require
.Ar secondary
to be in the
.Dq root
directory of the file system, so the leading
.Dq Pa /
is not necessary on
.Ar secondary .
.Pp
Only certain combinations of
platform
.Pq Fl m Ar machine
and file system type
.Pq Fl t Ar fstype
require that the name of the secondary bootstrap is
supplied as
.Ar secondary ,
so that information such as the disk block numbers occupied
by the secondary bootstrap can be stored in the primary bootstrap.
These are:
.Bl -column "Platform" "File systems" -offset indent
.It Sy "Platform" Ta Sy "File systems"
.It macppc Ta ffs, raw
.It news68k Ta ffs, raw
.It newsmips Ta ffs, raw
.It sparc Ta ffs, raid, raw
.It sun2 Ta ffs, raw
.It sun3 Ta ffs, raw
.El
.El
.Pp
.Nm
exits 0 on success, and >0 if an error occurs.
.
.Sh ENVIRONMENT
.Nm
uses the following environment variables:
.
.Bl -tag -width "MACHINE"
.
.It Ev INSTALLBOOT_UBOOT_PATHS
A colon-separated list of search paths to scan for
.Sy U-boot
packages with
.Nm installboot
installation overlays.
If multiple overlays are found, overlays from paths closer to the front
of the list take precedence.
If not specified, the default path is
.Pa /usr/pkg/share/u-boot .
This environment variable is only used on platforms that support
using
.Sy U-boot :
.Sy evbarm .
.
.It Ev MACHINE
Default value for
.Ar machine ,
overriding the result from
.Xr uname 3 .
.
.El
.
.Sh FILES
Most
.Nx
ports will contain variations of the following files:
.Bl -tag -width /usr/mdec/bootxx_ustarfs
.
.It Pa /usr/mdec/bootxx_ Ns Sy FSTYPE
Primary bootstrap for file system type
.Sy FSTYPE .
Installed into the bootstrap area of the file system by
.Nm .
.
.It Pa /usr/mdec/bootxx_fat16
Primary bootstrap for MS-DOS
.Sy FAT16
file systems.
This differs from
.Nm bootxx_msdos
in that it doesn't require the filesystem to have been initialised with
any
.Ql reserved sectors .
It also uses the information in the
.Ql Boot Parameter Block
to get the media and filesytem properties.
The
.Ql hidden sectors
field of the BPB must be the offset of the partition in the disk.
This can be set using the
.Fl b Ar s1bno
option.
.
.It Pa /usr/mdec/bootxx_ffsv1
Primary bootstrap for
.Sy FFSv1
file systems
(the
.Ql traditional
file system prior to
.Nx 6.0 ) .
Use
.Xr dumpfs 8
to confirm the file system format is
.Sy FFSv1 .
.
.It Pa /usr/mdec/bootxx_ffsv2
Primary bootstrap for
.Sy FFSv2
file systems (the default file system for some platforms as of
.Nx 6.0 ) .
Use
.Xr dumpfs 8
to confirm the file system format is
.Sy FFSv2 .
.
.It Pa /usr/mdec/bootxx_lfsv1
Primary bootstrap for
.Sy LFSv1
file systems.
.
.It Pa /usr/mdec/bootxx_lfsv2
Primary bootstrap for
.Sy LFSv2
file systems
(the default LFS version).
.
.It Pa /usr/mdec/bootxx_msdos
Primary bootstrap for MS-DOS
.Sy FAT
file systems.
.
.It Pa /usr/mdec/bootxx_ustarfs
Primary bootstrap for
.Sy TARFS
boot images.
This is used by various install media.
.
.It Pa /usr/mdec/boot. Ns Sy MACHINE
Secondary bootstrap for machine type
.Sy MACHINE .
This should be installed into the file system before
.Nm
is run.
.
.It Pa /usr/mdec/boot
Synonym for
.Pa /usr/mdec/boot. Ns Sy MACHINE
.
.It Pa /boot. Ns Sy MACHINE
Installed copy of secondary bootstrap for machine type
.Sy MACHINE .
.
.It Pa /boot
Installed copy of secondary bootstrap.
Searched for by the primary bootstrap if
.Pa /boot. Ns Sy MACHINE
is not found.
.
.El
.
.Ss Nx Ns /evbarm files
The
.Nx Ns /evbarm
platform covers a wide variety of board types, many of which use
.Sy U-boot .
Running
.Nm
with no options will display a list of known boards.
Using the verbose option will also display information about which
.Sy U-boot
package needs to be installed to support that board, and if the required
.Sy U-boot
package is installed, the path at which it is located.
.Bl -tag -width /usr/pkg/share/u-boot
.It Pa /usr/pkg/share/u-boot
The default location scanned for
.Sy U-boot
packages with installation overlays.
.It Pa /usr/share/installboot/evbarm/boards.plist
Base board database, used to provide information about which
.Sy U-boot
package is required for a given board.
.El
.
.Ss Nx Ns /evbmips files
.
The
.Nx Ns /evbmips
bootstrap files currently only apply to the SBMIPS kernels for the
SiByte/Broadcom BCM1250 and BCM1480 CPUs.
.Bl -tag -width /usr/mdec/sbmips/bootxx_cd9660
.
.It Pa /usr/mdec/sbmips/boot
.Nx Ns /evbmips
secondary bootstrap for
.Sy FFSv1 ,
.Sy FFSv2 ,
.Sy LFSv1 ,
and
.Sy LFSv2 .
.It Pa /usr/mdec/sbmips/bootxx_cd9660
SBMIPS primary bootstrap for ISO 9660 file system.
.It Pa /usr/mdec/sbmips/bootxx_ffs
SBMIPS primary bootstrap for FFSv1 and FFSv2 file system.
.It Pa /usr/mdec/sbmips/bootxx_lfs
SBMIPS primary bootstrap for LFSv1 and LFSv2 file system.
.It Pa /usr/mdec/sbmips/netboot
SBMIPS primary bootstrap for network root.
.Pp
Note that
.Nm
does not currently support evbmips directly.
.
.El
.
.Ss Nx Ns /hppa files
.
.Bl -tag -width /usr/mdec/bootxx_ustarfs
.
.It Pa /usr/mdec/xxboot
.Nx Ns /hppa
primary bootstrap for
.Sy FFSv1 ,
.Sy FFSv2 ,
.Sy LFSv1 ,
and
.Sy LFSv2 .
.It Pa /usr/mdec/cdboot
.Nx Ns /hppa
primary bootstrap for ISO 9660 file system.
.It Pa /usr/mdec/sdboot
Synonym for
.Pa /usr/mdec/xxboot
.
.El
.
.Ss Nx Ns /macppc files
.
.Bl -tag -width /usr/mdec/bootxx_ustarfs
.
.It Pa /usr/mdec/bootxx
.Nx Ns /macppc
primary bootstrap.
.
.It Pa /usr/mdec/ofwboot
.Nx Ns /macppc
secondary bootstrap.
.
.It Pa /ofwboot
Installed copy of
.Nx Ns /macppc
secondary bootstrap.
.
.El
.
.Ss Nx Ns /next68k files
.
.Bl -tag -width /usr/mdec/bootxx_ustarfs
.
.It Pa /usr/mdec/boot
.Nx Ns /next68k
bootstrap.
.
.El
.
.Ss Nx Ns /sparc64 files
.
.Bl -tag -width /usr/mdec/bootxx_ustarfs
.
.It Pa /usr/mdec/bootblk
.Nx Ns /sparc64
primary bootstrap.
.
.It Pa /usr/mdec/ofwboot
.Nx Ns /sparc64
secondary bootstrap.
.
.It Pa /ofwboot
Installed copy of
.Nx Ns /sparc64
secondary bootstrap.
.
.El
.
.Sh EXAMPLES
.
.Ss common
Verbosely install the Berkeley Fast File System primary bootstrap on to disk
.Sq sd0 :
.Dl Ic installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs
Note: the
.Dq whole disk
partition (c on some ports, d on others) is used here, since the a partition
probably is already opened (mounted as
.Pa / ) ,
so
.Nm
would not be able to access it.
.Pp
Remove the primary bootstrap from disk
.Sq sd1 :
.Dl Ic installboot -c /dev/rsd1c
.
.Ss Nx Ns /amiga
Modify the command line to change the default from "netbsd -ASn2" to
"netbsd -S":
.Dl Ic installboot -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffsv1
.
.Ss Nx Ns /evbarm
Install the
.Sy U-boot
boot loader for a Pinebook into an image that will be written to
an SDMMC card:
.Dl Ic installboot -m evbarm -o board=pine64,pinebook arm64.img
.Pp
Install / update the
.Sy U-boot
boot loader for the current running system on the eMMC device
.Sq ld0
and display verbose information about the procedure:
.Dl Ic installboot -v /dev/rld0c
.Pp
Install a specific
.Sy U-boot
package for a BeagleBone Black into an image that will be written
to an SDMMC card:
.Dl Ic installboot -m evbarm -o board=ti,am335x-bone-black armv7.img \
/path/to/experimental/u-boot/package
.
.Ss Nx Ns /ews4800mips
Install the System V Boot File System primary bootstrap on to disk
.Sq sd0 ,
with the secondary bootstrap
.Sq Pa /boot
already present in the SysVBFS partition on the disk:
.Dl Ic installboot /dev/rsd0p /usr/mdec/bootxx_bfs
.Bd -ragged -offset indent-two -compact
.Em Note :
On
.Nx Ns /ews4800mips
the p partition is the
.Dq whole disk
(i.e., raw) partition.
.Ed
.Ss Nx Ns /i386 and Nx Ns /amd64
Install new boot blocks on an existing
.Sy FFSv2
mounted root file system on
.Sq wd0 ,
setting the timeout to five seconds, after installing an MBR bootcode and
copying a new secondary bootstrap:
.Dl Ic fdisk -c /usr/mdec/mbr /dev/rwd0d
.Bd -ragged -offset indent-two -compact
.Em Note :
See
.Xr fdisk 8
and
.Xr x86/mbr 8
for more details.
.Ed
.Dl Ic cp /usr/mdec/boot /boot
.Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2
.Bd -ragged -offset indent-two -compact
.Em Note :
Pre
.Nx 6.0
systems used
.Sy FFSv1
file systems on these platforms; double check with
.Xr dumpfs 8
to be sure to use the correct secondary bootstrap.
.Ed
.Pp
Create a bootable CD-ROM with an ISO 9660
file system for an i386 system with a serial console:
.Dl Ic mkdir cdrom
.Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd
.Dl Ic cp /usr/mdec/boot cdrom/boot
.Dl Ic cp /usr/mdec/bootxx_cd9660 bootxx
.Dl Ic installboot -o console=com0,speed=19200 -m i386 -e bootxx
.Dl Ic makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \
cdrom
.
.Pp
Create a bootable floppy disk with an FFSv1
file system for a small custom kernel (note: bigger kernels needing
multiple disks are handled with the ustarfs file system):
.Dl Ic newfs -s 1440k /dev/rfd0a
.Bd -ragged -offset indent-two -compact
.Em Note :
Ignore the warnings that
.Xr newfs 8
displays; it can not write a disklabel,
which is not a problem for a floppy disk.
.Ed
.Dl Ic mount /dev/fd0a /mnt
.Dl Ic cp /usr/mdec/boot /mnt/boot
.Dl Ic gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz
.Dl Ic umount /mnt
.Dl Ic installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1
.
.Pp
Create a bootable FAT file system on
.Sq wd1a ,
which should have the same offset and size as a FAT primary partition
in the Master Boot Record (MBR):
.Dl Ic newfs_msdos -r 16 /dev/rwd1a
.Bd -ragged -offset indent-two -compact
.Em Notes :
The
.Fl r Ar 16
is to reserve space for the primary bootstrap.
.Xr newfs_msdos 8
will display an
.Dq MBR type
such as
.Ql 1 ,
.Ql 4 ,
or
.Ql 6 ;
the MBR partition type of the appropriate primary partition should be
changed to this value.
.Ed
.Dl Ic mount -t msdos /dev/wd1a /mnt
.Dl Ic cp /usr/mdec/boot /mnt/boot
.Dl Ic cp path/to/kernel /mnt/netbsd
.Dl Ic umount /mnt
.Dl Ic installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos
.Pp
Make the existing FAT16 filesystem on
.Sq sd0e
bootable.
This can be used to make USB memory bootable provided it has 512 byte
sectors and that the manufacturer correctly initialised the file system.
.Dl Ic mount -t msdos /dev/sd0e /mnt
.Dl Ic cp /usr/mdec/boot /mnt/boot
.Dl Ic cp path/to/kernel /mnt/netbsd
.Dl Ic umount /mnt
.Dl Ic installboot /dev/rsd0e /usr/mdec/bootxx_fat16
It may also be necessary to use
.Nm fdisk
to make the device itself bootable.
.
.Pp
Switch the existing installed bootstrap to use a serial console without
reinstalling or altering other options such as timeout.
.Dl Ic installboot -e -o console=com0 /dev/rwd0a
.Ss Nx Ns /macppc
Note the
.Nm
utility is only required for macppc machines with OpenFirmware version 2
to boot.
OpenFirmware 3 cannot load bootblocks specified in the Apple partition
map.
.Pp
Install the Berkeley Fast File System primary bootstrap on to disk
.Sq wd0 :
.Dl Ic installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot
.Pp
The secondary
.Nx Ns /macppc
bootstrap is located in
.Pa /usr/mdec/ofwboot .
.Pp
The primary bootstrap requires the raw
.Pa ofwboot
for the secondary bootstrap, not
.Pa ofwboot.xcf ,
which is used for the OpenFirmware to load kernels.
.Ss Nx Ns /next68k
Install the bootstrap on to disk
.Sq sd0 :
.Dl Ic installboot /dev/rsd0c /usr/mdec/boot
.
.Ss Nx Ns /pmax
Install the Berkeley Fast File System primary bootstrap on to disk
.Sq sd0 :
.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_ffs
.Pp
.Nx Ns /pmax
requires that this file system starts at block 0 of the disk.
.Pp
Install the ISO 9660 primary bootstrap in the file
.Pa /tmp/cd-image :
.Dl Ic installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660
.Pp
Make an ISO 9660 filesystem in the file
.Pa /tmp/cd-image
and install the ISO 9660 primary bootstrap in the filesystem, where the
source directory for the ISO 9660 filesystem contains a kernel, the
primary bootstrap
.Pa bootxx_cd9660
and the secondary bootstrap
.Pa boot.pmax :
.Dl Ic mkisofs -o /tmp/cd-image -a -l -v iso-source-dir
.Dl ...
.Dl 48 51 iso-source-dir/bootxx_cd9660
.Dl ...
.Dl Ic installboot -b `expr 48 \e* 4` /tmp/cd-image /usr/mdec/bootxx_cd9660
.
.Ss Nx Ns /sparc
Install the Berkeley Fast File System primary bootstrap on to disk
.Sq sd0 ,
with the secondary bootstrap
.Sq Pa /boot
already present:
.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot
.
.Ss Nx Ns /sparc64
Install the primary bootstrap on to disk
.Sq sd0 :
.Dl Ic installboot /dev/rsd0c /usr/mdec/bootblk
.Pp
The secondary
.Nx Ns /sparc64
bootstrap is located in
.Pa /usr/mdec/ofwboot .
.
.Ss Nx Ns /sun2 and Nx Ns /sun3
Install the Berkeley Fast File System primary bootstrap on to disk
.Sq sd0 ,
with the secondary bootstrap
.Sq Pa /boot
already present:
.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot
.
.Sh SEE ALSO
.Xr uname 3 ,
.Xr boot 8 ,
.Xr disklabel 8 ,
.Xr dumpfs 8 ,
.Xr fdisk 8 ,
.Xr x86/mbr 8 ,
.Xr x86/pxeboot 8
.
.Sh HISTORY
This implementation of
.Nm
appeared in
.Nx 1.6 .
.
.Sh AUTHORS
.An -nosplit
The machine independent portion of this implementation of
.Nm
was written by
.An Luke Mewburn .
The following people contributed to the various machine dependent
back-ends:
.An Simon Burge
(pmax),
.An Chris Demetriou
(alpha),
.An Matthew Fredette
(sun2, sun3),
.An Matthew Green
(sparc64),
.An Ross Harvey
(alpha),
.An Michael Hitch
(amiga),
.An Paul Kranenburg
(sparc),
.An David Laight
(i386),
.An Christian Limpach
(next68k),
.An Luke Mewburn
(macppc),
.An Matt Thomas
(vax),
.An Izumi Tsutsui
(news68k, newsmips),
and
.An UCHIYAMA Yasushi
(ews4800mips).
.
.Sh BUGS
There are not currently primary bootstraps to support all file systems
types which are capable of being the root file system.
.Pp
If a disk has been converted from
.Sy FFS
to
.Sy RAID
without the contents of the disk erased, then the original
.Sy FFS
installation may be auto-detected instead of the
.Sy RAID
installation.
In this case, the
.Fl t Ar raid
option must be provided.
.
.Ss Nx Ns /alpha
The
.Nx Ns /alpha
primary bootstrap program can only load the secondary bootstrap program
from file systems starting at the beginning (block 0) of disks.
Similarly, the secondary bootstrap program can only load kernels from
file systems starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems (e.g., ISO 9660) are able to accommodate larger
ones.
.
.Ss Nx Ns /hp300
The disk must have a boot partition large enough to hold the bootstrap code.
Currently the primary bootstrap must be a LIF format file.
.
.Ss Nx Ns /i386 and Nx Ns /amd64
The bootstrap must be installed in the
.Nx
partition that starts at the beginning of the mbr partition.
If that is a valid filesystem and contains the
.Pa /boot
program then it will be used as the root filesystem, otherwise the
.Sq a
partition will be booted.
.Pp
The size of primary bootstrap programs is restricted to 8KB, even
though some file systems (e.g., ISO 9660) are able to accommodate larger
ones.
.
.Ss Nx Ns /macppc
Due to restrictions in
.Nm
and the secondary bootstrap implementation, file systems where kernels exist
must start at the beginning of disks.
.Pp
Currently,
.Nm
doesn't recognize an existing Apple partition map on the disk
and always writes a faked map to make disks bootable.
.Pp
The
.Nx Ns /macppc
bootstrap program can't load kernels from
.Sy FFSv2
partitions.
.Ss Nx Ns /next68k
The size of bootstrap programs is restricted to the free space before
the file system at the beginning of the disk minus 8KB.
.
.Ss Nx Ns /pmax
The
.Nx Ns /pmax
secondary bootstrap program can only load kernels from file
systems starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems (e.g., ISO 9660) are able to accommodate larger
ones.
.
.Ss Nx Ns /sun2 and Nx Ns /sun3
The
.Nx Ns /sun2
and
.Nx Ns /sun3
secondary bootstrap program can only load kernels from file
systems starting at the beginning of disks.
.
.Ss Nx Ns /vax
The
.Nx Ns /vax
secondary bootstrap program can only load kernels from file systems
starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems (e.g., ISO 9660) are able to accommodate larger
ones.