Partitioning and adding a boot loader
We will show how to set up the memory stick to use the first partition,
instead of the entire device.
In order to start the kernel after booting from the USB stick, we will
put a boot loader on the stick. Although any boot loader
should work, it's convenient to use
syslinux, since it uses a FAT16 partition and can
be reconfigured by just editing a text file. Any operating system
which supports the FAT file system can be used to make changes to the
configuration of the boot loader.
First, you need to install the syslinux and
mtools packages on your system.
Since most USB sticks come pre-configured with a single FAT16
partition, you probably won't have to repartition or reformat the
stick. If you have to do that anyway, use cfdisk
or any other partitioning tool to create a FAT16 partition now
Don't forget to activate the bootable
flag.
, and then install an MBR using:
# cat /usr/lib/syslinux/mbr/mbr.bin >/dev/sdX
Now create the filesystem using:
# mkdosfs /dev/sdX1
Take care that you use the correct device name for your USB stick. The
mkdosfs command is contained in the
dosfstools &debian; package.
Having a correctly partitioned USB stick (now), you need to put
syslinux on the FAT16 partition with:
# syslinux /dev/sdX1
Again, take care that you use the correct device name. The partition
must not be mounted when starting syslinux. This
procedure writes a boot sector to the partition and creates the file
ldlinux.sys which contains the boot loader code.
Adding the installer files
There are two different installation variants to choose here:
The hd-media variant needs an installation ISO file on the stick,
to load installer modules and the base system from.
The netboot installer however will load all that from a &debian; mirror.
According to your choice, you have to download some installer files from
the hd-media or netboot subdirectory of
debian/dists/&releasename;/main/installer-&architecture;/current/images/
on any &debian; mirror:
vmlinuz or linux (kernel binary)
initrd.gz (initial ramdisk image)
You can choose between either the text-based version of the installer (the
files can be found directly in hd-media or netboot) or the graphical
version (look in the respective gtk subdirectories).
Then mount the partition
(mount /dev/sdX1 /mnt)
and copy the downloaded files to the root directory of the stick.
Next you should create a text file named syslinux.cfg
in the root directory of the stick as configuration file for syslinux, which at
a bare minimum should contain the following line:
default vmlinuz initrd=initrd.gz
Change the name of the kernel binary to linux
if you used files from netboot.
For the graphical installer (from gtk) you should add
vga=788 at the end of the line. Other parameters can be
appended as desired.
To enable the boot prompt to permit further parameter appending, add a
prompt 1 line.
If you used files from hd-media, you should now copy the
ISO file of a &debian; installation image onto the stick. (For the
netboot variant this is not needed.)
You can use either a netinst or a full CD/DVD image (see
). Be sure to select one that fits on your stick.
Note that the netboot mini.iso
image is
not usable for this purpose.
When you are done, unmount the USB memory stick
(umount /mnt).