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