This document attempts to explain how to make bootable NetBSD CD ROMs.
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
mkisofs
. If you are making the CD image on a NetBSD
machine, you can install mkisofs
from the
sysutils/cdrtools
package.
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/..... |
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 rm -rf ./usr cd /cdsources/alpha/installation/instkernel cp -f netbsd.gz /cdsources/netbsd.gz |
Now create the ISO 9660 image.
mkisofs -o output.iso -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 -m alpha -v output.iso /tmp/mdec.alpha/bootxx_cd9660 |
This section shows how to make a NetBSD/i386 bootable CD ROM. The
particular example is how to make a NetBSD-1.6/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.6/i386
distribution.
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:
mkisofs -o output.iso -b i386/installation/floppy/boot-big.fs \ -c boot.catalog -l -J -R -L /cdsources |
This will create a file, output.iso
, which is the CD image.
The options are:
-b i386/installation/floppy/boot-big.fs
-- specifies the boot
image to be used-c boot.catalog
-- creates a boot catalog-l
-- Allow long (32 character) file names-J
-- Includes Joliet extensions-R
-- Sets file permissions including setuid-L
-- Allows filenames to begin with "."/cdsources
-- Specifies that the directory
/cdsources
is the root of the CD image
All supported macppc models can boot from the first session of a CD ROM. The procedure for making a CD bootable depends on what version of Open Firmware your model has. Refer to the NetBSD/macppc Model Support Page to determine your system's Open Firmware version and its support status.
It is assumed that the directory /cdsources/
exists on your
system and contains all the files and the directory structure from the NetBSD-1.6/macppc
distribution. The exact contents depend on what you want on your CD.
Make sure your /cdsources/
has ofwboot.xcf
(the macppc
bootloader) and a kernel (we suggest netbsd.GENERIC_MD
, the
ramdisk-based install kernel that supports all models).
cd /cdsources cp macppc/binary/kernel/netbsd-GENERIC_MD.gz netbsd.macppc cp macppc/installation/ofwboot.xcf . |
The NetBSD/macppc official ISO image is bootable on all supported models
because it does some special magic. The CD is created as an HFS
hybrid CD with an Apple Disk Partition Table using the -hfs -part
options in mkisofs. The Partition Table is then modified to map (or point to)
a driver file which makes the CD bootable on the PPC Macintosh and the
driver file is appended to the end of the iso image.
The CD won't be bootable via the "C
" snag key though. However
this can be added with the following, although it may not work on all
Macppc systems. (Adding the option will not impair the use of booting via
OpenFirmware commands.) To do this, create a CHRP bootscript in a top-level
directory, tag the bootscript file with the proper Mac OS Type and Creator,
and "bless" the directory which contains the file. Mkisofs will attach the
proper Mac OS Type and Creator codes while generating the ISO image file if
the following line is added to the file
/usr/src/distrib/cdrom/hfsmap.lst
:
.chrp - 'chrp' 'tbxi' |
Then place the following file named bootscript
in the (top-level)
macppc
directory:
<CHRP-BOOT> <COMPATIBLE>MacRISC</COMPATIBLE> <DESCRIPTION> NetBSD/macppc bootable CD script </DESCRIPTION> <BOOT-SCRIPT> boot cd:,ofwboot.xcf netbsd.macppc </BOOT-SCRIPT> </CHRP-BOOT> |
Create the macppc bootable CD image using the following commands:
cdrom_util="/usr/src/distrib/cdrom" snag_boot="-map ${cdrom_util}/hfsmap.lst -hfs-bless ./macppc" ofw_boot="-boot-hfs-file ${cdrom_util}/macppc_installboot/macppcboot.raw" mkisofs -o output.iso -hfs -part ${snag_boot} ${ofw_boot} -l -J -r -L /cdsources blknum=`ls -l output.iso | awk '{print $5}'` blknum=`expr ${blknum} / 512` ${cdrom_util}/macppc_installboot/macppc_installboot output.iso ${blknum} 756 dd if=/usr/mdec/ofwboot bs=64k count=1 conv=sync >> output.iso |
Once you have burnt the CD, make sure Open Firmware can find the
bootloader on your new CD ROM (see
How do I get a listing (in
Open Firmware) of the files on my disk? in the FAQ). This is
important, since Open Firmware treats the boot file name as case
sensitive. Most (if not all) Open Firmware 1.0.5, 1.1.22, and 2.0.x systems
will think the bootloader is OFWBOOT.XCF
and Open Firmware 3 should
properly see it as ofwboot.xcf
.
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.
mkisofs -o output.iso -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:
installboot -m pmax -v output.iso /usr/mdec/bootxx_cd9660 |
Please see this posting to the port-sgimips MailingList for instructions on how to create a bootable CD ROM. Note that these instructions have not been verified by the NetBSD developers (yet).
There are three 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:
mkisofs -o output.iso -l -J -r -L /cdsources |
Now get a bootable floppy image. For NetBSD-1.6/sparc, this image may be found at ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-1.6/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
sysutils/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 three times corresponding to what will get booted by a sun4, sun4c and sun4m system respectively. If you have different bootable images for the three machines, or if you also have a bootable image for sun2, sun3, and sun3x systems, you can do something like:
mksunbootcd output.iso boot-sun4.fs boot-sun4c.fs boot-sun4m.fs boot-sun3.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.
There are three steps involved in making a NetBSD/sparc64 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:
mkisofs -o output.iso -l -J -r -L /cdsources |
Now get a bootable floppy image. For NetBSD-1.6.1/sparc64, this image may be found at ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-1.6.1/sparc64/installation/misc/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
sunbootcd.sh
will perform this task. If sunbootcd.sh
is not installed on your system, it can be obtained from ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/src/distrib/common/sunbootcd.sh.
To use sunbootcd.sh
use the following:
sunbootcd.sh output.iso - - - - boot.fs |
The arguments are for bootable images for sun4, sun4c, sun4m, sun4d, and sun4u. Specifying a dash instead of a boot image means the CD will not be bootable for that platform. In the above example the only platform given a boot image is sun4u.
Note that sunbootcd.sh
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 sunbootcd.sh
without requiring extreme amounts
of data to be transfered over the network.
Be aware that sunbootcd.sh
will produce a CD that is not
recognized by vold under Solaris 10. If you want to mount the NetBSD
install CD under Solaris, you will first need to stop vold.
/etc/init.d/volmgt stop |
To make a NetBSD/sun2 bootable CD ROM, follow the procedure below for making a NetBSD/sun3 bootable CD ROM. This procedure makes a single CD ROM that will boot on both sun2 and sun3 systems.
Optional: When following the procedure below, it is beneficial
to uncompress the sun2 miniroot
(/cdsources/sun2/installation/miniroot.fs.gz
) and binary sets
(/cdsources/sun2/binary/sets/*.tgz
)
before writing the ISO 9660 image. This is entirely optional, and consumes
a lot of space on the ISO 9660 image, but saves time during installation
because decompression is very slow on the sun2.
There are three steps involved in making a NetBSD/sun3 bootable CD ROM, and this will result in a CD ROM that can also boot NetBSD/sun2.
Step 1 is to create an "almost" full ISO 9660 image of whatever you want to put on the CD. For example:
mkisofs -o output.iso -l -J -r -L /cdsources |
Now build a bootable ffs image. This image is currently not included in the release, so you have to put it together yourself.
mkdir /tmp/boot-sun3 cd /tmp/boot-sun3 gzip -cd < /cdsources/sun2/binary/kernel/netbsd.RAMDISK.gz > netbsd.sun2 ln netbsd.sun2 vmunix gzip -cd < /cdsources/sun3/binary/kernel/netbsd.RAMDISK.gz > netbsd.sun3 gzip -cd < /cdsources/sun3/binary/kernel/netbsd.RAMDISK3X.gz > netbsd.sun3x tar xzvf /cdsources/sun3/binary/sets/base.tgz ./usr/mdec mv usr/mdec/ufsboot . mv usr/mdec/bootxx /tmp/bootxx.sun3 rm -rf /tmp/boot-sun3/usr echo /set type=file uname=root gname=wheel mode=0755 > /tmp/boot-sun3.spec echo . type=dir >> /tmp/boot-sun3.spec echo ufsboot mode=0644 >> /tmp/boot-sun3.spec /bin/ls netbsd* vmunix >> /tmp/boot-sun3.spec makefs -t ffs -B be -F /tmp/boot-sun3.spec /tmp/boot-sun3.fs /tmp/boot-sun3 installboot -m sun3 -v /tmp/boot-sun3.fs /tmp/bootxx.sun3 ufsboot |
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
sysutils/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 /tmp/boot-sun3.fs |
Note that mksunbootcd
is also used to make a bootable CD ROM
for sparc systems. It is possible to make a bootable CD ROM that will
boot on sparc, sun2, sun3, and sun3x by doing something like:
mksunbootcd output.iso boot-sun4.fs boot-sun4c.fs boot-sun4m.fs boot-sun3.fs |
You can rearrange the ordering of the bootable filesystems in any way
you want; this only changes the partition numbers that the different
filesystems end up with, thus changing the partition number you need
to give to the PROM b
or boot
command to boot the
right filesystem for a given architecture.
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/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/installation/netboot cp -f install.ram.gz /cdsources/netbsd.vax.gz gunzip -f /cdsources/netbsd.vax.gz |
Now create the ISO 9660 image.
mkisofs -o output.iso -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:
installboot -m vax -v output.iso /usr/mdec/xxboot |
NetBSD-current has infrastructure in
src/distrib/cdrom
to build CDs which can boot multiple machines.
This has been used to build a four CD set containing thirty-nine platforms,
with eight platforms able to boot off the CDs.
This technique requires mkisofs
version 1.15a34 or newer.
Alternatively, multiple machine boot CDs can be created with the following manual procedure. 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 macppc, vax and on sun2, sun3 and sun3x. To create a CD which is bootable by multiple architectures, use the following steps in this order. Please note that the order is critical.
cdsources
directory called mdec.pmax
and include the pmax bootxx_cd9660
file there. For example,
/cdsources/usr/mdec.pmax/bootxx_cd9660
.
cdsources
directory called mdec.vax
and include the vax xxboot
file there. For example,
/cdsources/usr/mdec.vax/xxboot
.
ofwboot.xcf
bootloader in /cdsources
.
sh mkisofs -v -v -o output.iso -b i386/installation/floppy/boot-big.fs \ -c boot.catalog -l -J -r -L /cdsources 2>&1 | tee /tmp/mkisofs.log exit |
-v
flag twice is required. If you are
making a bootable CD for an Open Firmware 3 macppc model, make sure to include
-hfs -part
in the parameters for mkisofs
.
mksunbootcd
on a NetBSD/sparc machine to install sparc
and sun2/sun3 bootblocks. Alternatively, install the
sysutils/mksunbootcd
package on your favorite NetBSD machine.
mksunbootcd output.iso boot-sun4.fs boot-sun4c.fs boot-sun4m.fs boot-sun3.fs |
installboot -m pmax -v -o append,sunsum output.iso /tmp/mdec.pmax/bootxx_cd9660 |
-o append,sunsum
option appends the first stage boot block to
the end of the ISO file system, and restores the checksum used when booting
on a sun.
installboot -m vax -v -o append,sunsum output.iso /tmp/mdec.vax/xxboot |
installboot -m alpha -v -o append,sunsum output.iso /tmp/mdec.alpha/bootxx_cd9660 |
installboot(8)
that can calculate the alpha checksum.
(See the pmax entry above for an explanation of the flags).
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 use /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 |
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 |
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.berlios.de/pub/schily/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 |
The program cdrecord
may be used to burn the CD image to the
CD. cdrecord
is included in the
sysutils/cdrtools
package.
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
).
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.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ASPI32] "ErrorControl"=dword:00000001 "Start"=dword:00000001 "Type"=dword:00000001 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ASPI32\Parameters] "ExcludeMiniports"="" |
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.
(contact us) Generated from %NetBSD: bootcd.xml,v 1.6 2006/03/01 13:34:43 kano Exp %