Chapter 36. Building NetBSD installation media

Table of Contents

36.1. Creating standard installation images with
36.2. Creating custom live disk images

36.1. Creating standard installation images with

For some architectures, you can build a disk or ISO image that boots into an installer. This is accomplished by running ./ with the targets install-image (for an USB stick) or iso-image (for a DVD or CD):

$ ./ -U -u -j2 -m amd64 -O ~/obj tools
$ ./ -U -u -j2 -m amd64 -O ~/obj release
$ ./ -U -u -j2 -m amd64 -O ~/obj install-image

Many other ./ targets are available, see Chapter 33, Crosscompiling NetBSD with

36.2. Creating custom live disk images

Sometimes you may want to create your own customized pre-installed ("live") images instead of using the precompiled images, for e.g. mass deployment on embedded systems. This section outlines the steps to do so.

  1. You must build a release of NetBSD so there are binaries to fill the image. See Chapter 33, Crosscompiling NetBSD with for instructions.

  2. You must write or pick a sh(1) script from src/distrib/utils/embedded/conf. Examine the default configurations, and if necessary, customize one to your needs. The scripts can alter and add to the system configuration files.

  3. Run the utility:

    $ export MKDTB=no
    $ ./distrib/utils/embedded/mkimage -D obj/destdir.amd64 -K sys/arch/amd64/compile/obj/GENERIC/netbsd -h amd64 -x ./example-amd64-image.img
    • In this case, we are building an image for the amd64.conf configuration, so we specify -h amd64.

    • We want to include the X11 sets, so we specify -x.

    • We need to specify the device type of the root filesystem with e.g. -r sd. Typically, this is ld(4) for SD/MMC devices, and sd(4) for USB sticks.

    • We specify MKDTB=no in the environment to avoid building device tree blobs, which are only used on ARM and MIPS.

  4. Make any final additions to the image. This can include installing packages with pkg_add(1), etc. We mount the image as a virtual disk using vndconfig(8):

    # vndconfig vnd0 ./example-amd64-image.img
    # mount /dev/vnd0a /mnt
    # pkg_add -P /mnt -K /usr/pkg/pkgdb -v darkstat-3.0.719.tgz
    # umount /mnt
  5. Write the image to your live media:

    # dd if=example-amd64-image.img ibs=1m | progress dd of=/dev/rsd0 obs=1m