User Tools

Site Tools


how_to_create_a_bootable_cd-rom_usb_stick_i386_amd64

This document attempts to explain how to make bootable NetBSD CD ROMs & USB Flash Drives.

Overview

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 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/.....

Creating USB Stick image

With an downloaded image

From NetBSD 5.1.2 on for the i386 and amd64 ports it is possible to download a memory stick image for installing instead of the CD-ROM image. NetBSD using a memory stick instead of a CD-ROM drive From NetBSD 5.1.2 on it is possible to download a memory stick image directly for installing instead of downloading and transforming a CD image.

Downloading the installation image

Installation images are available on the NetBSD mirrors under the images/ directory, their filenames match the *install.img.gz pattern.

For example if we want to download NetBSD 6.0_BETA2 for i386:

  # ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0_BETA2/images/NetBSD-6.0_BETA2-i386-install.img.gz

Platform specific instructions

NetBSD/alpha

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 -allow-leading-dots /cdsources

The second step is to install NetBSD/alpha disk and CD ROM bootstrap software using MAN.INSTALLBOOT.8. This is done with the following command:

  installboot -m alpha -v output.iso /tmp/mdec.alpha/bootxx_cd9660

NetBSD/i386

This section shows how to make a NetBSD/i386 bootable CD ROM. The particular example is how to make a NetBSD-3.0/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-3.0/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 -allow-leading-dots /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
  • -allow-leading-dots – Allows filenames to begin with “.”, was -L in older versions of mkisofs.
  • /cdsources – Specifies that the directory /cdsources is the root of the CD image

NetBSD/macppc

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-3.0/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 -allow-leading-dots /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

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 -allow-leading-dots /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

NetBSD/sgimips

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).

NetBSD/sparc

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 -allow-leading-dots /cdsources

Now get a bootable floppy image. For NetBSD-3.0/sparc, this image may be found at ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-3.0/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 transferred over the network.

NetBSD/sparc64

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 -allow-leading-dots /cdsources

Now get a bootable floppy image. For NetBSD-3.0/sparc64, this image may be found at ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-3.0/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 transferred 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

NetBSD/sun2

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.

NetBSD/sun3

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 -allow-leading-dots /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 transferred over the network.

NetBSD/vax

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 -allow-leading-dots /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

Multiple Machine

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.

  • Make sure you have all the required files including the various kernels and boot programs listed in the individual machine sections.
  • Include a directory somewhere in the cdsources directory called mdec.pmax and include the pmax bootxx_cd9660 file there. For example, /cdsources/usr/mdec.pmax/bootxx_cd9660.
  • Include a directory somewhere in the cdsources directory called mdec.vax and include the vax xxboot file there. For example, /cdsources/usr/mdec.vax/xxboot.
  • Include the macppc ofwboot.xcf bootloader in /cdsources.
  • Create an i386 bootable image.
sh
mkisofs -v -v -o output.iso -b i386/installation/floppy/boot-big.fs \ 
  -c boot.catalog -l -J -r -allow-leading-dots /cdsources 2>&1 | tee /tmp/mkisofs.log
exit

Note that the appearance of the -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.

  • Run 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

.

  • Run the installboot(8) program targeted for NetBSD/pmax to install the pmax bootblocks. Note that in order to coexist with other NetBSD boot blocks, the pmax boot block is appended to the end of the ISO file system.
installboot -m pmax -v -o append,sunsum output.iso /tmp/mdec.pmax/bootxx_cd9660

The -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.

  • Run the installboot(8) program targeted for NetBSD/vax to install the vax bootblocks. Note that in order to coexist with other NetBSD boot blocks, the vax boot block is appended to the end of the ISO file system.
installboot -m vax -v -o append,sunsum output.iso /tmp/mdec.vax/xxboot

(See the pmax entry above for an explanation of the flags).

  • Run the installboot(8) program targeted for NetBSD/alpha to install the alpha bootblocks.
installboot -m alpha -v -o append,sunsum output.iso /tmp/mdec.alpha/bootxx_cd9660

Note that the alpha installboot must occur after the others, because currently it's the only machine dependent back-end for installboot(8) that can calculate the alpha checksum. (See the pmax entry above for an explanation of the flags).

Examining the CD image

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

Under NetBSD

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

Under Linux

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

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

Burning the CD

Using cdrecord (U*nix)

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).

Under Windows

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.

  • CDRWIN. Commercial software that can create bootable (by i386) ISO 9660 images and write them to CD.
  • FILE2CD. Freeware program which can write an ISO 9660 image to CD.
  • Roxio Easy CD Creator. Commercial software.
  • Ahead Nero Burning ROM. Commercial software.
  • CDRECORD. Free software that can create bootable ISO 9660 images and write them to CD. This does not include a graphical interface, it is command line only. This depends on an ASPI driver, which is available here. For IDE drives you will need to modify your registry:
[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"=""

Under Mac OS

On Mac OS X, the program hdiutil may be used to burn the ISO image to the CD.

An example of the use of hdiutil is the following:

  hdiutil burn output.iso -verbose -noverifyburn

You may need to use additional options which are documented in the hdiutil documentation.

There are also several other programs available for Mac OS 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.

Moving the installation image to the memory stick

Getting the downloaded image to the USB flash drive

To prepare the memory stick under a Unix system you can just use dd(1). For example if the memory stick is recognized as sd0 (Warning: this will overwrite all the contents on your memory stick):

  # gunzip NetBSD-6.0_BETA2-i386-install.img.gz
  # dd if=NetBSD-6.0_BETA2-i386-install.img of=/dev/rsd0d

Whenever using dd(1), remember to set the blocksize by specifying the bs parameter, at least with a value of 4K, i.e. the call would end up with:

  # dd if=NetBSD-6.0_BETA2-i386-install.img of=/dev/rsd0d bs=4K
  

Installing NetBSD from USB flash drive

Installation process with downloaded image

After NetBSD is booted from the memory stick the installation process is usual (you can find an example in The NetBSD Guide). Just pay attention when choosing the installation media: if you want to install using the installation sets on the memory stick when choosing the installation media select

g: local directory

and then clear the base (by default it points to release/).

Other methods for Installing NetBSD from USB flash drive

Easy method using mkmemstick.sh

Create an image using mkmemstick.sh

This script depends on the sysutils/cdrtools package.

  • Fetch a copy of the ISO you wish to install along with mkmemstick.sh
  • Create a disk image from the ISO:
$ sh mkmemstick.sh i386cd-5.0.1.iso i386memstick-5.0.1.img
  • Write the newly created image to the memory stick as root:
# dd if=i386memstick-5.0.1.img of=/dev/sd0d<.

Manual method

Make the Memory Stick bootable

  • Install the Master Boot Record (MBR):
# fdisk -i /dev/rsd0d
  • Create an fdisk partition for NetBSD:
# fdisk -u /dev/rsd0d

Disk: /dev/rsd0d

NetBSD disklabel disk geometry:

cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)

total sectors: 997375

BIOS disk geometry:

cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)

total sectors: 997375

Do you want to change our idea of what BIOS thinks? [n] n

Partition table:

0: Primary DOS with 32 bit FAT (sysid 11)

   start 8, size 997367 (487 MB, Cyls 0-973/127/8)

1:

2:

3:

Bootselector disabled.

Which partition do you want to change?: [none] 0

The data for partition 0 is:

Primary DOS with 32 bit FAT (sysid 11)

   start 8, size 997367 (487 MB, Cyls 0-973/127/8)

sysid: [0..255 default: 11] 169

start: [0..974cyl default: 8, 0cyl, 0MB] (RETURN)

size: [0..974cyl default: 997367, 974cyl, 487MB]

bootmenu: [] (RETURN)

Partition table:

0: NetBSD (sysid 169)

   start 8, size 997367 (487 MB, Cyls 0-973/127/8)

1:

2 :

3:

Bootselector disabled.

Which partition do you want to change?: [none] (RETURN)

We haven't written the MBR back to disk yet.  This is your last chance.

Partition table:

0: NetBSD (sysid 169)

   start 8, size 997367 (487 MB, Cyls 0-973/127/8)

1:

2:

3:

Bootselector disabled.

Should we write new partition table? [n] y
  • Set the NetBSD partition active (it's partition Number 0):
# fdisk -a /dev/rsd0d

Disk: /dev/rsd0d

NetBSD disklabel disk geometry:

cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)

total sectors: 997375

BIOS disk geometry:

cylinders: 974, heads: 128, sectors/track: 8 (1024 sectors/cylinder)

total sectors: 997375

Partition table:

0: NetBSD (sysid 169)

   start 8, size 997367 (487 MB, Cyls 0-973/127/8)

1:

2:

3:

Bootselector disabled.

Do you want to change the active partition? [n] y

Choosing 4 will make no partition active.

active partition: [0..4 default: 4] 0

Are you happy with this choice? [n] y
  • Create the NetBSD disklabel and add the partitions “a” and “d”:
# disklabel -i -I sd0

partition> a

Filesystem type [?] [MSDOS]: 4.2BSD

Start offset ('x' to start after partition 'x') [0.0078125c, 8s, 0.00390625M]: 63

Partition size ('$' for all remaining) [973.991c, 997367s, 486.996M]: $

partition> d

Filesystem type [?] [unused]: (RETURN)

Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: (RETURN)

Partition size ('$' for all remaining) [973.999c, 997375s, 487M]: (RETURN)

partition> W

Label disk [n]? y

Label written

We haven't written the MBR back to disk yet.  This is your last chance.

Should we write new partition table? [n] y
  • Create a new NetBSD filesystem on partition sd0a:
# newfs /dev/rsd0a
  • Make the partition sd0a bootable:
# mkdir /stick

# mount /dev/sd0a /stick

# cp /usr/mdec/boot /stick

# umount /stick

# installboot -v -o timeout=1 /dev/rsd0a /usr/mdec/bootxx_ffsv1

Copy the installation sets to the Memory Stick

  • For the installation you need an installation kernel and the installation sets. To get them, fetch for example a NetBSD CD-image file from a local FTP-Mirror 1:
$ cd /home/mark
$ ftp -a ftp://ftp.netbsd.org/pub/NetBSD/iso/4.0.1/i386cd-4.0.1.iso
  • Mount the CD-image file:
    $ su
    # mkdir /image
    # vnconfig -c vnd0 /home/mark/i386cd-4.0.1.iso
    # mount_cd9660 /dev/vnd0d /image
  • Mount the Memory Stick and copy the Install kernel and sets:
    # mount /dev/sd0a /stick
    # cp /image/i386/binary/kernel/netbsd-INSTALL.gz /stick/netbsd.gz
    # cp -R /image/i386/binary/sets /stick/sets
    # umount /stick
    # rmdir /stick
  • Umount the CD-image:
    # umount /image
    # vnconfig -u vnd0
    # rmdir /image

The Memory Stick is now ready to boot the NetBSD-Install system. Just reboot and change your BIOS to boot the USB Memory Stick.

The installation process

If the Memory Stick boots fine, proceed with the Installation as usual, but the selection of the Install-sets is not quite intuitive:

    "Your disk is now ready for installing the kernel and the distributions sets [...]"

    [...]

    Install from

    f: Unmounted fs

Press RETURN and the following screen appears:

    "Enter the unmounted local device and directory on that device where the distribution is located. [...]"

Choose the following options:

    a: Device             sd0a

    b: File system        ffs

    c: Base directory       

    d: Set directory      /sets

Yes, “c: Base directory” is left empty, because we had copied the distribution .tgz files to the /sets directory on the Memory Stick (9.)

Now continue with the installation as usual. Good luck!

Alternative Method

An alternative setup method saves space on the Stick at the expense of sysinst automation and is therefore more advanced. This method skips the sysinst tool by copying the sets and the normal GENERIC Kernel instead of the install-Kernel.

Extract the sets from the harddisk directly on to the Memory stick (/mnt).

  # tar xvfzp sets.tgz -C /mnt 

Extract the Kernel to the target root

  # tar xvfzp GENERIC-kernel.tgz -C /mnt

All you need to do is now to create a valid /etc/fstab and modify /etc/rc.conf to RC_CONFIGURED=yes on the target root (/mnt) and reboot. All fine tuning can be done, when you're logged in.

how_to_create_a_bootable_cd-rom_usb_stick_i386_amd64.txt · Last modified: 2012/12/01 17:28 by dborisov