Here it is, ladies and gentlemen, the official Mark Sherman howto on preparing a USB thumb drive to be a bootable install media.
I'm gonna keep it short and to the point. You will need an Ubuntu 8.04 Alternative Install disk image and to download a few files from the web. I use the alternative install because it uses the text-based installer which is better for very small platform devices. You will need a computer already running linux. My instructions are for Ubuntu, but it uses pretty standard tools that should be available on your platform.
- Get a flash drive, format it to fat32 or vfat. Most come like this ready to go.
- Set the bootable flag on the partition. Use fdisk to do this (*nix required)
- I used sda here because that's often the first drive attached. Right after you plug in your drive, run dmesg to see what handler the device actually got assigned. Might be easier to run dmesg | grep /dev/sd Ignore the number on the end when invoking fdisk.
-
- Hit 'p' to display the partitions. There's probably only one. Hit 'a' to change the bootable flag. Enter the partition number. Check that it all worked with another 'p' command, then use 'w' to save and exit.
- Use SYSLINUX to make the stick bootable and install the bootloader.
- If you don't have syslinux installed, install it: apt-get install syslinux
- syslinux -s /dev/sda1
- This time you need to include the partition number. Flash drives generally only have one partition. This will modify the boot sector of the drive and place a file called ldlinux.sys. When this is complete, it may be a good idea to unmount the drive, stick in the system you want it to boot from and give it a test. You should get a boot: prompt that doesn't do anything. Once you're there, you know you can boot from the drive, so let's stick in back in the big computer and put the installer on it.
- Mount the install iso to the local filesystem. Do this however you please, but if you'd like to use the command line, here ya go.
- sudo mount -o loop ubuntu-8.04.1-alternate-i386.iso /mnt/tmp
- This will mount that image file to the directory /mnt/tmp (which needs to exist). You can mount it wherever you want. This can only be done as root. Once this is done, navigating to /mnt/tmp will be looking inside the iso file. Pretty neat, huh?
- Copy the 'install' and 'isolinux' directories from the mounted iso the thumb drive. We're now done with the mounted iso, you can unmount it if you like.
- Rename the 'isolinux' directory to be called 'syslinux' on the USB drive.
- Go into the new 'syslinux' directory and rename 'isolinux.cfg' to 'syslinux.cfg
- Why are we renaming this stuff? Because isolinux is the program that loads linux from a CD. We've already installed syslinux to load it from a hard-drive like device (a system disk), but we want it to use the existing configuration files. Just rename them and syslinux will never know that the configs were originally intended to be on a CD.
- Go to http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current...
- Download initrd.gz and vmlinuz and put them onto the flash drive in the install directory, replacing the existing files by those names.
- These versions of the files will load the iso properly. If you don't do this, the installer will think it's on a CD and try to load the install libraries from the CD device, which of course won't work. Change over to the replacements and it will search the boot disk for an iso image, mount it, and install from there.
- Copy the entire iso file, not the contents, but the iso itself, to the root directory of the flash drive. You can unmount the iso