Creating a Bootable USB Stick
Requirements for this are
- a Linux kernel - take it from your Debian installation,
- a compatible set of modules packed into an initrd image (see Creating the Initial RAM Disk),
- the Debian image you want to load into RAM (see Creating the Debian Image),
- syslinux installed on your normal Debian system, "
apt-get install syslinux" if not already done,
- and (of course) the USB stick.
I expect bootable USB stick to be common today even if I had some difficulties with mine. USB boot support by your PC is can also be a source of problems.
Using a vfat USB stick
I think this is the most common scenario since all USB sticks come with vfat out of the box. But before going to the how-to, let's look at possible roadblocks:
- One USB stick (which I know was bootable before) refused to be a boot medium at all.
- Another was unable to host syslinux as boot loader but reformatting the drive with ext2 and applying extlinux to it worked.
- A third (fresh out of the box) displayed the syslinux boot prompt but syslinux stopped working while loading files first. This was due to
- One final problem might be the absence of required NLS modules. The default initrd image support codepage 497 and iso8859-1.
Here is how to proceed.
- Plug the USB stick into a USB port, make sure that you know the device name (run "
tail -f /var/log/messages" or appropriate while plugging).
- Do not mount the device yet.
- Assuming that the device name /dev/sdx and /dev/sdx1 (x is usually a, b, etc.) is the FAT partition, install the syslinux bootloader by running the command
# sylinux /dev/sdx1
- Then mount the device
# mount /dev/sdx1 disk
- and copy the kernel, the initrd and the linux image to it:
# cp vmlinuz-2.6.18-4-686 disk/vmlinuz # cp initrd.img-2.6.18-4-686 disk/initrd.cgz # linux.tgz disk/linux.tgz
Use only 8.3-style filenames. Although the filesystem is vfat, it's syslinux that requires short filenames.
- Create the file syslinux.cfg in the USB stick's root directory. It should look like
default latest timeout 100 prompt 1 label linux kernel vmlinuz append initrd=initrd.cgz im=linux.tgz label test kernel vmlinuz append initrd=initrd.cgz im=test-linux.cgz label latest kernel vmlinuz append initrd=initrd.cgz im=latest.cgz
Ignore that the configuration names image files which do not exist yet.
Ready, unmount the stick and try to boot from it.
The complete syslinux documentation can be found under syslinux.zytor.com.