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