Set up for testing lua on uefi
[rrq/tiniest.git] / packiso.sh
index 0111fa582aa2d34c3d43253143dbc0c499d1a05a..b6558f2793626ac9a8cfeb3e19762b75608f5b56 100755 (executable)
@@ -1,40 +1,52 @@
 #!/bin/bash
 #
-# Run xorriso to make a bootable ISO of bootimage.raw; a hybrid, nulti
+# Run xorriso to make a bootable ISO of bootimage.raw; a hybrid, multi
 # mode bootable ISO.
 
 set -e
 
 ISOTREE=isotree
 ISO=tiniest.iso
-P1=$ISOTREE/part1.raw
-
-echo "# Prepare ISO content tree"
+P1=part1.raw # $ISOTREE/part1.raw
 
+echo "# Prepare ISO content tree unless it's already set up"
 if [ ! -d $ISOTREE ] ; then
     mkdir $ISOTREE
-    touch $ISOTREE/catalog # Boot catalog
+
     # Determine start and size of first parition
     X=( $(sfdisk -l -ostart,sectors bootimage.raw | tail -n 2) )
     dd if=bootimage.raw of=$P1 skip=${X[0]} count=${X[1]}
-    echo "# Add isolinux boot loader"
-    mcopy -i $P1 kernel/usr/lib/ISOLINUX/isolinux.bin ::/
-    mcopy -i $P1 kernel/usr/lib/ISOLINUX/isohdppx.bin ::/
+
+    echo "# Set up the isolinux boot loader in $ISOTREE"
+    mkdir -p $ISOTREE/boot/isolinux/bios
+    cp kernel/usr/lib/syslinux/modules/bios/* $ISOTREE/boot/isolinux/bios
+    cp kernel/usr/lib/ISOLINUX/isolinux.bin $ISOTREE/boot/isolinux
+
+    ## ldlinux.c32 must be sibling to isolinux.bin
+    mv $ISOTREE/boot/isolinux/bios/ldlinux.c32 $ISOTREE/boot/isolinux
+
+    ## use isolinux.cfg for isolinux boot
+    cp syslinux-iso.cfg $ISOTREE/boot/isolinux/isolinux.cfg
+
+    ## put splash, vmlinux and initrd as siblings
+    mcopy -i $P1 ::/splash.png ::/vmlinuz ::/initrd.gz $ISOTREE/boot/isolinux
+    
 fi
 
-[ ! -r $ISO ] || rm $ISO
+[ -r $ISO ] && rm $ISO
+
 PREPID="'$(id -un), $(getent passwd $(id -un)|awk -F: '{print $5}')'"
 
 XORRISO=(
     -report_about ALL
-    --outdev $ISO
+    -outdev $ISO
     -map $ISOTREE /
     -rockridge on -joliet on
     -volid "TINIEST"
     -volset_id "$(date +"Tiniest %Y-%m-%d %H:%M:%S")"
     -publisher "Ralph (rrq) Ronnquist"
     -application_id "Hybrid Multi Mode Disk Image"
-    -system_id "Tiniest Linux HMMDI"
+    -system_id "Tiniest Linux"
     #-copyright_file copyright.txt
     #-abstract_file abstract.txt
     #-biblio_file biblio.txt
@@ -42,19 +54,25 @@ XORRISO=(
     #-application_use path
     #-out_charset "UTF8" ??
     -uid 0 -gid 0
-)
 
-BOOT1=(
-    -boot_image any cat_path=/catalog
+    # Mastering a cdrom legacy boot that uses the ISO tree only
+    -boot_image isolinux system_area=kernel/usr/lib/ISOLINUX/isohdpfx.bin
+
+    # Mastering a disk legacy boot reusing the cdrom legacy boot
+    -boot_image isolinux dir=/boot/isolinux
+    #-boot_image  any iso_mbr_part_type=0x00
+    -boot_image isolinux  partition_entry=gpt_basdat
+    
+    # Mastering a disk UEFI boot using the separate boot partition $P1
+    # Bootloader = /EFI/BOOT/bootx64.efi
+    -boot_image any next
     -append_partition 2 0xef ${P1}
-    -boot_image any
+    -boot_image any 
     efi_path=--interval:appended_partition_2:all::/EFI/BOOT/bootx64.efi
-    #-boot_image isolinux system_area=kernel/usr/lib/ISOLINUX/isohdppx.bin
-    -boot_image and part_like_isohybrid=on
-    #    -boot_image any
-#    bin_path=--interval:appended_partition_2:all::/isolinux.bin
+
+    # make part#2 bootable
 )
 
-XORRISO=( "${XORRISO[@]}" "${BOOT1[@]}" )
-#for A in "${XORRISO[@]}" ; do echo "$A" ; done
 xorriso "${XORRISO[@]}"
+#sfdisk -f --part-attrs tiniest.iso 2 LegacyBIOSBootable
+#sfdisk -A tiniest.iso 2