BSD daemon

NetBSD Documentation:

Bootable CD ROM How-To

Overview

Creating the CD image

Examining the CD image

Burning the CD


Overview


Introduction and Purpose (top)

This document attempts to explain how to make bootable NetBSD CD ROM's.

Creating the CD image


The first step in making a CD ROM is to create an image of the CD. This image will initially be stored as a (rather large, up to 650 Mb) file on your hard drive and then later written to the CD. This section assumes you have access to the program mkhybrid. If you are making the CD image on a NetBSD machine, you can install the program from the mkhybrid package. The program mkisofs can also be used. There is also a mkisofs package available. It is assumed the directory /cdsources exists on your system and contains all the files which you want to end up on the CD ROM. One suggested layout for making an install CD is to follow the directory structure on ftp.netbsd.org. For example:
  /cdsources/i386/.....
  /cdsources/sparc/.....

NetBSD/alpha (top)

There are 2 steps involved in making a NetBSD/alpha bootable CD ROM. The first is to create an ISO 9660 image of whatever you want to put on the CD. This image must have the secondary boot program and kernel in its root directory. In addition, the primary boot program will be needed for the second step. To put the boot programs and kernel in the right places, do the following:
  cd /cdsources/alpha/binary/sets
  tar -zxvf base.tgz ./usr/mdec/boot ./usr/mdec/bootxx_cd9660
  mv -f ./usr/mdec/boot /cdsources/boot
  mkdir /tmp/mdec.alpha
  mv -f ./usr/mdec/bootxx_cd9660 /tmp/mdec.alpha/bootxx_cd9660
  rmdir ./usr/mdec
  cd /cdsources/alpha/installation/instkernel
  cp -f netbsd.gz /cdsources/netbsd.gz
Now create the ISO 9660 image.
  mkhybrid -o output.iso -a -l -J -r -L /cdsources
The second step is to install NetBSD/alpha disk and CD-ROM bootstrap software using installboot(8). This is done with the following command:
  installboot -v output.iso /tmp/mdec.alpha/bootxx_cd9660 
Note that this second step must either be performed on a NetBSD/alpha machine or you must compile the alpha installboot program for your machine. The alpha installboot program should compile and run correctly under NetBSD/i386.

NetBSD/i386 (top)

This section shows how to make a NetBSD/i386 bootable CD ROM. The particular example is how to make a NetBSD-1.5.1/i386 install CD. It is assumed that the directory /cdsources/ exists on your system and contains all the files and the directory structure from the NetBSD-1.5.1/i386 The exact contents depend on what you want on your CD. The important part is that /cdsources/i386/installation/floppy/boot-big.fs exists as that will be used as the bootable image. To create the CD image use the following command:
  mkhybrid -o output.iso -b i386/installation/floppy/boot-big.fs \ 
           -c boot.catalog -a -l -J -r -L /cdsources
This will create a file, output.iso, which is the CD image. The options are:

NetBSD/macppc (top)

Open Firmware can read files off ISO 9660 CDs, so just leave a kernel and copies of ofwboot.elf and ofwboot.xcf somewhere on the CD, and it can be booted from open firmware with:
 
  boot cd:,/path/to/files/ofwboot.elf
(or .xcf instead of .elf if you have an older machine) The path can be left off if the files are in the top level of the CD directory hierarchy so it is recommended to put them there:
  cp -f /cdsources/macppc/binary/kernel/ofwboot.elf /cdsources
  cd /cdsources/macppc/binary/sets/
  tar -zxvf kern.tgz 
  mv -f netbsd /cdsources/netbsd.macppc
Note that ofwboot can read compressed kernels, so the kernel can be gzipped if you're tight on space. The image is created by the following:
  mkhybrid -o output.iso -a -l -J -r -L /cdsources

NetBSD/pmax (top)

NetBSD/pmax can boot from either a FFS or ISO 9660 CD ROM. This section assumes you are making an ISO 9660 CD ROM. Please note that the bootxx_cd9660 program was not added until after NetBSD-1.4.x. If you're running NetBSD-1.4.x, you can obtain boot.pmax, installboot, and bootxx_cd9660 from a -current snapshot. Make sure the sources are from after late November, 1999. There are 2 steps involved in making a NetBSD/pmax bootable CD ROM. The first is to create an ISO 9660 image of whatever you want to put on the CD. This image must have the secondary boot program and kernel in its root directory. In addition, the primary boot program will be needed for the second step. To put the boot programs and kernel in the right places, do the following:
  cd /cdsources/pmax/binary/sets
  tar -zxvf base.tgz ./usr/mdec/boot.pmax ./usr/mdec/bootxx_cd9660
  mv -f ./usr/mdec/boot.pmax /cdsources/boot.pmax
  mkdir /tmp/mdec.pmax
  mv -f ./usr/mdec/bootxx_cd9660 /tmp/mdec.pmax/bootxx_cd9660
  rmdir ./usr/mdec

  cd /cdsources/pmax/binary/kernel
  cp -f install.gz /cdsources/netbsd.pmax.gz
  gunzip /cdsources/netbsd.pmax.gz
Now create the ISO 9660 image.
  mkhybrid -o output.iso -a -l -J -r -L /cdsources
The second step is to install NetBSD/pmax disk and CD-ROM bootstrap software using installboot(8). The installboot(8) command is used in the following way:
  /usr/mdec/installboot -v output.iso /usr/mdec/bootxx_cd9660 
Note that this second step must be performed on a NetBSD/pmax machine. However, it is acceptable for the ISO image to be NFS mounted on the NetBSD/pmax machine from a remote system if the image is not being built locally. Alternatively, starting with NetBSD-1.5.1, the NetBSD/pmax installboot program can be compiled on other NetBSD architectures. This allows the generation of a bootable image using a non-pmax machine.

NetBSD/sparc (top)

There are 3 steps involved in making a NetBSD/sparc bootable CD ROM. Step 1 is to create an "almost" full ISO 9660 image of whatever you want to put on the CD. For example:
  mkhybrid -o output.iso -a -l -J -r -L /cdsources
Now get a bootable floppy image. For NetBSD-1.5.1/sparc, this image may be found at ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-1.5.1/sparc/installation/bootfs/boot.fs.gz. The final step is to rewrite the ISO image with (a) a sun disklabel at the start, (b) the original image at the end, and (c) with the right offset/size values in the disklabel for the bootloader. The program mksunbootcd will perform this task. If mksunbootcd is not installed on your system, it can be installed from the mksunbootcd package. If you're creating the image on a non-NetBSD system, you can try compiling mksunbootcd on your system. The sources are available at ftp://ftp.netbsd.org/pub/NetBSD/misc/mksunbootcd/. To use mksunbootcd use the following:
  mksunbootcd output.iso boot.fs boot.fs boot.fs
The bootable image is listed 3 times corresponding to what will get booted by a sun4, sun4c and sun4m system respectively. If you have different bootable images for the 3 machines, you can do something like:
  mksunbootcd output.iso boot-sun4.fs boot-sun4c.fs boot-sun4m.fs
Note that mksunbootcd rewrites the output.iso file, so don't run it multiple times. As a note, this step is fine to perform on a NFS mounted directory. Ie, if your ISO image is on a remote machine, it can be mounted on a NetBSD machine for running mksunbootcd without requiring extreme amounts of data to be transfered over the network.

NetBSD/sparc64 (top)

Currently there is no support for booting NetBSD/sparc64 from CD. It is on the sparc64 TODO list however and the hardware certainly will support this.

NetBSD/sun3 (top)

This section is not finished.

NetBSD/vax (top)

NetBSD/vax can boot from either a FFS or ISO 9660 CD ROM. This section assumes you are making an ISO 9660 CD ROM. Please note that this capability was not added until NetBSD-1.5 There are 2 steps involved in making a NetBSD/vax bootable CD ROM. The first is to create an ISO 9660 image of whatever you want to put on the CD. This image must have the secondary boot program and kernel in its root directory. In addition, the primary boot program will be needed for the second step. To put the boot programs and kernel in the right places, do the following:
  cd /cdsources/vax/binary/sets
  tar -zxvf base.tgz ./usr/mdec/boot ./usr/mdec/xxboot
  mv -f ./usr/mdec/boot /cdsources/boot.vax
  mkdir /tmp/mdec.vax
  mv -f ./usr/mdec/xxboot /tmp/mdec.vax/xxboot
  rmdir ./usr/mdec

  cd /cdsources/vax/binary/kernel
  cp -f netbsd.INSTALL.gz /cdsources/netbsd.vax.gz
  gunzip -f /cdsources/netbsd.vax.gz
Now create the ISO 9660 image.
  mkhybrid -o output.iso -a -l -J -r -L /cdsources
The second step is to install NetBSD/vax disk and CD-ROM bootstrap software using installboot(8). The installboot(8) command is used in the following way:
  /usr/mdec/installboot -v output.iso /usr/mdec/xxboot
Note that this second step must be performed on a NetBSD/vax machine. However, it is acceptable for the ISO image to be NFS mounted on the NetBSD/vax machine from a remote system if the image is not being built locally. Alternatively, the vax installboot program can be compiled on a NetBSD machine of a different architecture.

Multiple Machine (top)

This procedure has been successfully used to create a single CD which is bootable on alpha, i386, pmax, and sparc. It should be possible to also make the CD bootable on vax. To create a CD which is bootable by multiple architectures, use the following steps in this order. Please note that the order is critical.

Using mkisofs (top)

The program mkisofs may be used as an alternative to mkhybrid. A brief example of its usage and flags is:
  mkisofs -a -b i386/installation/floppy/boot-big.fs -c boot.catalog \ 
          -f -l -r -J -L -o output.iso /cdsources/
The options are: There is a mkisofs package available.

Examining the CD image


It is possible to mount the cd image to examine the filesystem you just created.

Under NetBSD (top)

Mount the CD image using the following:
  vnconfig -c vnd0 output.iso
  mount -t cd9660 /dev/vnd0c /mnt
Please note that on i386 systems, you should /dev/vnd0d instead of /dev/vnd0c. Now you can cd to /mnt and explore your newly created CD image. To unmount the image, do the following:
  umount /mnt 
  vnconfig -u vnd0

Under Linux (top)

Linux has a similar capability. To mount the CD image:
  mount -t iso9660 -o ro,loop=/dev/loop0 output.iso /mnt
and to unmount the CD image:
  umount /mnt

Under Solaris (top)

Solaris-8 and newer is reported to be able to also mount the CD image. See the lofiadm manpage on solaris for more details on how to do this.

For older versions of Solaris, you might want to try the fbk driver written by Joerg Schilling. The fbk driver is available from ftp://ftp.fokus.gmd.de/pub/unix/kernel/fbk/ Please refer to the fbk documentation for installation instructions. Once the fbk driver is installed on your system, you can mount the ISO 9660 image with the following command:

  mount -F fbk -o ro,type=hsfs /dev/fbk0:output.iso  /mnt
and to unmount the CD image:
  umount /mnt

Burning the CD


Using cdrecord (U*nix) (top)

The program cdrecord may be used to burn the CD image to the CD. There is a cdrecord package available. An example of the use of cdrecord is the following:
  cdrecord -v speed=4 dev=/dev/cd1c output.iso
You will need to substitute the correct speed for your CD writer and the correct device for your system (for i386 it would be /dev/cd1d).

Under Windows (top)

There are several programs available for Windows which will write an ISO 9660 image to a CD. This section is not an endorsement for any of these programs in particular, but is intended to at least mention some of the alternatives.

Under MacOS (top)

There are several programs available for MacOS which will write an ISO 9660 image to a CD. This section is not an endorsement for any of these programs in particular, but is intended to at least mention some of the alternatives.

Up to NetBSD Documentation
NetBSD Home Page
NetBSD Documentation top level

(Contact us) $NetBSD: bootcd.html,v 1.29 2001/10/26 09:58:50 darcy Exp $
Copyright © 2000 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.