xref: /netbsd-src/usr.sbin/installboot/installboot.8 (revision 627f7eb200a4419d89b531d55fccd2ee3ffdcde0)
1.\"	$NetBSD: installboot.8,v 1.101 2021/02/25 03:44:27 rin Exp $
2.\"
3.\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Luke Mewburn of Wasabi Systems.
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.\"
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.
29.\"
30.Dd February 25, 2021
31.Dt INSTALLBOOT 8
32.Os
33.Sh NAME
34.Nm installboot
35.Nd install disk bootstrap software
36.
37.Sh SYNOPSIS
38.Nm
39.Op Fl fnv
40.Op Fl B Ar s2bno
41.Op Fl b Ar s1bno
42.Op Fl m Ar machine
43.Op Fl o Ar options
44.Op Fl t Ar fstype
45.Ar filesystem
46.Ar primary
47.Op Ar secondary
48.Nm
49.Fl c
50.Op Fl fnv
51.Op Fl m Ar machine
52.Op Fl o Ar options
53.Op Fl t Ar fstype
54.Ar filesystem
55.Nm
56.Fl e
57.Op Fl fnv
58.Op Fl m Ar machine
59.Op Fl o Ar options
60.Ar bootstrap
61.
62.Sh DESCRIPTION
63The
64.Nm
65utility installs and removes
66.Nx
67disk bootstrap software into a file system.
68.Nm
69can install
70.Ar primary
71into
72.Ar filesystem ,
73or disable an existing bootstrap in
74.Ar filesystem .
75.Pp
76On some architectures the options of an existing installed bootstrap,
77or those of a bootstrap file can be changed.
78Installing a new primary bootstrap will reset those options to default
79values.
80.Pp
81Generally,
82.Nx
83disk bootstrap software consists of two parts: a
84.Dq primary
85bootstrap program usually written into the disklabel area of the
86file system by
87.Nm ,
88and a
89.Dq secondary
90bootstrap program that usually resides as an ordinary file in the file system.
91.Pp
92When booting, the primary bootstrap program is loaded and invoked by
93the machine's PROM or BIOS.
94After receiving control of the system it loads and runs the secondary
95bootstrap program, which in turn loads and runs the kernel.
96The secondary bootstrap may allow control over various boot parameters
97passed to the kernel.
98.Pp
99Perform the following steps to make a file system bootable:
100.Bl -enum
101.It
102Copy the secondary bootstrap (usually
103.Pa /usr/mdec/boot. Ns Sy MACHINE
104or
105.Pa /usr/mdec/boot )
106to the root directory of the target file system.
107.
108.It
109Use
110.Nm
111to install the primary bootstrap program
112(usually
113.Pa /usr/mdec/bootxx_ Ns Sy FSTYPE )
114into
115.Ar filesystem .
116.Pp
117The following platforms do not require this step if the primary bootstrap
118already exists and the secondary bootstrap file is just being updated:
119.Sy alpha ,
120.Sy amd64 ,
121.Sy amiga ,
122.Sy i386 ,
123.Sy pmax ,
124.Sy sparc64 ,
125and
126.Sy vax .
127.Pp
128The following platform does not require the first step since a
129single bootstrap file is used.
130The single bootstrap is installed like the primary bootstrap on
131other platforms:
132.Sy next68k .
133.El
134.Pp
135Some platforms, typically embedded system platforms, are umbrella platforms
136that support many different individual board types, each with their own
137boot loader binary and installation procedure requirements.
138On these platforms, it may be necessary to provide specific board type
139information to
140.Nm .
141Information about known boards and their requirements is loaded from a
142database at run-time.
143Sometimes these platforms also require the use of 3rd-party boot loader
144software, such as
145.Sy U-boot .
146To support these platforms,
147.Nm
148scans known locations for these 3rd-party boot loader packages for
149database overlays that contain additional board-specific boot loader
150installation information in a file called
151.Sq installboot.plist .
152.Pp
153The following platforms have this requirement and utilize this database
154overlay feature:
155.Sy evbarm .
156.Pp
157The options and arguments recognized by
158.Nm
159are as follows:
160.
161.Bl -tag -width "optionsxxx"
162.
163.It Fl B Ar s2bno
164When hard-coding the blocks of
165.Ar secondary
166into
167.Ar primary ,
168start from block
169.Ar s2bno
170instead of trying to determine the block numbers occupied by
171.Ar secondary
172by examining
173.Ar filesystem .
174If this option is supplied,
175.Ar secondary
176should refer to an actual secondary bootstrap (rather than the
177file name of the one present in
178.Ar filesystem )
179so that its size can be determined.
180.
181.It Fl b Ar s1bno
182Install
183.Ar primary
184at block number
185.Ar s1bno
186instead of the default location for the machine and file system type.
187.Sy [ alpha ,
188.Sy i386/amd64 (bootxx_fat16 only) ,
189.Sy pmax ,
190.Sy vax ]
191.
192.It Fl c
193Clear (remove) any existing bootstrap instead of installing one.
194.
195.It Fl e
196Edit the options of an existing bootstrap.
197This can be used to change the options in bootxx_xxxfs files,
198raw disk partitions, and the
199.Pa pxeboot_ia32.bin
200file.
201With
202.Fl v
203and without
204.Fl o ,
205show the current options.
206.Sy [ amd64 , i386 ]
207.
208.It Fl f
209Forces
210.Nm
211to ignore some errors.
212.
213.It Fl m Ar machine
214Use
215.Ar machine
216as the target machine type.
217The default machine is determined from
218.Xr uname 3
219and then
220.Ev MACHINE .
221The following machines are currently supported by
222.Nm :
223.Bd -ragged -offset indent
224.Sy alpha ,
225.Sy amd64 ,
226.Sy amiga ,
227.Sy evbarm ,
228.Sy ews4800mips ,
229.Sy hp300 ,
230.Sy hppa ,
231.Sy i386 ,
232.Sy landisk ,
233.Sy macppc ,
234.Sy news68k ,
235.Sy newsmips ,
236.Sy next68k ,
237.Sy pmax ,
238.Sy sparc ,
239.Sy sparc64 ,
240.Sy sun2 ,
241.Sy sun3 ,
242.Sy vax ,
243.Sy x68k
244.Ed
245.
246.
247.It Fl n
248Do not write to
249.Ar filesystem .
250.
251.It Fl o Ar options
252Machine specific
253.Nm
254options, comma separated.
255.Pp
256Supported options are (with the machines for they are valid in brackets):
257.
258.Bl -tag -offset indent -width alphasum
259.
260.It Sy alphasum
261.Sy [ alpha ]
262Recalculate and restore the Alpha checksum.
263This is the default for
264.Nx Ns /alpha .
265.
266.It Sy append
267.Sy [ alpha ,
268.Sy pmax ,
269.Sy vax ]
270Append
271.Ar primary
272to the end of
273.Ar filesystem ,
274which must be a regular file in this case.
275.
276.It Sy board=<board name>
277.Sy [ evbarm ]
278Specify the board type used to determine the correct boot loader image
279and installation procedure.
280If omitted,
281.Nm
282will attempt to guess the board type based on system information if run
283natively.
284.
285.It Sy bootconf
286.Sy [ amd64 ,
287.Sy i386 ]
288(Don't) read a
289.Dq boot.cfg
290file.
291.
292.It Sy command=<boot command>
293.Sy [ amiga ]
294Modify the default boot command line.
295.
296.It Sy console=<console name>
297.Sy [ amd64 ,
298.Sy i386 ]
299Set the console device, <console name> must be one of:
300pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd, com3kbd or auto.
301.
302.It Sy dtb=/path/to/dtb/file
303.Sy [ evbarm ]
304Attempt to determine the board type from information in the device tree
305blob file at
306.Pa /path/to/dtb/file .
307If both
308.Sy board
309and
310.Sy dtb
311options are specified,
312.Sy board
313takes precendence.
314.
315.It Sy ioaddr=<ioaddr>
316.Sy [ amd64 ,
317.Sy i386 ]
318Set the IO address to be used for the console serial port.
319Defaults to the IO address used by the system BIOS for the specified port.
320.
321.It Sy keymap=<keymap>
322.Sy [ amd64 ,
323.Sy i386 ]
324Set a boot time keyboard translation map.
325Each character in <keymap> will be replaced by the one following it.
326For example, an argument of
327.Dq zyz
328would swap the lowercase letters
329.Sq y
330and
331.Sq z .
332.
333.It Sy media=<media type>
334.Sy [ evbarm ]
335Some boards require a different boot loader binary and/or installation
336procedure depending on what type of media will be used to boot the system.
337For such boards, this option is required, and omitting it will display a
338usage message that lists the valid media types for the board.
339For boards that do not require special media handling, this option is
340not allowed.
341Common values: sdmmc, emmc, usb.
342.
343.It Sy modules
344.Sy [ amd64 ,
345.Sy i386 ]
346(Don't) load kernel modules.
347.
348.It Sy password=<password>
349.Sy [ amd64 ,
350.Sy i386 ]
351Set the password which must be entered before the boot menu can be accessed.
352.
353.It Sy resetvideo
354.Sy [ amd64 ,
355.Sy i386 ]
356Reset the video before booting.
357.
358.It Sy speed=<baud rate>
359.Sy [ amd64 ,
360.Sy i386 ]
361Set the baud rate for the serial console.
362If a value of zero is specified, then the current baud rate (set by the
363BIOS) will be used.
364.
365.It Sy sunsum
366.Sy [ alpha ,
367.Sy pmax ,
368.Sy vax ]
369Recalculate and restore the Sun and
370.Nx Ns /sparc
371compatible checksum.
372.Em Note :
373The existing
374.Nx Ns /sparc
375disklabel should use no more than 4 partitions.
376.
377.It Sy timeout=<seconds>
378.Sy [ amd64 ,
379.Sy i386 ]
380Set the timeout before the automatic boot begins to the given number of seconds.
381.El
382.
383.It Fl t Ar fstype
384Use
385.Ar fstype
386as the type of
387.Ar filesystem .
388The default operation is to attempt to auto-detect this setting.
389The following file system types are currently supported by
390.Nm :
391.
392.Bl -tag -offset indent -width raid
393.
394.It Sy ffs
395.Bx
396Fast File System.
397.
398.It Sy raid
399Mirrored RAIDframe File System.
400.
401.It Sy raw
402.Sq Raw
403image.
404Note: if a platform needs to hard-code the block offset of the secondary
405bootstrap, it cannot be searched for on this file system type, and must
406be provided with
407.Fl B Ar s2bno .
408.El
409.
410.It Fl v
411Verbose operation.
412.
413.It Ar filesystem
414The path name of the device or file system image that
415.Nm
416is to operate on.
417It is not necessary for
418.Ar filesystem
419to be a currently mounted file system.
420.
421.It Ar primary
422The path name of the
423.Dq primary
424boot block to install.
425The path name must refer to a file in a file system that is currently
426mounted.
427.
428.It Ar secondary
429The path name of the
430.Dq secondary
431boot block, relative to the root of
432the file system in the device or image specified by the
433.Ar filesystem
434argument.
435Note that this may refer to a file in a file system that is not mounted.
436Most systems require
437.Ar secondary
438to be in the
439.Dq root
440directory of the file system, so the leading
441.Dq Pa /
442is not necessary on
443.Ar secondary .
444.Pp
445Only certain combinations of
446platform
447.Pq Fl m Ar machine
448and file system type
449.Pq Fl t Ar fstype
450require that the name of the secondary bootstrap is
451supplied as
452.Ar secondary ,
453so that information such as the disk block numbers occupied
454by the secondary bootstrap can be stored in the primary bootstrap.
455These are:
456.Bl -column "Platform" "File systems" -offset indent
457.It Sy "Platform" Ta Sy "File systems"
458.It macppc Ta ffs, raw
459.It news68k Ta ffs, raw
460.It newsmips Ta ffs, raw
461.It sparc Ta ffs, raid, raw
462.It sun2 Ta ffs, raw
463.It sun3 Ta ffs, raw
464.El
465.El
466.Pp
467.Nm
468exits 0 on success, and >0 if an error occurs.
469.
470.Sh ENVIRONMENT
471.Nm
472uses the following environment variables:
473.
474.Bl -tag -width "MACHINE"
475.
476.It Ev INSTALLBOOT_UBOOT_PATHS
477A colon-separated list of search paths to scan for
478.Sy U-boot
479packages with
480.Nm installboot
481installation overlays.
482If multiple overlays are found, overlays from paths closer to the front
483of the list take precedence.
484If not specified, the default path is
485.Pa /usr/pkg/share/u-boot .
486This environment variable is only used on platforms that support
487using
488.Sy U-boot :
489.Sy evbarm .
490.
491.It Ev MACHINE
492Default value for
493.Ar machine ,
494overriding the result from
495.Xr uname 3 .
496.
497.El
498.
499.Sh FILES
500Most
501.Nx
502ports will contain variations of the following files:
503.Bl -tag -width /usr/mdec/bootxx_ustarfs
504.
505.It Pa /usr/mdec/bootxx_ Ns Sy FSTYPE
506Primary bootstrap for file system type
507.Sy FSTYPE .
508Installed into the bootstrap area of the file system by
509.Nm .
510.
511.It Pa /usr/mdec/bootxx_fat16
512Primary bootstrap for MS-DOS
513.Sy FAT16
514file systems.
515This differs from
516.Nm bootxx_msdos
517in that it doesn't require the filesystem to have been initialised with
518any
519.Ql reserved sectors .
520It also uses the information in the
521.Ql Boot Parameter Block
522to get the media and filesytem properties.
523The
524.Ql hidden sectors
525field of the BPB must be the offset of the partition in the disk.
526This can be set using the
527.Fl b Ar s1bno
528option.
529.
530.It Pa /usr/mdec/bootxx_ffsv1
531Primary bootstrap for
532.Sy FFSv1
533file systems
534(the
535.Ql traditional
536file system prior to
537.Nx 6.0 ) .
538Use
539.Xr dumpfs 8
540to confirm the file system format is
541.Sy FFSv1 .
542.
543.It Pa /usr/mdec/bootxx_ffsv2
544Primary bootstrap for
545.Sy FFSv2
546file systems (the default file system for some platforms as of
547.Nx 6.0 ) .
548Use
549.Xr dumpfs 8
550to confirm the file system format is
551.Sy FFSv2 .
552.
553.It Pa /usr/mdec/bootxx_lfsv1
554Primary bootstrap for
555.Sy LFSv1
556file systems.
557.
558.It Pa /usr/mdec/bootxx_lfsv2
559Primary bootstrap for
560.Sy LFSv2
561file systems
562(the default LFS version).
563.
564.It Pa /usr/mdec/bootxx_msdos
565Primary bootstrap for MS-DOS
566.Sy FAT
567file systems.
568.
569.It Pa /usr/mdec/bootxx_ustarfs
570Primary bootstrap for
571.Sy TARFS
572boot images.
573This is used by various install media.
574.
575.It Pa /usr/mdec/boot. Ns Sy MACHINE
576Secondary bootstrap for machine type
577.Sy MACHINE .
578This should be installed into the file system before
579.Nm
580is run.
581.
582.It Pa /usr/mdec/boot
583Synonym for
584.Pa /usr/mdec/boot. Ns Sy MACHINE
585.
586.It Pa /boot. Ns Sy MACHINE
587Installed copy of secondary bootstrap for machine type
588.Sy MACHINE .
589.
590.It Pa /boot
591Installed copy of secondary bootstrap.
592Searched for by the primary bootstrap if
593.Pa /boot. Ns Sy MACHINE
594is not found.
595.
596.El
597.
598.Ss Nx Ns /evbarm files
599The
600.Nx Ns /evbarm
601platform covers a wide variety of board types, many of which use
602.Sy U-boot .
603Running
604.Nm
605with no options will display a list of known boards.
606Using the verbose option will also display information about which
607.Sy U-boot
608package needs to be installed to support that board, and if the required
609.Sy U-boot
610package is installed, the path at which it is located.
611.Bl -tag -width /usr/pkg/share/u-boot
612.It Pa /usr/pkg/share/u-boot
613The default location scanned for
614.Sy U-boot
615packages with installation overlays.
616.It Pa /usr/share/installboot/evbarm/boards.plist
617Base board database, used to provide information about which
618.Sy U-boot
619package is required for a given board.
620.El
621.
622.Ss Nx Ns /evbmips files
623.
624The
625.Nx Ns /evbmips
626bootstrap files currently only apply to the SBMIPS kernels for the
627SiByte/Broadcom BCM1250 and BCM1480 CPUs.
628.Bl -tag -width /usr/mdec/sbmips/bootxx_cd9660
629.
630.It Pa /usr/mdec/sbmips/boot
631.Nx Ns /evbmips
632secondary bootstrap for
633.Sy FFSv1 ,
634.Sy FFSv2 ,
635.Sy LFSv1 ,
636and
637.Sy LFSv2 .
638.It Pa /usr/mdec/sbmips/bootxx_cd9660
639SBMIPS primary bootstrap for ISO 9660 file system.
640.It Pa /usr/mdec/sbmips/bootxx_ffs
641SBMIPS primary bootstrap for FFSv1 and FFSv2 file system.
642.It Pa /usr/mdec/sbmips/bootxx_lfs
643SBMIPS primary bootstrap for LFSv1 and LFSv2 file system.
644.It Pa /usr/mdec/sbmips/netboot
645SBMIPS primary bootstrap for network root.
646.Pp
647Note that
648.Nm
649does not currently support evbmips directly.
650.
651.El
652.
653.Ss Nx Ns /hppa files
654.
655.Bl -tag -width /usr/mdec/bootxx_ustarfs
656.
657.It Pa /usr/mdec/xxboot
658.Nx Ns /hppa
659primary bootstrap for
660.Sy FFSv1 ,
661.Sy FFSv2 ,
662.Sy LFSv1 ,
663and
664.Sy LFSv2 .
665.It Pa /usr/mdec/cdboot
666.Nx Ns /hppa
667primary bootstrap for ISO 9660 file system.
668.It Pa /usr/mdec/sdboot
669Synonym for
670.Pa /usr/mdec/xxboot
671.
672.El
673.
674.Ss Nx Ns /macppc files
675.
676.Bl -tag -width /usr/mdec/bootxx_ustarfs
677.
678.It Pa /usr/mdec/bootxx
679.Nx Ns /macppc
680primary bootstrap.
681.
682.It Pa /usr/mdec/ofwboot
683.Nx Ns /macppc
684secondary bootstrap.
685.
686.It Pa /ofwboot
687Installed copy of
688.Nx Ns /macppc
689secondary bootstrap.
690.
691.El
692.
693.Ss Nx Ns /next68k files
694.
695.Bl -tag -width /usr/mdec/bootxx_ustarfs
696.
697.It Pa /usr/mdec/boot
698.Nx Ns /next68k
699bootstrap.
700.
701.El
702.
703.Ss Nx Ns /sparc64 files
704.
705.Bl -tag -width /usr/mdec/bootxx_ustarfs
706.
707.It Pa /usr/mdec/bootblk
708.Nx Ns /sparc64
709primary bootstrap.
710.
711.It Pa /usr/mdec/ofwboot
712.Nx Ns /sparc64
713secondary bootstrap.
714.
715.It Pa /ofwboot
716Installed copy of
717.Nx Ns /sparc64
718secondary bootstrap.
719.
720.El
721.
722.Sh EXAMPLES
723.
724.Ss common
725Verbosely install the Berkeley Fast File System primary bootstrap on to disk
726.Sq sd0 :
727.Dl Ic installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs
728Note: the
729.Dq whole disk
730partition (c on some ports, d on others) is used here, since the a partition
731probably is already opened (mounted as
732.Pa / ) ,
733so
734.Nm
735would not be able to access it.
736.Pp
737Remove the primary bootstrap from disk
738.Sq sd1 :
739.Dl Ic installboot -c /dev/rsd1c
740.
741.Ss Nx Ns /amiga
742Modify the command line to change the default from "netbsd -ASn2" to
743"netbsd -S":
744.Dl Ic installboot -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffsv1
745.
746.Ss Nx Ns /evbarm
747Install the
748.Sy U-boot
749boot loader for a Pinebook into an image that will be written to
750an SDMMC card:
751.Dl Ic installboot -m evbarm -o board=pine64,pinebook arm64.img
752.Pp
753Install / update the
754.Sy U-boot
755boot loader for the current running system on the eMMC device
756.Sq ld0
757and display verbose information about the procedure:
758.Dl Ic installboot -v /dev/rld0c
759.Pp
760Install a specific
761.Sy U-boot
762package for a BeagleBone Black into an image that will be written
763to an SDMMC card:
764.Dl Ic installboot -m evbarm -o board=ti,am335x-bone-black armv7.img \
765	/path/to/experimental/u-boot/package
766.
767.Ss Nx Ns /ews4800mips
768Install the System V Boot File System primary bootstrap on to disk
769.Sq sd0 ,
770with the secondary bootstrap
771.Sq Pa /boot
772already present in the SysVBFS partition on the disk:
773.Dl Ic installboot /dev/rsd0p /usr/mdec/bootxx_bfs
774.Bd -ragged -offset indent-two -compact
775.Em Note :
776On
777.Nx Ns /ews4800mips
778the p partition is the
779.Dq whole disk
780(i.e., raw) partition.
781.Ed
782.Ss Nx Ns /i386 and Nx Ns /amd64
783Install new boot blocks on an existing
784.Sy FFSv2
785mounted root file system on
786.Sq wd0 ,
787setting the timeout to five seconds, after installing an MBR bootcode and
788copying a new secondary bootstrap:
789.Dl Ic fdisk -c /usr/mdec/mbr /dev/rwd0d
790.Bd -ragged -offset indent-two -compact
791.Em Note :
792See
793.Xr fdisk 8
794and
795.Xr x86/mbr 8
796for more details.
797.Ed
798.Dl Ic cp /usr/mdec/boot /boot
799.Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2
800.Bd -ragged -offset indent-two -compact
801.Em Note :
802Pre
803.Nx 6.0
804systems used
805.Sy FFSv1
806file systems on these platforms; double check with
807.Xr dumpfs 8
808to be sure to use the correct secondary bootstrap.
809.Ed
810.Pp
811Create a bootable CD-ROM with an ISO 9660
812file system for an i386 system with a serial console:
813.Dl Ic mkdir cdrom
814.Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd
815.Dl Ic cp /usr/mdec/boot cdrom/boot
816.Dl Ic cp /usr/mdec/bootxx_cd9660 bootxx
817.Dl Ic installboot -o console=com0,speed=19200 -m i386 -e bootxx
818.Dl Ic makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \
819	cdrom
820.
821.Pp
822Create a bootable floppy disk with an FFSv1
823file system for a small custom kernel (note: bigger kernels needing
824multiple disks are handled with the ustarfs file system):
825.Dl Ic newfs -s 1440k /dev/rfd0a
826.Bd -ragged -offset indent-two -compact
827.Em Note :
828Ignore the warnings that
829.Xr newfs 8
830displays; it can not write a disklabel,
831which is not a problem for a floppy disk.
832.Ed
833.Dl Ic mount /dev/fd0a /mnt
834.Dl Ic cp /usr/mdec/boot /mnt/boot
835.Dl Ic gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz
836.Dl Ic umount /mnt
837.Dl Ic installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1
838.
839.Pp
840Create a bootable FAT file system on
841.Sq wd1a ,
842which should have the same offset and size as a FAT primary partition
843in the Master Boot Record (MBR):
844.Dl Ic newfs_msdos -r 16 /dev/rwd1a
845.Bd -ragged -offset indent-two -compact
846.Em Notes :
847The
848.Fl r Ar 16
849is to reserve space for the primary bootstrap.
850.Xr newfs_msdos 8
851will display an
852.Dq MBR type
853such as
854.Ql 1 ,
855.Ql 4 ,
856or
857.Ql 6 ;
858the MBR partition type of the appropriate primary partition should be
859changed to this value.
860.Ed
861.Dl Ic mount -t msdos /dev/wd1a /mnt
862.Dl Ic cp /usr/mdec/boot /mnt/boot
863.Dl Ic cp path/to/kernel /mnt/netbsd
864.Dl Ic umount /mnt
865.Dl Ic installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos
866.Pp
867Make the existing FAT16 filesystem on
868.Sq sd0e
869bootable.
870This can be used to make USB memory bootable provided it has 512 byte
871sectors and that the manufacturer correctly initialised the file system.
872.Dl Ic mount -t msdos /dev/sd0e /mnt
873.Dl Ic cp /usr/mdec/boot /mnt/boot
874.Dl Ic cp path/to/kernel /mnt/netbsd
875.Dl Ic umount /mnt
876.Dl Ic installboot /dev/rsd0e /usr/mdec/bootxx_fat16
877It may also be necessary to use
878.Nm fdisk
879to make the device itself bootable.
880.
881.Pp
882Switch the existing installed bootstrap to use a serial console without
883reinstalling or altering other options such as timeout.
884.Dl Ic installboot -e -o console=com0 /dev/rwd0a
885.Ss Nx Ns /macppc
886Note the
887.Nm
888utility is only required for macppc machines with OpenFirmware version 2
889to boot.
890OpenFirmware 3 cannot load bootblocks specified in the Apple partition
891map.
892.Pp
893Install the Berkeley Fast File System primary bootstrap on to disk
894.Sq wd0 :
895.Dl Ic installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot
896.Pp
897The secondary
898.Nx Ns /macppc
899bootstrap is located in
900.Pa /usr/mdec/ofwboot .
901.Pp
902The primary bootstrap requires the raw
903.Pa ofwboot
904for the secondary bootstrap, not
905.Pa ofwboot.xcf ,
906which is used for the OpenFirmware to load kernels.
907.Ss Nx Ns /next68k
908Install the bootstrap on to disk
909.Sq sd0 :
910.Dl Ic installboot /dev/rsd0c /usr/mdec/boot
911.
912.Ss Nx Ns /pmax
913Install the Berkeley Fast File System primary bootstrap on to disk
914.Sq sd0 :
915.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_ffs
916.Pp
917.Nx Ns /pmax
918requires that this file system starts at block 0 of the disk.
919.Pp
920Install the ISO 9660 primary bootstrap in the file
921.Pa /tmp/cd-image :
922.Dl Ic installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660
923.Pp
924Make an ISO 9660 filesystem in the file
925.Pa /tmp/cd-image
926and install the ISO 9660 primary bootstrap in the filesystem, where the
927source directory for the ISO 9660 filesystem contains a kernel, the
928primary bootstrap
929.Pa bootxx_cd9660
930and the secondary bootstrap
931.Pa boot.pmax :
932.Dl Ic mkisofs -o /tmp/cd-image -a -l -v iso-source-dir
933.Dl ...
934.Dl 48 51 iso-source-dir/bootxx_cd9660
935.Dl ...
936.Dl Ic installboot -b `expr 48 \e* 4` /tmp/cd-image /usr/mdec/bootxx_cd9660
937.
938.Ss Nx Ns /sparc
939Install the Berkeley Fast File System primary bootstrap on to disk
940.Sq sd0 ,
941with the secondary bootstrap
942.Sq Pa /boot
943already present:
944.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot
945.
946.Ss Nx Ns /sparc64
947Install the primary bootstrap on to disk
948.Sq sd0 :
949.Dl Ic installboot /dev/rsd0c /usr/mdec/bootblk
950.Pp
951The secondary
952.Nx Ns /sparc64
953bootstrap is located in
954.Pa /usr/mdec/ofwboot .
955.
956.Ss Nx Ns /sun2 and Nx Ns /sun3
957Install the Berkeley Fast File System primary bootstrap on to disk
958.Sq sd0 ,
959with the secondary bootstrap
960.Sq Pa /boot
961already present:
962.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot
963.
964.Sh SEE ALSO
965.Xr uname 3 ,
966.Xr boot 8 ,
967.Xr disklabel 8 ,
968.Xr dumpfs 8 ,
969.Xr fdisk 8 ,
970.Xr x86/mbr 8 ,
971.Xr x86/pxeboot 8
972.
973.Sh HISTORY
974This implementation of
975.Nm
976appeared in
977.Nx 1.6 .
978.
979.Sh AUTHORS
980.An -nosplit
981The machine independent portion of this implementation of
982.Nm
983was written by
984.An Luke Mewburn .
985The following people contributed to the various machine dependent
986back-ends:
987.An Simon Burge
988(pmax),
989.An Chris Demetriou
990(alpha),
991.An Matthew Fredette
992(sun2, sun3),
993.An Matthew Green
994(sparc64),
995.An Ross Harvey
996(alpha),
997.An Michael Hitch
998(amiga),
999.An Paul Kranenburg
1000(sparc),
1001.An David Laight
1002(i386),
1003.An Christian Limpach
1004(next68k),
1005.An Luke Mewburn
1006(macppc),
1007.An Matt Thomas
1008(vax),
1009.An Izumi Tsutsui
1010(news68k, newsmips),
1011and
1012.An UCHIYAMA Yasushi
1013(ews4800mips).
1014.
1015.Sh BUGS
1016There are not currently primary bootstraps to support all file systems
1017types which are capable of being the root file system.
1018.Pp
1019If a disk has been converted from
1020.Sy FFS
1021to
1022.Sy RAID
1023without the contents of the disk erased, then the original
1024.Sy FFS
1025installation may be auto-detected instead of the
1026.Sy RAID
1027installation.
1028In this case, the
1029.Fl t Ar raid
1030option must be provided.
1031.
1032.Ss Nx Ns /alpha
1033The
1034.Nx Ns /alpha
1035primary bootstrap program can only load the secondary bootstrap program
1036from file systems starting at the beginning (block 0) of disks.
1037Similarly, the secondary bootstrap program can only load kernels from
1038file systems starting at the beginning of disks.
1039.Pp
1040The size of primary bootstrap programs is restricted to 7.5KB, even
1041though some file systems (e.g., ISO 9660) are able to accommodate larger
1042ones.
1043.
1044.Ss Nx Ns /hp300
1045The disk must have a boot partition large enough to hold the bootstrap code.
1046Currently the primary bootstrap must be a LIF format file.
1047.
1048.Ss Nx Ns /i386 and Nx Ns /amd64
1049The bootstrap must be installed in the
1050.Nx
1051partition that starts at the beginning of the mbr partition.
1052If that is a valid filesystem and contains the
1053.Pa /boot
1054program then it will be used as the root filesystem, otherwise the
1055.Sq a
1056partition will be booted.
1057.Pp
1058The size of primary bootstrap programs is restricted to 8KB, even
1059though some file systems (e.g., ISO 9660) are able to accommodate larger
1060ones.
1061.
1062.Ss Nx Ns /macppc
1063Due to restrictions in
1064.Nm
1065and the secondary bootstrap implementation, file systems where kernels exist
1066must start at the beginning of disks.
1067.Pp
1068Currently,
1069.Nm
1070doesn't recognize an existing Apple partition map on the disk
1071and always writes a faked map to make disks bootable.
1072.Pp
1073The
1074.Nx Ns /macppc
1075bootstrap program can't load kernels from
1076.Sy FFSv2
1077partitions.
1078.Ss Nx Ns /next68k
1079The size of bootstrap programs is restricted to the free space before
1080the file system at the beginning of the disk minus 8KB.
1081.
1082.Ss Nx Ns /pmax
1083The
1084.Nx Ns /pmax
1085secondary bootstrap program can only load kernels from file
1086systems starting at the beginning of disks.
1087.Pp
1088The size of primary bootstrap programs is restricted to 7.5KB, even
1089though some file systems (e.g., ISO 9660) are able to accommodate larger
1090ones.
1091.
1092.Ss Nx Ns /sun2 and Nx Ns /sun3
1093The
1094.Nx Ns /sun2
1095and
1096.Nx Ns /sun3
1097secondary bootstrap program can only load kernels from file
1098systems starting at the beginning of disks.
1099.
1100.Ss Nx Ns /vax
1101The
1102.Nx Ns /vax
1103secondary bootstrap program can only load kernels from file systems
1104starting at the beginning of disks.
1105.Pp
1106The size of primary bootstrap programs is restricted to 7.5KB, even
1107though some file systems (e.g., ISO 9660) are able to accommodate larger
1108ones.
1109