1.\" $NetBSD: mkbootimage.8,v 1.2 2006/03/23 19:53:07 wiz Exp $ 2.\" Copyright (c) 2006 The NetBSD Foundation, Inc. 3.\" All rights reserved. 4.\" 5.\" This code is derived from software contributed to The NetBSD Foundation 6.\" by Tim Rightnour 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed by the NetBSD 19.\" Foundation, Inc. and its contributors. 20.\" 4. Neither the name of The NetBSD Foundation nor the names of its 21.\" contributors may be used to endorse or promote products derived 22.\" from this software without specific prior written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 25.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 28.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34.\" POSSIBILITY OF SUCH DAMAGE. 35.\" 36.Dd March 23, 2006 37.Dt MKBOOTIMAGE 8 38.Os 39.Sh NAME 40.Nm mkbootimage 41.Nd create a prep boot image 42.Sh SYNOPSIS 43.Nm 44.Op Fl ls 45.Op Fl b Ar bootfile 46.Op Fl k Ar kernel 47.Op Fl r Ar rawdev 48.Ar boot-image 49.Sh DESCRIPTION 50.Nm 51is the utility used to create a bootable prep kernel image on 52.Nx . 53.Pp 54The 55.Nm 56utility takes the boot-program, and the optional kernel, and creates a boot 57image from them. 58This image contains the boot code, kernel, and optionally 59an i386 partition table. 60The image can be written directly to a floppy or hard drive with 61the 62.Xr dd 1 63command, or it can be directly netbooted via 64.Xr bootpd 8 . 65.Pp 66The following options are available: 67.Bl -tag -width indent 68.It Fl b 69Specifies which bootloader to embed in the bootable image. 70Defaults to 71.Pa /usr/mdec/boot . 72.It Fl k 73Specifies which kernel binary to embed in the bootable image. 74Defaults to 75.Pa /netbsd . 76.It Fl l 77Creates a partition table for a 2.88MB floppy instead of a 1.44MB floppy. 78This is primarily used for El-Torrito style CD images. 79.It Fl r 80Specifies the raw device to read to gather the current partition table. 81This is generally 82.Pa /dev/rsd0c . 83.It Fl s 84Generates a standalone image with no partition table embedded. 85.El 86.Pp 87There are three primary ways to use 88.Nm 89to build a bootable image: 90.Pp 91The first method is to build an image suitable for a floppy or netboot. 92This will create an image with an embedded partition table with a 93single PReP boot partition of type 0x41(65). 94The image can be directly netbooted, or if it 95is small enough, written directly to a floppy with 96.Xr dd 1 . 97.Nm 98will warn you if the generated image is too large to be written to a floppy. 99.Pp 100The second method is to build a standalone image with no partition table. 101This should be written to the PReP boot partition on your hard drive with 102.Xr dd 1 . 103.Pp 104The third method is for use in upgrading older systems that have 105been built by writing the floppy image directly to the head of the 106hard drive. 107This method reads the existing partition table and embeds that in 108the image. 109This should prevent loss of your current partition layout. 110This image should be written directly to the head of the disk with 111.Xr dd 1 . 112.Pp 113The recommended setup for a PReP machine is to build a partition table with 114.Xr fdisk 8 115that contains a PReP boot partition (type 65) as partition 0, marked active, 116and a second partition for 117.Nx 118encompassing the remainder of the disk. 119You should then create a disklabel on 120that disk with a partition (such as e) pointing to the PReP boot partition. 121Partition c should be the whole disk, and partition d can optionally be the 122.Nx 123portion of the disk. 124You may then use the other partitions for your normal disk layout. 125The PReP boot partition can be placed anywhere on the disk, but it is 126recommended that it be placed at the beginning of the disk. 127.Sh EXAMPLES 128Create a floppy or netboot image named 129.Sq boot.fs : 130.Dl Ic mkbootimage -b /usr/mdec/boot -k /netbsd boot.fs 131Create a standalone image for booting from a hard disk: 132.Dl Ic mkbootimage -s -b /usr/mdec/boot -k /netbsd boot.fs 133Use the partition information on 134.Sq sd0 135to create a new bootable image with com0 as the console: 136.Dl Ic mkbootimage -b /usr/mdec/boot_com0 -k /netbsd -r /dev/rsd0c boot.fs 137.Sh SEE ALSO 138.Xr dd 1 , 139.Xr boot 8 , 140.Xr bootpd 8 , 141.Xr disklabel 8 , 142.Xr fdisk 8 143.Sh HISTORY 144.Nm 145first appeared in 146.Nx 1.5 . 147.Sh AUTHORS 148.Nm 149was written by 150.An NONAKA Kimihiro . 151