#!/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
+ mv $ISOTREE/boot/isolinux/bios/ldlinux.c32 $ISOTREE/boot/isolinux
+ cp kernel/usr/lib/ISOLINUX/isolinux.bin $ISOTREE/boot/isolinux
+ cp syslinux-iso.cfg $ISOTREE/boot/isolinux/syslinux.cfg
+ mcopy -i $P1 ::/splash.png ::/vmlinuz $ISOTREE/
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
#-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 next
+
+ # Mastering a disk UEFI boot using the separate boot partition $P1
+ # Bootloader = /EFI/BOOT/bootx64.efi
-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
+
+ # cdrom UEFI boot is missing
)
-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