xref: /netbsd-src/share/man/man8/man8.prep/mkbootimage.8 (revision 99f13c162d27669b6dc9ebb1777726d2c5a5730f)
1*99f13c16Swiz.\" $NetBSD: mkbootimage.8,v 1.8 2017/02/18 21:47:11 wiz Exp $
2adb4cd42Sgarbled.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
3adb4cd42Sgarbled.\" All rights reserved.
4adb4cd42Sgarbled.\"
5adb4cd42Sgarbled.\" This code is derived from software contributed to The NetBSD Foundation
6adb4cd42Sgarbled.\" by Tim Rightnour
7adb4cd42Sgarbled.\"
8adb4cd42Sgarbled.\" Redistribution and use in source and binary forms, with or without
9adb4cd42Sgarbled.\" modification, are permitted provided that the following conditions
10adb4cd42Sgarbled.\" are met:
11adb4cd42Sgarbled.\" 1. Redistributions of source code must retain the above copyright
12adb4cd42Sgarbled.\"    notice, this list of conditions and the following disclaimer.
13adb4cd42Sgarbled.\" 2. Redistributions in binary form must reproduce the above copyright
14adb4cd42Sgarbled.\"    notice, this list of conditions and the following disclaimer in the
15adb4cd42Sgarbled.\"    documentation and/or other materials provided with the distribution.
16adb4cd42Sgarbled.\"
17adb4cd42Sgarbled.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18adb4cd42Sgarbled.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19adb4cd42Sgarbled.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20adb4cd42Sgarbled.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21adb4cd42Sgarbled.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22adb4cd42Sgarbled.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23adb4cd42Sgarbled.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24adb4cd42Sgarbled.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25adb4cd42Sgarbled.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26adb4cd42Sgarbled.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27adb4cd42Sgarbled.\" POSSIBILITY OF SUCH DAMAGE.
28adb4cd42Sgarbled.\"
293af2acdcSchristos.Dd February 17, 2017
3043148f18Sreed.Dt MKBOOTIMAGE 8 prep
31adb4cd42Sgarbled.Os
32adb4cd42Sgarbled.Sh NAME
33adb4cd42Sgarbled.Nm mkbootimage
34adb4cd42Sgarbled.Nd create a prep boot image
35adb4cd42Sgarbled.Sh SYNOPSIS
36adb4cd42Sgarbled.Nm
37c3408ed0Sgarbled.Op Fl lsv
38adb4cd42Sgarbled.Op Fl b Ar bootfile
39adb4cd42Sgarbled.Op Fl k Ar kernel
4056ba81ffSwiz.Op Fl m Ar machine_arch
41adb4cd42Sgarbled.Op Fl r Ar rawdev
42adb4cd42Sgarbled.Ar boot-image
43adb4cd42Sgarbled.Sh DESCRIPTION
44adb4cd42Sgarbled.Nm
45c3408ed0Sgarbledis the utility used to create a bootable kernel image on
46c3408ed0Sgarbled.Nx
47c3408ed0Sgarbledfor prep, bebox or rs6000.
48adb4cd42Sgarbled.Pp
49adb4cd42SgarbledThe
50adb4cd42Sgarbled.Nm
51145c75f9Swizutility takes the boot-program, and the optional kernel, and creates a boot
52145c75f9Swizimage from them.
53145c75f9SwizThis image contains the boot code, kernel, and optionally
54145c75f9Swizan i386 partition table.
55145c75f9SwizThe image can be written directly to a floppy or hard drive with
56145c75f9Swizthe
57adb4cd42Sgarbled.Xr dd 1
58adb4cd42Sgarbledcommand, or it can be directly netbooted via
59*99f13c16Swiz.Xr bootpd 8 .
60adb4cd42Sgarbled.Pp
61adb4cd42SgarbledThe following options are available:
62adb4cd42Sgarbled.Bl -tag -width indent
63adb4cd42Sgarbled.It Fl b
64145c75f9SwizSpecifies which bootloader to embed in the bootable image.
65145c75f9SwizDefaults to
66adb4cd42Sgarbled.Pa /usr/mdec/boot .
67adb4cd42Sgarbled.It Fl k
68145c75f9SwizSpecifies which kernel binary to embed in the bootable image.
69145c75f9SwizDefaults to
70adb4cd42Sgarbled.Pa /netbsd .
71adb4cd42Sgarbled.It Fl l
72145c75f9SwizCreates a partition table for a 2.88MB floppy instead of a 1.44MB floppy.
73145c75f9SwizThis is primarily used for El-Torrito style CD images.
74c3408ed0Sgarbled.It Fl m
75c3408ed0SgarbledSelects the machine architecture to build the image for.
76c3408ed0SgarbledCurrently supports prep, rs6000 and bebox.
77c3408ed0SgarbledDefaults to the machine architecture you are currently running on.
78c3408ed0SgarbledThis option is required if you are building an image for another machine, such
79c3408ed0Sgarbledas building a prep boot image on i386.
80adb4cd42Sgarbled.It Fl r
81145c75f9SwizSpecifies the raw device to read to gather the current partition table.
82145c75f9SwizThis is generally
83adb4cd42Sgarbled.Pa /dev/rsd0c .
84adb4cd42Sgarbled.It Fl s
85adb4cd42SgarbledGenerates a standalone image with no partition table embedded.
86c3408ed0Sgarbled.It Fl v
87c3408ed0SgarbledGenerates verbose output, useful for debugging.
88adb4cd42Sgarbled.El
89adb4cd42Sgarbled.Pp
90adb4cd42SgarbledThere are three primary ways to use
91adb4cd42Sgarbled.Nm
92adb4cd42Sgarbledto build a bootable image:
93adb4cd42Sgarbled.Pp
94145c75f9SwizThe first method is to build an image suitable for a floppy or netboot.
95145c75f9SwizThis will create an image with an embedded partition table with a
96145c75f9Swizsingle PReP boot partition of type 0x41(65).
97145c75f9SwizThe image can be directly netbooted, or if it
98adb4cd42Sgarbledis small enough, written directly to a floppy with
99adb4cd42Sgarbled.Xr dd 1 .
100adb4cd42Sgarbled.Nm
101adb4cd42Sgarbledwill warn you if the generated image is too large to be written to a floppy.
102adb4cd42Sgarbled.Pp
103145c75f9SwizThe second method is to build a standalone image with no partition table.
104145c75f9SwizThis should be written to the PReP boot partition on your hard drive with
105adb4cd42Sgarbled.Xr dd 1 .
106adb4cd42Sgarbled.Pp
107145c75f9SwizThe third method is for use in upgrading older systems that have
108145c75f9Swizbeen built by writing the floppy image directly to the head of the
109145c75f9Swizhard drive.
110145c75f9SwizThis method reads the existing partition table and embeds that in
111145c75f9Swizthe image.
112145c75f9SwizThis should prevent loss of your current partition layout.
113145c75f9SwizThis image should be written directly to the head of the disk with
114adb4cd42Sgarbled.Xr dd 1 .
115adb4cd42Sgarbled.Pp
116145c75f9SwizThe recommended setup for a PReP machine is to build a partition table with
117adb4cd42Sgarbled.Xr fdisk 8
118adb4cd42Sgarbledthat contains a PReP boot partition (type 65) as partition 0, marked active,
119adb4cd42Sgarbledand a second partition for
120adb4cd42Sgarbled.Nx
121145c75f9Swizencompassing the remainder of the disk.
122145c75f9SwizYou should then create a disklabel on
123adb4cd42Sgarbledthat disk with a partition (such as e) pointing to the PReP boot partition.
124adb4cd42SgarbledPartition c should be the whole disk, and partition d can optionally be the
125adb4cd42Sgarbled.Nx
126145c75f9Swizportion of the disk.
127145c75f9SwizYou may then use the other partitions for your normal disk layout.
128adb4cd42SgarbledThe PReP boot partition can be placed anywhere on the disk, but it is
129145c75f9Swizrecommended that it be placed at the beginning of the disk.
130145c75f9Swiz.Sh EXAMPLES
131c3408ed0SgarbledCreate a floppy or netboot image for prep named
132adb4cd42Sgarbled.Sq boot.fs :
133c3408ed0Sgarbled.Dl Ic mkbootimage -m prep -b /usr/mdec/boot -k /netbsd boot.fs
134c3408ed0SgarbledCreate a standalone bebox image for booting from a hard disk:
135c3408ed0Sgarbled.Dl Ic mkbootimage -s -m bebox -b /usr/mdec/boot -k /netbsd boot.fs
136adb4cd42SgarbledUse the partition information on
137adb4cd42Sgarbled.Sq sd0
138adb4cd42Sgarbledto create a new bootable image with com0 as the console:
139adb4cd42Sgarbled.Dl Ic mkbootimage -b /usr/mdec/boot_com0 -k /netbsd -r /dev/rsd0c boot.fs
140adb4cd42Sgarbled.Sh SEE ALSO
141145c75f9Swiz.Xr dd 1 ,
142*99f13c16Swiz.Xr bootpd 8 ,
143145c75f9Swiz.Xr disklabel 8 ,
144*99f13c16Swiz.Xr fdisk 8 ,
145*99f13c16Swiz.Xr prep/boot 8
146adb4cd42Sgarbled.Sh HISTORY
147adb4cd42Sgarbled.Nm
148adb4cd42Sgarbledfirst appeared in
149adb4cd42Sgarbled.Nx 1.5 .
150adb4cd42Sgarbled.Sh AUTHORS
151adb4cd42Sgarbled.Nm
152145c75f9Swizwas written by
153145c75f9Swiz.An NONAKA Kimihiro .
154