IN THEORY
In theory one should be able to boot a linux operating system on a CD and then redirected the boot process to a usb device.
This is done by setting up a cd with a linux kernel (I can say that without gnu right) and an "initial RAM disk" image (initrd). Since the kernel and initrd are copied into RAM during the boot up and run from there, it is not necessary for the CD to be in the drive for booting to finish. The thing now is to finish booting the operating system on the usb device.
0 - MODIFY YOUR TARGET KERNEL FOR USB SUPPORT
# A stock debian kernel will be missing the modules for including usb support. So they need to be added to the kernel use on the boot cd.
# The easiest thing to do (and the surest) is to use the kernel that is being used on the usb device.
# So boot into debian and mount the usb device partition that you have installed linux too.
# If this is a persistent configuration mount the partition labled home-rw, casper-rw or live-rw.
# These instructions will not work for a stock LiveCD imaged writen to a usb stick utilizing a squashfs setup.
Mind your root permission and the /mnt/sdX#
mkdir tmps
mount /dev/sdX# /tmps
# Edit the add the needed modules for your initrd.
cd tmps
vi etc/initramfs-tools/modules
Add the following, with i ;
Code: Select all
### This is a reminder that these modules have been added to allow a CD to boot a USB drive
usbcore
sd_mod
ehci_hcd
uhci_hcd
ohci_hcd
usb-storage
scsi_mod
:wq
# Edit etc/initramfs-tools/initramfs.conf to wait 15 seconds to allow the usb device to mount.
vi etc/initramfs-tools/initramfs.conf
Add the following, with i ;
Code: Select all
### This makes the bootup wait until any USB drives are ready
WAIT=15
:wq
# Now rebuild the initrd with the stuff just added.
# We are going to do this from chroot, but first must bind some mounted directories.
mount --bind /dev /tmps/dev
# Now chroot & re-build initrd
cd ..
chroot tmps
mount -a
ls /lib/modules
dpkg-reconfigure linux-image-<kernelversion_from _the_list_above>
exit
1 - MAKE A BOOTABLE CD
# We now need to use this new initrd image and the kernel on a boot cd and set up grub.
mkdir -p boot_tmps/grub
cp tmps/boot/initrd.img-<kernelversion> boot_tmps/boot/initrd.img
cp tmps/boot/vmlinuz-<kernelversion> boot_tmps/boot/vmlinuz
cp tmps/boot/grub/menu.lst boot_tmps/boot/grub/menu.lst
cp /usr/lib/grub/stage2_eltorito boot_tmps/boot/grub/stage2_eltorito
# Edit the menu.lst file.
vi boot_tmps/boot/grub/menu.lst
# It should lool something like this.
Mind the /mnt/sdX#
Code: Select all
title Custom Name
root (cd)
kernel /boot/vmlinuz root=/dev/sdX# ro quiet splash
initrd /boot/initrd.img
boot
title Custom Name Recovery Mode
root (cd)
kernel /boot/vmlinuz root=/dev/sdX# ro single
initrd /boot/initrd.img
boot
# I started out with a custom LiveCD added it to a USB device, so some more work needs to be done with the bootCD.
# The boot stuff for a LiveCD, and in my case a persistent install need to be included in the BootCD's menu.lst.
# Edit your boot_tmps/boot/grub/menu.lst to sute. Mine looks like this;
Code: Select all
title DebianLiveUSB Persistent
root (cd)
kernel /boot/vmlinuz root=/dev/sda3 boot=live union=aufs vga=791 persistent ro
initrd /boot/initrd.img
boot
# It is now time to make the cd bootable & to write the image to a cd.
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o BootCD2UCB.iso boot_tmps
cdrecord -v BootCD2USB.iso
4 - TYR IT OUT
# Now before you head off on your Hitchhiking tour across Europe, reboot your computer with the new CD but without the usb device connected. When the cd stops spinning & the install seems to stall, plug in the usb device. If all went to plan, the usb will be detected, and the booting will continue into your operating system.
Cheers