summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-08-06 13:26:46 (GMT)
committer Jaromil <jaromil@dyne.org>2011-08-06 13:26:46 (GMT)
commit9d96bda3dae3d7eef258e53adeb889f2217c4daf (patch)
treedac1da9eb784dfee273acc9ec0f8544a1da74d4a
parent5f57186599356a7ebfb921ae3016a64c87a8a9d6 (diff)
fixes to correctly repach and boot from usb/grub2
requires modifications to scripts/live in initrd to support vfat partitions
-rwxr-xr-xdyneIII/live-build-refine/lb-refine36
-rwxr-xr-xdyneIII/live-usb/live-usb.sh23
2 files changed, 49 insertions, 10 deletions
diff --git a/dyneIII/live-build-refine/lb-refine b/dyneIII/live-build-refine/lb-refine
index 3080b48..9e21196 100755
--- a/dyneIII/live-build-refine/lb-refine
+++ b/dyneIII/live-build-refine/lb-refine
@@ -55,7 +55,7 @@ ARGS=$@[@]
# CHECK FOR BINARIES:
# sudo, unsquashfs, Xephyr
-OPTS=`getopt -o X:hv -n "$BINFILE" -- "$@"`
+OPTS=`getopt -o X:o:hv -n "$BINFILE" -- "$@"`
while true; do
case "$1" in
@@ -67,6 +67,7 @@ while true; do
act "pack squash an open livecd iso"
notice "options:"
act "-x RES nest graphical session at RES (ie: 1024x768)"
+ act "-o PFX name prefix for the output file or directory"
act "-h print this help"
act "-v print out the version of this tool"
# act "-p path to the SDK directory (def. same as iso)"
@@ -74,6 +75,7 @@ while true; do
echo; exit 2 ;;
-X) XRES=${2}; shift 2 ;;
+ -o) OUTFILE=${2}; shift 2 ;;
-v) exit 2 ;;
-p) PFX=${2}; shift 2 ;;
--) shift; break ;;
@@ -164,7 +166,13 @@ open_iso() {
return 1
fi
- dest=${PFX}/${FILE%%\.*}
+ # setup the name for the output directory
+ if [ -z $OUTFILE ]; then
+ dest=${PFX}/${FILE%%\.*}
+ else
+ dest=${OUTFILE}
+ fi
+
if [ -x $dest ]; then
rmdir $dest 2>/dev/null # delete if empty
if [ $? != 0 ]; then
@@ -175,10 +183,16 @@ open_iso() {
notice "Opening $PFX/$FILE ..."
- loop_mount_iso # defines ISOLOOP, to be removed later
+ loop_mount_iso $PFX/$FILE # defines $ISOLOOP, to be removed later
+
+ if [ $? != 0 ]; then
+ error "loop mount failed"
+ return 1
+ fi
if ! [ -x $ISOLOOP/live ]; then
error "ISO doesn't contains a live/ directory, is this a live-build system?"
+ umount $ISOLOOP
rmdir $ISOLOOP
return 1
fi
@@ -278,6 +292,10 @@ pack_iso() {
umount $PFX/$FILE/dev/pts 2> /dev/null
umount $PFX/$FILE/proc 2> /dev/null
umount $PFX/$FILE/tmp 2> /dev/null
+ # cleanup tmp
+ rm -rf $PFX/$FILE/tmp/*
+
+ # cleanup dns
rm -f $PFX/$FILE/etc/resolv.conf
echo "nameserver 8.8.8.8" \
> $PFX/$FILE/etc/resolv.conf
@@ -296,7 +314,7 @@ pack_iso() {
act "`ls -lh $PFX/$FILE.squashfs`"
# stat $PFX/$FILE.squashfs
- loop_mount_iso "$PFX/${FILE}.iso" # defines ISOLOOP, to be removed later
+ loop_mount_iso "$PFX/${FILE}.iso" # defines $ISOLOOP, to be unset later
if [ $? != 0 ]; then
error "loop mount failed, operation aborted."
return 1
@@ -314,12 +332,18 @@ pack_iso() {
mount -o bind $kernel $ISOLOOP/live/vmlinuz
mount -o bind $initrd $ISOLOOP/live/initrd.img
- isofile=$PFX/$FILE-`date +%s`.iso
+ if [ -z $OUTFILE ]; then
+ isofile=$PFX/$FILE-`date +%s`.iso
+ else
+ isofile=${OUTFILE}.iso
+ fi
+
act "making bootable iso in $isofile"
- genisoimage -r -V "$FILE" -cache-inodes -J -l \
+ genisoimage -r -V "$OUTFILE" -cache-inodes -J -l \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-input-charset iso8859-1 -udf -o $isofile $ISOLOOP
+
# omissis: -R -udf
if [ $? != 0 ]; then
error "an error occurred in genisoimage, operation aborted."
diff --git a/dyneIII/live-usb/live-usb.sh b/dyneIII/live-usb/live-usb.sh
index e59156c..beda14c 100755
--- a/dyneIII/live-usb/live-usb.sh
+++ b/dyneIII/live-usb/live-usb.sh
@@ -54,12 +54,27 @@ sudo grub-install --no-floppy --root-directory=${MNT} ${DEVICE}
# create grub config
cat <<EOF> /tmp/live-usb-grub.cfg
-menuentry "dyne:bolic 3.0" {
- loopback loop /${ISO}
- linux (loop)/live/vmlinuz boot=live iso-scan/filename=/${ISO} fromiso=/dev/sda1/${ISO} noeject noprompt --
- initrd (loop)/live/initrd.img
+insmod part_msdos
+insmod loopback
+insmod iso9660
+
+set menu_color_normal=white/blue
+set_menu_color_highlight=blue/light-gray
+
+menuentry "dyne:bolic 3.0" --class gnu-linux --class gnu --class os {
+ iso_path=/${ISO}
+ export iso_path
+ search --set --file \$iso_path
+ loopback loop \$iso_path
+ root=(loop)
+ linux /live/vmlinuz boot=live iso-scan/filename=\$iso_path fromiso=/dev/sdb1\$iso_path noeject noprompt --
+ initrd /live/initrd.img
}
EOF
+# needs our own modified initrd scripts/live to support VFAT usb sticks
+# TODO: test if we can remove or substitute fromiso code in them...
+# also add some goodies to grub
+
sudo mv /tmp/live-usb-grub.cfg ${MNT}/boot/grub/grub.cfg
# umount