p 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.
p 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.
p Some platform
q Fl m Ar machine and file system type
q Fl t Ar fstype combinations 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: l -column "Platform" "File systems" -offset indent t Sy "Platform" Ta Sy "File systems" t macppc Ta ffs, raw t news68k Ta ffs, raw t newsmips Ta ffs, raw t sparc Ta ffs, raw t sun2 Ta ffs, raw t sun3 Ta ffs, raw .El
p Perform the following steps to make a file system bootable: l -enum t Copy the secondary bootstrap (usually
a /usr/mdec/boot. Ns Sy MACHINE or
a /usr/mdec/boot ) to the root directory of the target file system.
p . t Use .Nm to install the primary bootstrap program (usually
a /usr/mdec/bootxx_ Ns Sy FSTYPE ) into .Ar filesystem .
p 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 pmax , .Sy sparc64 , and .Sy vax .
p .El
p The options recognized by .Nm are as follows: . l -tag -width "optionsxxx" . t 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 pmax , .Sy vax ] . t 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. . t Fl c Clear (remove) any existing bootstrap instead of installing one. . t 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 "" : d -ragged -offset indent .Sy alpha , .Sy macppc , .Sy news68k , .Sy newsmips , .Sy pmax , .Sy sparc , .Sy sparc64 , .Sy sun2 , .Sy sun3 , .Sy vax .Ed . . t Fl n Do not write to .Ar filesystem . . t Fl o Ar options Machine specific .Nm options, comma separated.
p Supported options are (with the machines for they are valid in brackets): . l -tag -offset indent -width alphasum . t Sy alphasum .Sy [ alpha ] Recalculate and restore the Alpha checksum. This is the default for .Nx Ns Tn /alpha . . t Sy append .Sy [ pmax , .Sy vax ] Append .Ar primary to the end of .Ar filesystem , which must be a regular file in this case. . t Sy sunsum .Sy [ pmax , .Sy vax ] Recalculate and restore the Sun and .Nx Ns Tn /sparc compatible checksum. .Em Note : The existing .Nx Ns Tn /sparc disklabel should use no more than 4 partitions. .El . t 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 "" : . l -tag -offset indent -width ffs . t Sy ffs x Fast File System. . t 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 . t Fl v Verbose operation. .El
p .Nm exits 0 on success, and \*[Gt]0 if an error occurs. . .Sh ENVIRONMENT .Nm uses the following environment variables: . l -tag -width "MACHINE" . t 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:
p l -tag -width /usr/mdec/boot.$MACHINE . t 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 "" . . t 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. . t Pa /boot. Ns Sy MACHINE Installed copy of secondary bootstrap for machine type .Sy MACHINE . . t Pa /boot Installed copy of secondary bootstrap. Searched for by the primary bootstrap if
a /boot. Ns Sy MACHINE is not found. . .El . .Ss NetBSD/sparc64 files . l -tag -width /usr/mdec/boot.$MACHINE . t Pa /usr/mdec/bootblk .Nx Ns Tn /sparc64 primary bootstrap. . t Pa /usr/mdec/ofwboot .Nx Ns Tn /sparc64 secondary bootstrap. . t Pa /ofwboot Installed copy of .Nx Ns Tn /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
p Remove the primary bootstrap from disk .Sq sd1 : .Dl Ic installboot -c /dev/rsd1c . .Ss NetBSD/pmax Install the Berkeley Fast File System primary bootstrap on to disk .Sq sd0 : .Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_ffs
p .Nx Ns Tn /pmax requires that this file system starts at block 0 of the disk.
p Install the ISO 9660 primary bootstrap in the file
a /tmp/cd-image : .Dl Ic installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660
p Make an ISO 9660 filesystem in the file
a /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
p
a bootxx_cd9660 and the secondary bootstrap
a 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 NetBSD/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 NetBSD/sparc64 Install the Berkeley Fast File System primary bootstrap on to disk .Sq wd0 : .Dl Ic installboot /dev/rwd0c /usr/mdec/bootblk
p The secondary .Nx Ns Tn /sparc64 bootstrap is located in
a /usr/mdec/ofwboot . . .Ss NetBSD/sun2 and NetBSD/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 . .Sh HISTORY This implementation of .Nm appeared in .Nx 1.6 . . .Sh AUTHORS The machine independent portion of this implementation of .Nm was written by Luke Mewburn. The following people contributed to the various machine dependent back-ends: Simon Burge (pmax), Chris Demetriou (alpha), Matthew Fredette (sun2, sun3), Matthew Green (sparc64), Ross Harvey (alpha), Paul Kranenburg (sparc), Luke Mewburn (macppc), Matt Thomas (vax), and Izumi Tsutsui (news68k, newsmips). . .Sh BUGS There are not currently primary bootstraps to support all file systems types which are capable of being the root file system. . .Ss NetBSD/alpha The .Nx Ns Tn /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.
p 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 NetBSD/pmax The .Nx Ns Tn /pmax secondary bootstrap program can only load kernels from file systems starting at the beginning of disks.
p 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 NetBSD/sun2 and NetBSD/sun3 The .Nx Ns Tn /sun2 and .Nx Ns Tn /sun3 secondary bootstrap program can only load kernels from file systems starting at the beginning of disks. . .Ss NetBSD/vax The .Nx Ns Tn /vax secondary bootstrap program can only load kernels from file systems starting at the beginning of disks.
p 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.