MKBOOTIMAGE(8) | System Manager's Manual (prep) | MKBOOTIMAGE(8)

# NAME

`mkbootimage` — create a prep boot image

# SYNOPSIS

`mkbootimage` | [`-lsv`] [`-b` bootfile] [`-k` kernel] [`-m` machine_arch] [`-r` rawdev] boot-image

# DESCRIPTION

`mkbootimage` is the utility used to create a bootable kernel image on NetBSD for prep, bebox or rs6000.

The `mkbootimage` 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 dd(1) command, or it can be directly netbooted via bootpd(8).

The following options are available:

`-b`
  Specifies which bootloader to embed in the bootable image. Defaults to /usr/mdec/boot.
`-k`
  Specifies which kernel binary to embed in the bootable image. Defaults to /netbsd.
`-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.
`-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.
`-r`
  Specifies the raw device to read to gather the current partition table. This is generally /dev/rsd0c.
`-s`
  Generates a standalone image with no partition table embedded.
`-v`
  Generates verbose output, useful for debugging.

There are three primary ways to use `mkbootimage` to build a bootable image:

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 dd(1). `mkbootimage` will warn you if the generated image is too large to be written to a floppy.

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 dd(1).

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 dd(1).

The recommended setup for a PReP machine is to build a partition table with fdisk(8) that contains a PReP boot partition (type 65) as partition 0, marked active, and a second partition for NetBSD 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 NetBSD 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.

# EXAMPLES

Create a floppy or netboot image for prep named ‘boot.fs’:

``mkbootimage -m prep -b /usr/mdec/boot -k /netbsd boot.fs``
Create a standalone bebox image for booting from a hard disk:
``mkbootimage -s -m bebox -b /usr/mdec/boot -k /netbsd boot.fs``
Use the partition information on ‘sd0’ to create a new bootable image with com0 as the console:
``mkbootimage -b /usr/mdec/boot_com0 -k /netbsd -r /dev/rsd0c boot.fs``

# SEE ALSO

dd(1), bootpd(8), disklabel(8), fdisk(8), prep/boot(8)

# HISTORY

`mkbootimage` first appeared in NetBSD 1.5.

# AUTHORS

`mkbootimage` was written by NONAKA Kimihiro.

February 17, 2017 | NetBSD 10.99