xref: /netbsd/share/man/man8/man8.prep/mkbootimage.8 (revision 6550d01e)
1.\" $NetBSD: mkbootimage.8,v 1.5 2008/09/24 18:19:13 reed 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.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27.\" POSSIBILITY OF SUCH DAMAGE.
28.\"
29.Dd April 30, 2008
30.Dt MKBOOTIMAGE 8 prep
31.Os
32.Sh NAME
33.Nm mkbootimage
34.Nd create a prep boot image
35.Sh SYNOPSIS
36.Nm
37.Op Fl lsv
38.Op Fl m Ar machine_arch
39.Op Fl b Ar bootfile
40.Op Fl k Ar kernel
41.Op Fl r Ar rawdev
42.Ar boot-image
43.Sh DESCRIPTION
44.Nm
45is the utility used to create a bootable kernel image on
46.Nx
47for prep, bebox or rs6000.
48.Pp
49The
50.Nm
51utility takes the boot-program, and the optional kernel, and creates a boot
52image from them.
53This image contains the boot code, kernel, and optionally
54an i386 partition table.
55The image can be written directly to a floppy or hard drive with
56the
57.Xr dd 1
58command, or it can be directly netbooted via
59.Xr bootpd 8 .
60.Pp
61The following options are available:
62.Bl -tag -width indent
63.It Fl b
64Specifies which bootloader to embed in the bootable image.
65Defaults to
66.Pa /usr/mdec/boot .
67.It Fl k
68Specifies which kernel binary to embed in the bootable image.
69Defaults to
70.Pa /netbsd .
71.It Fl l
72Creates a partition table for a 2.88MB floppy instead of a 1.44MB floppy.
73This is primarily used for El-Torrito style CD images.
74.It Fl m
75Selects the machine architecture to build the image for.
76Currently supports prep, rs6000 and bebox.
77Defaults to the machine architecture you are currently running on.
78This option is required if you are building an image for another machine, such
79as building a prep boot image on i386.
80.It Fl r
81Specifies the raw device to read to gather the current partition table.
82This is generally
83.Pa /dev/rsd0c .
84.It Fl s
85Generates a standalone image with no partition table embedded.
86.It Fl v
87Generates verbose output, useful for debugging.
88.El
89.Pp
90There are three primary ways to use
91.Nm
92to build a bootable image:
93.Pp
94The first method is to build an image suitable for a floppy or netboot.
95This will create an image with an embedded partition table with a
96single PReP boot partition of type 0x41(65).
97The image can be directly netbooted, or if it
98is small enough, written directly to a floppy with
99.Xr dd 1 .
100.Nm
101will warn you if the generated image is too large to be written to a floppy.
102.Pp
103The second method is to build a standalone image with no partition table.
104This should be written to the PReP boot partition on your hard drive with
105.Xr dd 1 .
106.Pp
107The third method is for use in upgrading older systems that have
108been built by writing the floppy image directly to the head of the
109hard drive.
110This method reads the existing partition table and embeds that in
111the image.
112This should prevent loss of your current partition layout.
113This image should be written directly to the head of the disk with
114.Xr dd 1 .
115.Pp
116The recommended setup for a PReP machine is to build a partition table with
117.Xr fdisk 8
118that contains a PReP boot partition (type 65) as partition 0, marked active,
119and a second partition for
120.Nx
121encompassing the remainder of the disk.
122You should then create a disklabel on
123that disk with a partition (such as e) pointing to the PReP boot partition.
124Partition c should be the whole disk, and partition d can optionally be the
125.Nx
126portion of the disk.
127You may then use the other partitions for your normal disk layout.
128The PReP boot partition can be placed anywhere on the disk, but it is
129recommended that it be placed at the beginning of the disk.
130.Sh EXAMPLES
131Create a floppy or netboot image for prep named
132.Sq boot.fs :
133.Dl Ic mkbootimage -m prep -b /usr/mdec/boot -k /netbsd boot.fs
134Create a standalone bebox image for booting from a hard disk:
135.Dl Ic mkbootimage -s -m bebox -b /usr/mdec/boot -k /netbsd boot.fs
136Use the partition information on
137.Sq sd0
138to create a new bootable image with com0 as the console:
139.Dl Ic mkbootimage -b /usr/mdec/boot_com0 -k /netbsd -r /dev/rsd0c boot.fs
140.Sh SEE ALSO
141.Xr dd 1 ,
142.Xr boot 8 ,
143.Xr bootpd 8 ,
144.Xr disklabel 8 ,
145.Xr fdisk 8
146.Sh HISTORY
147.Nm
148first appeared in
149.Nx 1.5 .
150.Sh AUTHORS
151.Nm
152was written by
153.An NONAKA Kimihiro .
154