[Voyage-linux] HowTo: Voyage Linux on a USB flash drive

Kim-man "Punky" TSE (spam-protected)
Thu May 18 13:07:49 HKT 2006


Thanks Danny.  Could submit this how-to to wiki.voyage.hk?

- Punky


Danny Adair wrote:
> Voyage Linux on USB flash drive
>
> Author:      Danny W. Adair <danny at adair.net>
> Last Change: 18 May 2006
> ------------------------------------------------------------
>
>
> Voyage Linux won't work "on" USB storage devices out of the box.
> This is how I did get it working:
>
> --------------------
> Summary
> --------------------
> - We will make two partitions on the USB key, one for the boot loader
> and the kernel, one for the rest of the system. We need a separate
> partition for the kernel because of BIOS limitations (grub error 18
> someone?).
>
> - We'll get and unpack the current Voyage Linux distribution. It's got
> advantages over 0.2 and I hope it's going to be a stable release soon.
>
> - Voyage's "stock" kernel can't load the USB modules for mounting / to
> the second partition because that's a Catch-22: they're sitting on a
> USB drive partition! The solution is to recompile the kernel with this
> support built-in (hooray - we've got nothing better to do!): After
> recompiling the kernel and making a .deb package for it, we chroot
> into voyage on the host computer and install the new kernel.
>
> - We'll install voyage on the USB key, and it'll have our shiny new 
> kernel.
>
> - We'll make minor adjustments to the installation on the USB key
> which the installation script currently doesn't do for us (Voyage
> seems to have its focus on Compact Flash drives, which are "real" IDE,
> and "hda" is assumed to be the target disk for voyage. We adjust that
> to "sda".
>
>
>
> ####################
> Make sure you do all this as root.
> ####################
>
>
> --------------------
> 1. Prepare USB key
> --------------------
> Make sure the right device driver is loaded: On my system EHCI was
> loaded instead of UHCI. Just rmmod ehci_hcd, modprobe uhci_hcd and
> then put the USB key in. The EHCI driver may look like it's working -
> if you get I/O errors, switch.
> a) Use fdisk or cfdisk to create one small bootable (make it at least
> 3MB, it needs to fit a kernel image) and one big (=rest) Linux
> partition.
> b) Create ext2 file systems on the partitions and turn off automated 
> fsck:
>   # mkfs.ext2 /dev/sda1
>   # tune2fs -c 0 /dev/sda1
>   # mkfs.ext2 /dev/sda2
>   # tune2fs -c 0 /dev/sda2
> Your USB key is now ready for installation.
>
> --------------------
> 2. Download voyage and kernel source
> --------------------
> # mkdir ~/voyage-build
> # cd ~/voyage-build
> or whatever directory you would like to put this in
> # wget http://www.voyage.hk/download/voyage/voyage-current.tar.gz
> # wget 
> http://www.voyage.hk/dists/unstable/kernel/kernel-source-2.6.15-voyage_3.0-1_all.deb 
>
> # wget 
> http://www.voyage.hk/download/kernel_config/config-2.6.15-486-voyage_3.0-1 
>
> You now have all you need for the installation.
>
> --------------------
> 3. Recompile kernel for built-in USB storage support
> --------------------
> I assume you have all necessary packages (make, gcc, kernel-package,
> etc.) installed on your host computer.
> a) Install source and unpack:
>   # dpkg -i ~/voyage-build/kernel-source-2.6.15-voyage_3.0-1_all.deb
>   # cd /usr/src/
>   # tar xjvf kernel-source-2.6.15-voyage.tar.bz2
> b) Copy the "stock" voyage kernel configuration to the source tree:
>   # cd kernel-source-2.6.15-voyage
>   # cp ~/voyage-build/config-2.6.15-486-voyage_3.0-1 .config
> c) Ensure all the necessary drivers will be built-in:
>   # make menuconfig
>   You can navigate with cursor keys, select with enter, one level up
> with escape.
>   Make sure the following are included (marked as "*" by hitting 'y'):
>   - Device Drivers -> USB support -> Support for Host-side USB
>   - Device Drivers -> USB support -> UHCI HCD
>   (or OHCI HCD depending on the controller on your target computer -
> hopefully even EHCI HCD (USB 2.0) - not in my case)
>   - Device Drivers -> USB support -> USB Mass Storage support
>   - Device Drivers -> SCSI device support -> legacy /proc/scsi/ support
>   - Device Drivers -> SCSI device support -> SCSI disk support
>   Escape out and say "yes" to save the new kernel configuration.
> c) Compile the new kernel as a debian package:
>   # make-kpkg --revision="3.0USB" --append-to-version "-486-voyage"
> kernel-image
>   You can change the revision string if you like, I just want to
> indicate what this kernel will (additionally) be for.
>   Now this usually takes a while...
> d) A shiny new kernel package (in my case called
> "kernel-image-2.6.15.6-ubuntu1-486-voyage_3.0USB_i386.deb") should now
> be sitting in /usr/src/.
>
> --------------------
> 4. Unpack voyage
> --------------------
> a) # cd ~/voyage-build/
>   # tar --numeric-owner -zxvf voyage-current.tar.gz
>
> --------------------
> 5. Install new kernel in voyage
> --------------------
> We will need to do the old chroot procedure (see "Manual
> Customizations" in the Voyage wiki).
> a) Copy the new kernel into voyage:
>   # cp /usr/src/kernel-image-2.6.15.6-ubuntu1-486-voyage_3.0USB_i386.deb
> voyage-current/usr/src/
> b) Get voyage ready for changes:
>   # cd voyage-current/
>   # cp -r ro/* rw/
>   # cd ..
>   # chroot voyage-current/
>   # mount -t proc none /proc
> c) Install the new kernel
>   # dpkg -i 
> /usr/src/kernel-image-2.6.15.6-ubuntu1-486-voyage_3.0USB_i386.deb
>   - Say no to creating a boot floopy
>   - Say no to booting Linux from the hard disk
> d) Leave the voyage "changes" environment:
>   # umount /proc
>   # exit
> e) To save space on the target, you can delete the kernel package from
> voyage now:
>   # rm 
> voyage-current/usr/src/kernel-image-2.6.15.6-ubuntu1-486-voyage_3.0USB_i386.deb 
>
> NOTE: You're installing on a "fresh" key. Subsequent installations
> will change files differently. Shouldn't be too hard to figure out.
>
> --------------------
> 6. Install voyage on USB key, adjust parameters for USB
> --------------------
> Make sure your USB key is plugged in but not mounted.
> a) # cd ~/voyage-build/voyage-current
> b) Adjust the file system table of voyage: / will be mounted to sda2:
>   # vi etc/fstab
>   (vi or whatever editor you prefer)
>   - Change "/dev/hda1" to "/dev/sda2" in the first line
> c) # mkdir /mnt/usbkey1
>   # mkdir /mnt/usbkey2
>   Or wherever you would like to temporarily mount the key for 
> installation.
>   We'll be working on two partitions (and will need to copy from one
> to the other) so I'm using two directories.
>   /mnt/usbkey2 will be used now, /mnt/usbkey1 will be needed in (the
> last) step 7.
> d) # ./voyage_update
>   Specify correct disk (/dev/sda), voyage partition (2 -> /dev/sda2),
> bootstrap partition (1 -> /dev/sda1),
>   temporary mount point (/mnt/usbkey2), and module 5 "Generic PC".
>   Choose grub instead of lilo.
>   You should get some congratulations soon. :-)
> e) Adjust the grub parameters on the boot partition (I hope this will
> become part of the voyage_update script):
>   # mount /dev/sda1 /mnt/usbkey1/
>   # vi /mnt/usbkey1/grub/menu.lst
>   (vi or whatever editor you prefer)
>   - Change "kernel /vmlinuz root=/dev/hda2" to "kernel /vmlinuz
> root=/dev/sda2 rootdelay=10"
>   - Change "root (hd0,1)" to "root (hd0,0)" - I think this is a bug
> in the voyage_update script (it puts the voyage instead of the
> bootstrap partition here).
> f) Provide a device map, so that grub knows what hd0 is in this case:
>   # echo '(hd0) /dev/sda' > /mnt/usbkey1/grub/device.map
>
> --------------------
> 7. Copy kernel to boot partition
> --------------------
> We told grub that the kernel is at /vmlinuz, but it's on the other
> partition at the moment. Move the kernel over to the grub partition:
> a) /mnt/usbkey1 should still be mounted from the last steps, mount the
> voyage partition:
>   # mount /dev/sda2 /mnt/usbkey2/
> b) Move the entire "boot" directory to the grub partition - we'll be
> booting from there:
>   # mv    /mnt/usbkey2/boot/ /mnt/usbkey1/
> c) Don't forget the symbolic link "/vmlinuz":
>   # mv /mnt/usbkey2/vmlinuz/ /mnt/usbkey1/
>   You might have to adjust the link to point to the new kernel:
>   # cd /mnt/usbkey1
>   # rm vmlinuz
>   # ln -s boot/vmlinuz-2.6.15.6-ubuntu1-486-voyage vmlinuz
>   # cd ..
> d) Done. Unmount the USB key partitions:
>   # umount /dev/sda1
>   # umount /dev/sda2
> e) Delete the "boot" directory from your host voyage so it doesn't get
> re-installed next time:
>   # rm -R ~/voyage-build/voyage-current/boot/
>
> --------------------
> 8. Smile
> --------------------
> Put the key into the target computer and turn it on.
>
> a) If you're not happy, tell me.
>   I'll put problems (and hopefully their solutions) in the following
> "Troubleshooting" section.
> b) If you're happy, tell others. :-)
>
> --------------------
> Troubleshooting
> --------------------
> wfm
>
> _______________________________________________
> Voyage-linux mailing list
> Voyage-linux at list.voyage.hk
> http://list.voyage.hk/mailman/listinfo/voyage-linux


-- 
Regards,
Punky

P U N K N ! X  . c o m
Technology + Lifestyle
(http://www.punknix.com)

V O Y A G E . H K - http://www.voyage.hk
Linux - voyage-0.2 is released!
Store - Senao NMP-8602 Plus (400mW) is now in stock! 









More information about the Voyage-linux mailing list