From: Kern Sibbald Date: Sat, 3 Jan 2009 15:06:21 +0000 (+0000) Subject: More organization of USB boot key X-Git-Tag: Release-5.0.3~840 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7ac5267e468ba46ff5b9aaa7ca2497162ba6a3c1;p=bacula%2Frescue More organization of USB boot key --- diff --git a/rescue/linux/usb/README.usb b/rescue/linux/usb/README.usb index 06b3142..71d16f5 100644 --- a/rescue/linux/usb/README.usb +++ b/rescue/linux/usb/README.usb @@ -2,9 +2,31 @@ This directory is used to build a USB key containing a Kubuntu 8.04 LiveCD with persistent OS files and persistent /home files. +Note, the sqfs.tar.gz is the whole squashfs unsquashed. +The kernel image (vmlinuz) is a copy of the most recent kernel i.e. + sqfs/boot/vmlinuz-2.6.24-22-generic +and initrd.gz is a copy of the most recent initrd.img i.e + + sqfs/boot/initrd.img-2.6.24-22-generic + +they are renamed and put in the kubuntu8 partition in: + + casper/vmlinuz +and + casper/initrd.gz + +respectively. + +Note, initrd.gz is made after fixing the bug in +/usr/share/initramfs-tools/scripts/casper +see note 2. in bugs with Kubuntu boot process below. + +When updating the USB root partition (changing something), I +strongly recommend that you work with the disk image then +repack it (pack_disk_image) and then run load_disk_image. Packages needed: @@ -22,3 +44,6 @@ Bugs with Kubuntu boot process: 1. The initrd.gz image must be opened, fixed and the repacked. 2. The fix involves removing the ,mode=755 from the mount line for the persistent OS partition (casper-rw) or /cow +3. I have removed /etc/rc0.d/S89casper and /etc/rc6.d/S89casper + because they are related to a CDROM boot and create false + errors when booting from a USB key. diff --git a/rescue/linux/usb/config b/rescue/linux/usb/config new file mode 100644 index 0000000..950c280 --- /dev/null +++ b/rescue/linux/usb/config @@ -0,0 +1,40 @@ +# +# You must define certain environment variables in this file +# so that the scripts know where to find things. +# + +CWD=`pwd` + +# +# The device name of your USB device (e.g. /dev/sda) +# You can find it by plugging it in then doing +# +# fdisk -l +# +# If you are unsure remove the USB device and rerun the fdisk -l +# If you get this wrong, your harddisk could be wiped out. +# +USB_DEV=/dev/sda + +# +# When your USB key is mounted, what is the mount directory? +# +MOUNT_POINT=/media + +# +# This is where you downloaded the USB boot image +# +BOOT_IMAGE=${CWD}/kubuntu8.tar.gz + +# +# Disk image of boot partition of USB key -- this is where you +# unpacked the kubuntu8.tar.bz2 image. Unpacking the image +# is not necessary unless you want to change it. +# +DISK_IMAGE=${CWD}/kubuntu8 + +# +# If you are remastering a Ubuntu or Kubunto ISO (not normally done) +# Point to the ISO image +ISO_IMAGE= + diff --git a/rescue/linux/usb/load_disk_image b/rescue/linux/usb/load_disk_image new file mode 100755 index 0000000..34c1377 --- /dev/null +++ b/rescue/linux/usb/load_disk_image @@ -0,0 +1,19 @@ +#!/bin/sh +# +# tar the disk image +# +. ./config + +umount ${USB_DEV}1 +mkfs.vfat -F 16 -n kubuntu8 ${USB_DEV}1 +mount ${MOUNT_POINT}/kubuntu8 +if [ $? -ne 0 ] ; then + echo "Mount of USB boot partition failed." + exit 1 +fi +cd ${MOUNT_POINT}/kubuntu8 +if [ $? -ne 0 ] ; then + echo "Could not cd to USB boot partition" + exit 1 +fi +tar xfz ${BOOT_IMAGE} . diff --git a/rescue/linux/usb/loadsqfs b/rescue/linux/usb/loadsqfs new file mode 100755 index 0000000..9eea9e6 --- /dev/null +++ b/rescue/linux/usb/loadsqfs @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Load squashfs onto the USB key +# + +key=/media/kubuntu8 + +if [ ! -d $key/casper ] ; then + echo "Cannot find $key/casper directory -- possibly not mounted" + exit 1 +fi + +echo "Removing old squashfs" +rm -f $key/casper/filesystem.squashfs $key/casper/filesystem.manifest +rm -f $key/casper/filesystem.manifest-desktop + +echo "Copying new squashfs" +cp filesystem.manifest $key/casper/ +cp filesystem.manifest $key/casper/filesystem.manifest-desktop +cp filesystem.squashfs $key/casper/ +sync diff --git a/rescue/linux/usb/mountiso b/rescue/linux/usb/mountiso index e886530..7bce790 100755 --- a/rescue/linux/usb/mountiso +++ b/rescue/linux/usb/mountiso @@ -1,12 +1,6 @@ #!/bin/sh # - -if [ "x$1" != "x" ] ; then -ISOIMAGE=$1 -elif [ "x$ISOIMAGE" = "x" ] ; then - echo "Please specify the ISO on the command line or set the enviornment variable ISOIMAGE to point to your ISO" - exit 1 -fi +. ./config mkdir -p cdrom -mount -o loop -t iso9660 $ISOIMAGE cdrom +mount -o loop -t iso9660 $ISO_IMAGE cdrom diff --git a/rescue/linux/usb/pack_disk_image b/rescue/linux/usb/pack_disk_image new file mode 100755 index 0000000..f7767b0 --- /dev/null +++ b/rescue/linux/usb/pack_disk_image @@ -0,0 +1,13 @@ +#!/bin/sh +# +# tar the disk image +# +. ./config + +rm -f kubuntu8.tar.gz +cd $DISK_IMAGE +# Update checksum +find . -type f -print0 | xargs -0 md5sum >md5sum.txt +tar cfz $CWD/kubuntu8.tar.gz . +cd $CWD +ls -l kubuntu8.tar.gz diff --git a/rescue/linux/usb/packsqfs b/rescue/linux/usb/packsqfs index f0f71f8..927792b 100755 --- a/rescue/linux/usb/packsqfs +++ b/rescue/linux/usb/packsqfs @@ -1,3 +1,4 @@ #!/bin/sh # +rm -f filesystem.squashfs mksquashfs sqfs filesystem.squashfs diff --git a/rescue/linux/usb/partitionusbkey b/rescue/linux/usb/partitionusbkey index 7b91abf..825400a 100755 --- a/rescue/linux/usb/partitionusbkey +++ b/rescue/linux/usb/partitionusbkey @@ -4,6 +4,7 @@ # # First delete all existing partitions # +. ./config if [ ! `whoami` = "root" ] ; then echo "" @@ -11,27 +12,25 @@ if [ ! `whoami` = "root" ] ; then echo "" exit 1 fi -if [ "x$USB_DEVICE" = "x" ] ; then +if [ "x$USB_DEV" = "x" ] ; then if [ "x$1" = "x" ] ; then - echo "You must supply the USB device name on the command line or in USB_DEVICE" + echo "You must supply the USB device name on the command line or in USB_DEV" exit 1 else - dev=$1 + USB_DEV=$1 fi -else - dev=$USB_DEVICE fi echo "This script will distroy everything on $dev" -fdisk -l $dev +fdisk -l $USB_DEV echo " " echo "Answer yes to continue " read a if [ "$a" != "yes" ] ; then - echo "Device $dev unchanged" + echo "Device $USB_DEV unchanged" exit 1 fi -fdisk $dev </etc/apt/sources.list <filesystem.manifest