1.\" $NetBSD: installboot.8,v 1.99 2020/06/06 20:30:23 wiz 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 May 5, 2019 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_ffs 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 copying a new secondary 788bootstrap: 789.Dl Ic cp /usr/mdec/boot /boot 790.Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2 791.Bd -ragged -offset indent-two -compact 792.Em Note : 793Pre 794.Nx 6.0 795systems used 796.Sy FFSv1 797file systems on these platforms; double check with 798.Xr dumpfs 8 799to be sure to use the correct secondary bootstrap. 800.Ed 801.Pp 802Create a bootable CD-ROM with an ISO 9660 803file system for an i386 system with a serial console: 804.Dl Ic mkdir cdrom 805.Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd 806.Dl Ic cp /usr/mdec/boot cdrom/boot 807.Dl Ic cp /usr/mdec/bootxx_cd9660 bootxx 808.Dl Ic installboot -o console=com0,speed=19200 -m i386 -e bootxx 809.Dl Ic makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \ 810 cdrom 811. 812.Pp 813Create a bootable floppy disk with an FFSv1 814file system for a small custom kernel (note: bigger kernels needing 815multiple disks are handled with the ustarfs file system): 816.Dl Ic newfs -s 1440k /dev/rfd0a 817.Bd -ragged -offset indent-two -compact 818.Em Note : 819Ignore the warnings that 820.Xr newfs 8 821displays; it can not write a disklabel, 822which is not a problem for a floppy disk. 823.Ed 824.Dl Ic mount /dev/fd0a /mnt 825.Dl Ic cp /usr/mdec/boot /mnt/boot 826.Dl Ic gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz 827.Dl Ic umount /mnt 828.Dl Ic installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1 829. 830.Pp 831Create a bootable FAT file system on 832.Sq wd1a , 833which should have the same offset and size as a FAT primary partition 834in the Master Boot Record (MBR): 835.Dl Ic newfs_msdos -r 16 /dev/rwd1a 836.Bd -ragged -offset indent-two -compact 837.Em Notes : 838The 839.Fl r Ar 16 840is to reserve space for the primary bootstrap. 841.Xr newfs_msdos 8 842will display an 843.Dq MBR type 844such as 845.Ql 1 , 846.Ql 4 , 847or 848.Ql 6 ; 849the MBR partition type of the appropriate primary partition should be 850changed to this value. 851.Ed 852.Dl Ic mount -t msdos /dev/wd1a /mnt 853.Dl Ic cp /usr/mdec/boot /mnt/boot 854.Dl Ic cp path/to/kernel /mnt/netbsd 855.Dl Ic umount /mnt 856.Dl Ic installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos 857.Pp 858Make the existing FAT16 filesystem on 859.Sq sd0e 860bootable. 861This can be used to make USB memory bootable provided it has 512 byte 862sectors and that the manufacturer correctly initialised the file system. 863.Dl Ic mount -t msdos /dev/sd0e /mnt 864.Dl Ic cp /usr/mdec/boot /mnt/boot 865.Dl Ic cp path/to/kernel /mnt/netbsd 866.Dl Ic umount /mnt 867.Dl Ic installboot /dev/rsd0e /usr/mdec/bootxx_fat16 868It may also be necessary to use 869.Nm fdisk 870to make the device itself bootable. 871. 872.Pp 873Switch the existing installed bootstrap to use a serial console without 874reinstalling or altering other options such as timeout. 875.Dl Ic installboot -e -o console=com0 /dev/rwd0a 876.Ss Nx Ns /macppc 877Note the 878.Nm 879utility is only required for macppc machines with OpenFirmware version 2 880to boot. 881OpenFirmware 3 cannot load bootblocks specified in the Apple partition 882map. 883.Pp 884Install the Berkeley Fast File System primary bootstrap on to disk 885.Sq wd0 : 886.Dl Ic installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot 887.Pp 888The secondary 889.Nx Ns /macppc 890bootstrap is located in 891.Pa /usr/mdec/ofwboot . 892.Pp 893The primary bootstrap requires the raw 894.Pa ofwboot 895for the secondary bootstrap, not 896.Pa ofwboot.xcf , 897which is used for the OpenFirmware to load kernels. 898.Ss Nx Ns /next68k 899Install the bootstrap on to disk 900.Sq sd0 : 901.Dl Ic installboot /dev/rsd0c /usr/mdec/boot 902. 903.Ss Nx Ns /pmax 904Install the Berkeley Fast File System primary bootstrap on to disk 905.Sq sd0 : 906.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_ffs 907.Pp 908.Nx Ns /pmax 909requires that this file system starts at block 0 of the disk. 910.Pp 911Install the ISO 9660 primary bootstrap in the file 912.Pa /tmp/cd-image : 913.Dl Ic installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660 914.Pp 915Make an ISO 9660 filesystem in the file 916.Pa /tmp/cd-image 917and install the ISO 9660 primary bootstrap in the filesystem, where the 918source directory for the ISO 9660 filesystem contains a kernel, the 919primary bootstrap 920.Pa bootxx_cd9660 921and the secondary bootstrap 922.Pa boot.pmax : 923.Dl Ic mkisofs -o /tmp/cd-image -a -l -v iso-source-dir 924.Dl ... 925.Dl 48 51 iso-source-dir/bootxx_cd9660 926.Dl ... 927.Dl Ic installboot -b `expr 48 \e* 4` /tmp/cd-image /usr/mdec/bootxx_cd9660 928. 929.Ss Nx Ns /sparc 930Install the Berkeley Fast File System primary bootstrap on to disk 931.Sq sd0 , 932with the secondary bootstrap 933.Sq Pa /boot 934already present: 935.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot 936. 937.Ss Nx Ns /sparc64 938Install the primary bootstrap on to disk 939.Sq sd0 : 940.Dl Ic installboot /dev/rsd0c /usr/mdec/bootblk 941.Pp 942The secondary 943.Nx Ns /sparc64 944bootstrap is located in 945.Pa /usr/mdec/ofwboot . 946. 947.Ss Nx Ns /sun2 and Nx Ns /sun3 948Install the Berkeley Fast File System primary bootstrap on to disk 949.Sq sd0 , 950with the secondary bootstrap 951.Sq Pa /boot 952already present: 953.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot 954. 955.Sh SEE ALSO 956.Xr uname 3 , 957.Xr boot 8 , 958.Xr disklabel 8 , 959.Xr dumpfs 8 , 960.Xr fdisk 8 , 961.Xr x86/pxeboot 8 962. 963.Sh HISTORY 964This implementation of 965.Nm 966appeared in 967.Nx 1.6 . 968. 969.Sh AUTHORS 970.An -nosplit 971The machine independent portion of this implementation of 972.Nm 973was written by 974.An Luke Mewburn . 975The following people contributed to the various machine dependent 976back-ends: 977.An Simon Burge 978(pmax), 979.An Chris Demetriou 980(alpha), 981.An Matthew Fredette 982(sun2, sun3), 983.An Matthew Green 984(sparc64), 985.An Ross Harvey 986(alpha), 987.An Michael Hitch 988(amiga), 989.An Paul Kranenburg 990(sparc), 991.An David Laight 992(i386), 993.An Christian Limpach 994(next68k), 995.An Luke Mewburn 996(macppc), 997.An Matt Thomas 998(vax), 999.An Izumi Tsutsui 1000(news68k, newsmips), 1001and 1002.An UCHIYAMA Yasushi 1003(ews4800mips). 1004. 1005.Sh BUGS 1006There are not currently primary bootstraps to support all file systems 1007types which are capable of being the root file system. 1008.Pp 1009If a disk has been converted from 1010.Sy FFS 1011to 1012.Sy RAID 1013without the contents of the disk erased, then the original 1014.Sy FFS 1015installation may be auto-detected instead of the 1016.Sy RAID 1017installation. 1018In this case, the 1019.Fl t Ar raid 1020option must be provided. 1021. 1022.Ss Nx Ns /alpha 1023The 1024.Nx Ns /alpha 1025primary bootstrap program can only load the secondary bootstrap program 1026from file systems starting at the beginning (block 0) of disks. 1027Similarly, the secondary bootstrap program can only load kernels from 1028file systems starting at the beginning of disks. 1029.Pp 1030The size of primary bootstrap programs is restricted to 7.5KB, even 1031though some file systems (e.g., ISO 9660) are able to accommodate larger 1032ones. 1033. 1034.Ss Nx Ns /hp300 1035The disk must have a boot partition large enough to hold the bootstrap code. 1036Currently the primary bootstrap must be a LIF format file. 1037. 1038.Ss Nx Ns /i386 and Nx Ns /amd64 1039The bootstrap must be installed in the 1040.Nx 1041partition that starts at the beginning of the mbr partition. 1042If that is a valid filesystem and contains the 1043.Pa /boot 1044program then it will be used as the root filesystem, otherwise the 1045.Sq a 1046partition will be booted. 1047.Pp 1048The size of primary bootstrap programs is restricted to 8KB, even 1049though some file systems (e.g., ISO 9660) are able to accommodate larger 1050ones. 1051. 1052.Ss Nx Ns /macppc 1053Due to restrictions in 1054.Nm 1055and the secondary bootstrap implementation, file systems where kernels exist 1056must start at the beginning of disks. 1057.Pp 1058Currently, 1059.Nm 1060doesn't recognize an existing Apple partition map on the disk 1061and always writes a faked map to make disks bootable. 1062.Pp 1063The 1064.Nx Ns /macppc 1065bootstrap program can't load kernels from 1066.Sy FFSv2 1067partitions. 1068.Ss Nx Ns /next68k 1069The size of bootstrap programs is restricted to the free space before 1070the file system at the beginning of the disk minus 8KB. 1071. 1072.Ss Nx Ns /pmax 1073The 1074.Nx Ns /pmax 1075secondary bootstrap program can only load kernels from file 1076systems 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 /sun2 and Nx Ns /sun3 1083The 1084.Nx Ns /sun2 1085and 1086.Nx Ns /sun3 1087secondary bootstrap program can only load kernels from file 1088systems starting at the beginning of disks. 1089. 1090.Ss Nx Ns /vax 1091The 1092.Nx Ns /vax 1093secondary bootstrap program can only load kernels from file systems 1094starting at the beginning of disks. 1095.Pp 1096The size of primary bootstrap programs is restricted to 7.5KB, even 1097though some file systems (e.g., ISO 9660) are able to accommodate larger 1098ones. 1099