4.4. Preparing Files for USB Memory Stick Booting

For preparing the USB stick you will need a system where GNU/Linux is already running and where USB is supported. You should ensure that the usb-storage kernel module is loaded (modprobe usb-storage) and try to find out which SCSI device the USB stick has been mapped to (in this example /dev/sda is used). To write to your stick, you will probably have to turn off its write protection switch.

Note, that the USB stick should be at least 128 MB in size (smaller setups are possible if you follow Section 4.4.2, “Copying the files — the flexible way”).

4.4.1. Copying the files — the easy way

There is an all-in-one file hd-media/boot.img.gz which contains all the installer files (including the kernel) as well as yaboot and its configuration file. Create a partition of type "Apple_Bootstrap" on your USB stick using mac-fdisk's C command and extract the image directly to that:

# zcat boot.img.gz > /dev/sda2

Warning

Using this method will destroy anything already on the device. Make sure that you use the correct device name for your USB stick.

After that, mount the USB memory stick (mount /dev/sda2 /mnt), which will now have an HFS filesystem on it, and copy a Debian netinst or businesscard ISO image to it. Please note that the file name must end in .iso. Unmount the stick (umount /mnt) and you are done.

4.4.2. Copying the files — the flexible way

If you like more flexibility or just want to know what's going on, you should use the following method to put the files on your stick.

4.4.2.1. USB stick partitioning on PowerPC

Most USB sticks do not come pre-configured in such a way that Open Firmware can boot from them, so you will need to repartition the stick. On Mac systems, run mac-fdisk /dev/sda, initialise a new partition map using the i command, and create a new partition of type Apple_Bootstrap using the C command. (Note that the first "partition" will always be the partition map itself.) Then type

$ hformat /dev/sda2

Take care that you use the correct device name for your USB stick. The hformat command is contained in the hfsutils Debian package.

In order to start the kernel after booting from the USB stick, we will put a boot loader on the stick. The yaboot boot loader can be installed on an HFS filesystem and can be reconfigured by just editing a text file. Any operating system which supports the HFS file system can be used to make changes to the configuration of the boot loader.

The normal ybin tool that comes with yaboot does not yet understand USB storage devices, so you will have to install yaboot by hand using the hfsutils tools. Type

$ hmount /dev/sda2
$ hcopy -r /usr/lib/yaboot/yaboot :
$ hattrib -c UNIX -t tbxi :yaboot
$ hattrib -b :
$ humount

Again, take care that you use the correct device name. The partition must not be otherwise mounted during this procedure. This procedure writes the boot loader to the partition, and uses the HFS utilities to mark it in such a way that Open Firmware will boot it. Having done this, the rest of the USB stick may be prepared using the normal Unix utilities.

Mount the partition (mount /dev/sda2 /mnt) and copy the following files from the Debian archives to the stick:

  • vmlinux (kernel binary)

  • initrd.gz (initial ramdisk image)

  • yaboot.conf (yaboot configuration file)

  • boot.msg (optional boot message)

  • Optional kernel modules

The yaboot.conf configuration file should contain the following lines:

default=install
root=/dev/ram

message=/boot.msg

image=/vmlinux
        label=install
        initrd=/initrd.gz
        initrd-size=10000
        append="devfs=mount,dall --"
        read-only

Please note that the initrd-size parameter may need to be increased, depending on the image you are booting.

4.4.2.2. Adding an ISO image

Now you should put any Debian ISO image (businesscard, netinst or even a full one) onto your stick (if it fits). The file name of such an image must end in .iso.

If you want to install over the network, without using an ISO image, you will of course skip the previous step. Moreover you will have to use the initial ramdisk from the netboot directory instead of the one from hd-media, because hd-media/initrd.gz does not have network support.

When you are done, unmount the USB memory stick (umount /mnt) and activate its write protection switch.