@@ -15,15 +15,8 @@ PATH="${PATH}:/sbin:/usr/local/sbin:/usr/sbin"
1515# path to the grml2usb script you'd like to use
1616[ -n " $GRML2USB " ] || GRML2USB=' grml2usb'
1717
18- # support mkisofs as well as genisoimage
19- if which xorriso > /dev/null 2>&1 ; then
20- MKISOFS=' xorriso -as mkisofs'
21- elif which mkisofs > /dev/null 2>&1 ; then
22- MKISOFS=' mkisofs'
23- elif which genisoimage > /dev/null 2>&1 ; then
24- MKISOFS=' genisoimage'
25- else
26- echo " Error: neither xorriso nor mkisofs nor genisoimage available - can not create ISO." >&2
18+ if ! which xorriso > /dev/null 2>&1 ; then
19+ echo " Error: xorriso not found - can not create ISO." >&2
2720 exit 1
2821fi
2922# }}}
@@ -189,119 +182,106 @@ Options:
189182 echo " Warning: Neither syslinux nor GRUB boot files found." >&2
190183 fi
191184
192- case " $MKISOFS " in
193- xorriso* )
194- echo " Using xorriso for ISO generation."
195- if ! dpkg --compare-versions $( dpkg-query -W -f=' ${Version}\n' xorriso 2> /dev/null) gt-nl 1.1.6-1 ; then
196- echo " Disabling (U)EFI boot support since xorriso version is not recent enough."
197- UEFI_ENABLE=false
198- else
199- echo " xorriso with -eltorito-alt-boot support present"
200- UEFI_ENABLE=true
201- fi
185+ echo " Using xorriso for ISO generation."
186+ if ! dpkg --compare-versions $( dpkg-query -W -f=' ${Version}\n' xorriso 2> /dev/null) gt-nl 1.1.6-1 ; then
187+ echo " Disabling (U)EFI boot support since xorriso version is not recent enough."
188+ UEFI_ENABLE=false
189+ else
190+ echo " xorriso with -eltorito-alt-boot support present"
191+ UEFI_ENABLE=true
192+ fi
202193
203- if [ " $USE_ISOLINUX " = " true" ] ; then
204- # isolinux-based BIOS boot
205- if ! which isohybrid > /dev/null 2>&1 ; then
206- echo " Error: isohybrid executable not found (install syslinux/isolinux/syslinux-utils?)." >&2
207- exit 1
208- fi
209- BOOT_ARGS=" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
210-
211- if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
212- echo " /boot/efi.img found, enabling (U)EFI boot support."
213- if ! [ -r /usr/lib/ISOLINUX/isohdpfx.bin ] ; then
214- echo " Error: /usr/lib/ISOLINUX/isohdpfx.bin not available, required for xorriso/isohybrid." >&2
215- echo " Hint: make sure isolinux is installed." >&2
216- exit 1
217- fi
218- BOOT_ARGS+=" -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
219- BOOT_ARGS+=" -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -isohybrid-gpt-basdat -no-pad"
220- fi
194+ if [ " $USE_ISOLINUX " = " true" ] ; then
195+ # isolinux-based BIOS boot
196+ if ! which isohybrid > /dev/null 2>&1 ; then
197+ echo " Error: isohybrid executable not found (install syslinux/isolinux/syslinux-utils?)." >&2
198+ exit 1
199+ fi
200+ BOOT_ARGS=" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
221201
222- elif [ " $USE_GRUB " = " true" ] ; then
223- # GRUB-based BIOS boot
224- GRUB_BIOS_AVAILABLE=false
202+ if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
203+ echo " /boot/efi.img found, enabling (U)EFI boot support."
204+ if ! [ -r /usr/lib/ISOLINUX/isohdpfx.bin ] ; then
205+ echo " Error: /usr/lib/ISOLINUX/isohdpfx.bin not available, required for xorriso/isohybrid." >&2
206+ echo " Hint: make sure isolinux is installed." >&2
207+ exit 1
208+ fi
209+ BOOT_ARGS+=" -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
210+ BOOT_ARGS+=" -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -isohybrid-gpt-basdat -no-pad"
211+ fi
225212
226- # Check if source ISO already has GRUB BIOS boot image
227- if [ -r " boot/grub/i386-pc/eltorito.img" ] ; then
228- echo " Using existing GRUB BIOS boot image from source ISO."
229- GRUB_BIOS_AVAILABLE=true
230- elif [ -r " boot/grub/i386-pc/cdboot.img" ] ; then
231- echo " Using existing GRUB cdboot.img from source ISO."
232- cp boot/grub/i386-pc/cdboot.img boot/grub/i386-pc/eltorito.img
213+ elif [ " $USE_GRUB " = " true" ] ; then
214+ # GRUB-based BIOS boot
215+ GRUB_BIOS_AVAILABLE=false
216+
217+ # Check if source ISO already has GRUB BIOS boot image
218+ if [ -r " boot/grub/i386-pc/eltorito.img" ] ; then
219+ echo " Using existing GRUB BIOS boot image from source ISO."
220+ GRUB_BIOS_AVAILABLE=true
221+ elif [ -r " boot/grub/i386-pc/cdboot.img" ] ; then
222+ echo " Using existing GRUB cdboot.img from source ISO."
223+ cp boot/grub/i386-pc/cdboot.img boot/grub/i386-pc/eltorito.img
224+ GRUB_BIOS_AVAILABLE=true
225+ elif [ -d " /usr/lib/grub/i386-pc" ] ; then
226+ # Try to generate GRUB BIOS boot image (requires i386-pc modules)
227+ if which grub-mkimage > /dev/null 2>&1 ; then
228+ echo " Generating GRUB BIOS boot image..."
229+ mkdir -p boot/grub/i386-pc
230+ if grub-mkimage -o boot/grub/i386-pc/eltorito.img -O i386-pc-eltorito -p /boot/grub \
231+ biosdisk iso9660 linux configfile normal search search_fs_file search_label part_msdos part_gpt fat ext2 2> /dev/null ; then
233232 GRUB_BIOS_AVAILABLE=true
234- elif [ -d " /usr/lib/grub/i386-pc" ] ; then
235- # Try to generate GRUB BIOS boot image (requires i386-pc modules)
236- if which grub-mkimage > /dev/null 2>&1 ; then
237- echo " Generating GRUB BIOS boot image..."
238- mkdir -p boot/grub/i386-pc
239- if grub-mkimage -o boot/grub/i386-pc/eltorito.img -O i386-pc-eltorito -p /boot/grub \
240- biosdisk iso9660 linux configfile normal search search_fs_file search_label part_msdos part_gpt fat ext2 2> /dev/null ; then
241- GRUB_BIOS_AVAILABLE=true
242- else
243- echo " Warning: Failed to generate GRUB BIOS boot image." >&2
244- fi
245- fi
233+ else
234+ echo " Warning: Failed to generate GRUB BIOS boot image." >&2
246235 fi
236+ fi
237+ fi
247238
248- if [ " $GRUB_BIOS_AVAILABLE " = " true" ] ; then
249- # Find GRUB's boot.img for hybrid MBR (check ISO first, then system)
250- GRUB_BOOT_IMG=" "
251- for path in boot/grub/i386-pc/boot.img /usr/lib/grub/i386-pc/boot.img /usr/share/grub/i386-pc/boot.img ; do
252- if [ -r " $path " ] ; then
253- GRUB_BOOT_IMG=" $path "
254- break
255- fi
256- done
257-
258- BOOT_ARGS=" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/grub/i386-pc/eltorito.img -c boot/grub/boot.cat"
259- BOOT_ARGS+=" --grub2-boot-info"
260-
261- if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
262- echo " /boot/efi.img found, enabling (U)EFI boot support."
263- BOOT_ARGS+=" -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
264- if [ -n " $GRUB_BOOT_IMG " ] ; then
265- BOOT_ARGS+=" --grub2-mbr $GRUB_BOOT_IMG -isohybrid-gpt-basdat -no-pad"
266- else
267- echo " Warning: GRUB boot.img not found, ISO may not be hybrid-bootable from USB." >&2
268- BOOT_ARGS+=" -no-pad"
269- fi
270- elif [ -n " $GRUB_BOOT_IMG " ] ; then
271- BOOT_ARGS+=" --grub2-mbr $GRUB_BOOT_IMG -no-pad"
272- fi
273- elif [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
274- # Fall back to EFI-only boot
275- echo " Warning: GRUB i386-pc modules not available, falling back to EFI-only boot." >&2
276- echo " Hint: Install grub-pc-bin for BIOS boot support on non-x86 hosts." >&2
277- USE_GRUB=false
278- BOOT_ARGS=" -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat -no-pad"
279- else
280- echo " Error: Cannot create bootable ISO - no BIOS or EFI boot method available." >&2
281- exit 1
239+ if [ " $GRUB_BIOS_AVAILABLE " = " true" ] ; then
240+ # Find GRUB's boot.img for hybrid MBR (check ISO first, then system)
241+ GRUB_BOOT_IMG=" "
242+ for path in boot/grub/i386-pc/boot.img /usr/lib/grub/i386-pc/boot.img /usr/share/grub/i386-pc/boot.img ; do
243+ if [ -r " $path " ] ; then
244+ GRUB_BOOT_IMG=" $path "
245+ break
282246 fi
247+ done
283248
284- else
285- # EFI-only boot (e.g., arm64)
286- if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
287- echo " Using EFI-only boot."
288- BOOT_ARGS=" -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat -no-pad"
249+ BOOT_ARGS=" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/grub/i386-pc/eltorito.img -c boot/grub/boot.cat"
250+ BOOT_ARGS+=" --grub2-boot-info"
251+
252+ if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
253+ echo " /boot/efi.img found, enabling (U)EFI boot support."
254+ BOOT_ARGS+=" -eltorito-alt-boot -e boot/efi.img -no-emul-boot"
255+ if [ -n " $GRUB_BOOT_IMG " ] ; then
256+ BOOT_ARGS+=" --grub2-mbr $GRUB_BOOT_IMG -isohybrid-gpt-basdat -no-pad"
289257 else
290- echo " Error: No bootable configuration found." >&2
291- exit 1
258+ echo " Warning: GRUB boot.img not found, ISO may not be hybrid-bootable from USB ." >&2
259+ BOOT_ARGS+= " -no-pad "
292260 fi
261+ elif [ -n " $GRUB_BOOT_IMG " ] ; then
262+ BOOT_ARGS+=" --grub2-mbr $GRUB_BOOT_IMG -no-pad"
293263 fi
294- ;;
295- * )
296- echo " Using $MKISOFS for ISO generation."
297- if [ " $USE_ISOLINUX " = " true" ] ; then
298- BOOT_ARGS=" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat"
299- else
300- echo " Error: $MKISOFS does not support GRUB-based ISO boot. Please install xorriso." >&2
301- exit 1
302- fi
303- ;;
304- esac
264+ elif [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
265+ # Fall back to EFI-only boot
266+ echo " Warning: GRUB i386-pc modules not available, falling back to EFI-only boot." >&2
267+ echo " Hint: Install grub-pc-bin for BIOS boot support on non-x86 hosts." >&2
268+ USE_GRUB=false
269+ BOOT_ARGS=" -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat -no-pad"
270+ else
271+ echo " Error: Cannot create bootable ISO - no BIOS or EFI boot method available." >&2
272+ exit 1
273+ fi
274+
275+ else
276+ # EFI-only boot (e.g., arm64)
277+ if [ " $UEFI_ENABLE " = " true" ] && [ -r " ${WRKDIR} /cddir/boot/efi.img" ] ; then
278+ echo " Using EFI-only boot."
279+ BOOT_ARGS=" -e boot/efi.img -no-emul-boot -isohybrid-gpt-basdat -no-pad"
280+ else
281+ echo " Error: No bootable configuration found." >&2
282+ exit 1
283+ fi
284+ fi
305285# }}}
306286
307287# adjust ISO for small output if necessary {{{
@@ -368,7 +348,7 @@ Options:
368348# }}}
369349
370350# generate the CD/DVD ISO {{{
371- $MKISOFS -V ' grml-multiboot' -l -r -J $BOOT_ARGS \
351+ xorriso -as mkisofs -V ' grml-multiboot' -l -r -J $BOOT_ARGS \
372352 -o " $ISOFILE " .
373353# }}}
374354
0 commit comments