Creating a Bootable USB Stick

Requirements for this are

  1. a Linux kernel - take it from your Debian installation,

  2. a compatible set of modules packed into an initrd image (see Creating the Initial RAM Disk),

  3. the Debian image you want to load into RAM (see Creating the Debian Image),

  4. syslinux installed on your normal Debian system, "apt-get install syslinux" if not already done,

  5. 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:

Here is how to proceed.

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

  2. Do not mount the device yet.

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

  4. Then mount the device

    # mount /dev/sdx1 disk
    

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

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

See also

The complete syslinux documentation can be found under syslinux.zytor.com.