It's quite easy to have pleinty of distro on one USB key with a syslinux start menu to boot them. But some like Ubuntu and BackTrack 4 are using squashfs filesystem in a casper folder, and it is more difficult to make them work together.
For ubuntu, the Live Initrd has an option to specify the location of the casper folder. Since i decompressed ubuntu live cd in an ubuntu folder on my usb key, i added these options to syslinux:
ignore_uuid live-media-path=/ubuntu/casper
BackTrack's initrd does not support this parameter so you must have to patch it:
mkdir tmp
# put initrd.gz from BackTrack iso to tmp folder
cd tmp
gzip -dc initrd.gz | cpio -id
rm initrd.gz
patch -u scripts/casper < ../casper.patch
find . | cpio --quiet --dereference -o -H newc | gzip -9 > ../initrd-patched.gz
Then in your syslinux entry, use the new initrd-patched.gz instead of the original one.
The patched initrd image can be downloaded here. You can then use these parameters in your syslinux entry for BackTrack:
ignore_uuid live-media-path=/backtrack/casper
casper.patch:
--- tmp/scripts/casper 2010-01-11 22:15:21.464236536 -0500
+++ casper 2010-01-11 22:19:23.039237990 -0500
@@ -5,6 +5,7 @@
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
mountpoint=/cdrom
+LIVE_MEDIA_PATH=casper
root_persistence="casper-rw"
home_persistence="home-rw"
@@ -44,6 +45,10 @@
export STATICIP ;;
ignore_uuid)
IGNORE_UUID="Yes" ;;
+ live-media-path=*)
+ LIVE_MEDIA_PATH="${x#live-media-path=}"
+ export LIVE_MEDIA_PATH
+ echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" >> /etc/casper.conf ;;
esac
done
if [ "${UNIONFS}" = "" ]; then
@@ -53,10 +58,10 @@
is_casper_path() {
path=$1
- if [ -d "$path/casper" ]; then
- if [ "$(echo $path/casper/*.squashfs)" != "$path/casper/*.squashfs" ] ||
- [ "$(echo $path/casper/*.ext2)" != "$path/casper/*.ext2" ] ||
- [ "$(echo $path/casper/*.dir)" != "$path/casper/*.dir" ]; then
+ if [ -d "$path/$LIVE_MEDIA_PATH" ]; then
+ if [ "$(echo $path/$LIVE_MEDIA_PATH/*.squashfs)" != "$path/$LIVE_MEDIA_PATH/*.squashfs" ] ||
+ [ "$(echo $path/$LIVE_MEDIA_PATH/*.ext2)" != "$path/$LIVE_MEDIA_PATH/*.ext2" ] ||
+ [ "$(echo $path/$LIVE_MEDIA_PATH/*.dir)" != "$path/$LIVE_MEDIA_PATH/*.dir" ]; then
return 0
fi
fi
@@ -106,10 +111,10 @@
mount_images_in_directory() {
directory="$1"
rootmnt="$2"
- if match_files_in_dir "$directory/casper/*.squashfs" ||
- match_files_in_dir "$directory/casper/*.ext2" ||
- match_files_in_dir "$directory/casper/*.dir"; then
- setup_unionfs "$directory/casper" "$rootmnt"
+ if match_files_in_dir "$directory/$LIVE_MEDIA_PATH/*.squashfs" ||
+ match_files_in_dir "$directory/$LIVE_MEDIA_PATH/*.ext2" ||
+ match_files_in_dir "$directory/$LIVE_MEDIA_PATH/*.dir"; then
+ setup_unionfs "$directory/$LIVE_MEDIA_PATH" "$rootmnt"
else
:
fi
@@ -415,11 +420,11 @@
if [ -n "${SHOWMOUNTS}" ]; then
for d in ${rofslist}; do
- mkdir -p "${rootmnt}/casper/${d##*/}"
+ mkdir -p "${rootmnt}/${LIVE_MEDIA_PATH}/${d##*/}"
case d in
- *.dir) # do nothing # mount -o bind "${d}" "${rootmnt}/casper/${d##*/}"
+ *.dir) # do nothing # mount -o bind "${d}" "${rootmnt}/${LIVE_MEDIA_PATH}/${d##*/}"
;;
- *) mount -o move "${d}" "${rootmnt}/casper/${d##*/}"
+ *) mount -o move "${d}" "${rootmnt}/${LIVE_MEDIA_PATH}/${d##*/}"
;;
esac
done
2009-01-18 Update request
I was requested to give as example my syslinux config files. Here is the root filesystem of my usb key:
kha@box:/media/usbsys$ ls
backtrack clonezilla g4l gparted other slax slitaz syslinux sysrescue ubcd ubuntu
kha@box:/media/usbsys$
I have setup syslinux hidden boot file into the syslinux folder. The content of my syslinux folder can be downloaded from here.
Here is a preview of my bootable syslinux menu:

7 comments: