\" $NetBSD: mkbootimage.8,v 1.8 2017/02/18 21:47:11 wiz Exp $
\" Copyright (c) 2006 The NetBSD Foundation, Inc.
\" All rights reserved.
\"
\" This code is derived from software contributed to The NetBSD Foundation
\" by Tim Rightnour
\"
\" Redistribution and use in source and binary forms, with or without
\" modification, are permitted provided that the following conditions
\" are met:
\" 1. Redistributions of source code must retain the above copyright
\" notice, this list of conditions and the following disclaimer.
\" 2. Redistributions in binary form must reproduce the above copyright
\" notice, this list of conditions and the following disclaimer in the
\" documentation and/or other materials provided with the distribution.
\"
\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\" POSSIBILITY OF SUCH DAMAGE.
\"
Dd February 17, 2017
Dt MKBOOTIMAGE 8 prep
Os
Sh NAME
Nm mkbootimage
Nd create a prep boot image
Sh SYNOPSIS
Nm
Op Fl lsv
Op Fl b Ar bootfile
Op Fl k Ar kernel
Op Fl m Ar machine_arch
Op Fl r Ar rawdev
Ar boot-image
Sh DESCRIPTION
Nm
is the utility used to create a bootable kernel image on
Nx
for prep, bebox or rs6000.
Pp
The
Nm
utility takes the boot-program, and the optional kernel, and creates a boot
image from them.
This image contains the boot code, kernel, and optionally
an i386 partition table.
The image can be written directly to a floppy or hard drive with
the
Xr dd 1
command, or it can be directly netbooted via
Xr bootpd 8 .
Pp
The following options are available:
Bl -tag -width indent
It Fl b
Specifies which bootloader to embed in the bootable image.
Defaults to
Pa /usr/mdec/boot .
It Fl k
Specifies which kernel binary to embed in the bootable image.
Defaults to
Pa /netbsd .
It Fl l
Creates a partition table for a 2.88MB floppy instead of a 1.44MB floppy.
This is primarily used for El-Torrito style CD images.
It Fl m
Selects the machine architecture to build the image for.
Currently supports prep, rs6000 and bebox.
Defaults to the machine architecture you are currently running on.
This option is required if you are building an image for another machine, such
as building a prep boot image on i386.
It Fl r
Specifies the raw device to read to gather the current partition table.
This is generally
Pa /dev/rsd0c .
It Fl s
Generates a standalone image with no partition table embedded.
It Fl v
Generates verbose output, useful for debugging.
El
Pp
There are three primary ways to use
Nm
to build a bootable image:
Pp
The first method is to build an image suitable for a floppy or netboot.
This will create an image with an embedded partition table with a
single PReP boot partition of type 0x41(65).
The image can be directly netbooted, or if it
is small enough, written directly to a floppy with
Xr dd 1 .
Nm
will warn you if the generated image is too large to be written to a floppy.
Pp
The second method is to build a standalone image with no partition table.
This should be written to the PReP boot partition on your hard drive with
Xr dd 1 .
Pp
The third method is for use in upgrading older systems that have
been built by writing the floppy image directly to the head of the
hard drive.
This method reads the existing partition table and embeds that in
the image.
This should prevent loss of your current partition layout.
This image should be written directly to the head of the disk with
Xr dd 1 .
Pp
The recommended setup for a PReP machine is to build a partition table with
Xr fdisk 8
that contains a PReP boot partition (type 65) as partition 0, marked active,
and a second partition for
Nx
encompassing the remainder of the disk.
You should then create a disklabel on
that disk with a partition (such as e) pointing to the PReP boot partition.
Partition c should be the whole disk, and partition d can optionally be the
Nx
portion of the disk.
You may then use the other partitions for your normal disk layout.
The PReP boot partition can be placed anywhere on the disk, but it is
recommended that it be placed at the beginning of the disk.
Sh EXAMPLES
Create a floppy or netboot image for prep named
Sq boot.fs :
Dl Ic mkbootimage -m prep -b /usr/mdec/boot -k /netbsd boot.fs
Create a standalone bebox image for booting from a hard disk:
Dl Ic mkbootimage -s -m bebox -b /usr/mdec/boot -k /netbsd boot.fs
Use the partition information on
Sq sd0
to create a new bootable image with com0 as the console:
Dl Ic mkbootimage -b /usr/mdec/boot_com0 -k /netbsd -r /dev/rsd0c boot.fs
Sh SEE ALSO
Xr dd 1 ,
Xr bootpd 8 ,
Xr disklabel 8 ,
Xr fdisk 8 ,
Xr prep/boot 8
Sh HISTORY
Nm
first appeared in
Nx 1.5 .
Sh AUTHORS
Nm
was written by
An NONAKA Kimihiro .