[ipxe-devel] [PATCH 1/1] [build] reintroduce support for mkisofs and genisoimage

Christian Hesse list at eworm.de
Thu Apr 9 18:50:29 UTC 2015


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 src/util/geniso | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/src/util/geniso b/src/util/geniso
index 998370d..9e8588c 100755
--- a/src/util/geniso
+++ b/src/util/geniso
@@ -6,7 +6,7 @@ function help() {
 	echo "usage: ${0} [OPTIONS] foo.lkrn [bar.lkrn,...]"
 	echo
 	echo "where OPTIONS are:"
-	echo " -e	build image with EFI support"
+	echo " -e       build image with EFI support"
 	echo " -h       show this help"
 	echo " -l       build legacy image with floppy emulation"
 	echo " -o FILE  save iso image to file"
@@ -42,24 +42,31 @@ if [ -z "${OUT}" ]; then
 	exit 1
 fi
 
-# We require xorriso (from libisoburn) for EFI support
-# genisoimage and mkisofs are missing some features
-for command in xorriso; do
-	if ${command} --version >/dev/null 2>/dev/null; then
-		xorriso=(${command})
-		break
-	fi
-done
-
-if [ -z "${xorriso}" ]; then
-	echo "${0}: xorriso not found, please install or set PATH" >&2
+# We need xorriso (from libisoburn) for EFI support, so try that first.
+if xorriso --version >/dev/null 2>/dev/null; then
+	mkisofs=(xorriso -as mkisofs)
+elif [ ${EFI} -eq 1 ]; then
+	echo "${0}: xorriso not found, but required for EFI support. Please install." >&2
 	exit 1
+else
+	# fall back to mkisofs or the compatible genisoimage program
+	for command in genisoimage mkisofs; do
+		if ${command} --version >/dev/null 2>/dev/null; then
+			mkisofs=(${command})
+			break
+		fi
+	done
+
+	if [ -z "${mkisofs}" ]; then
+		echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
+		exit 1
+	fi
 fi
 
 dir=$(mktemp -d bin/iso.dir.XXXXXX)
 cfg=${dir}/isolinux.cfg
 
-xorriso+=(-as mkisofs -quiet -l -volid "iPXE" -preparer "iPXE build system"
+mkisofs+=(-quiet -l -volid "iPXE" -preparer "iPXE build system"
 	-appid "iPXE ${VERSION} - Open Source Network Boot Firmware"
 	-publisher "http://ipxe.org/" -c boot.cat)
 
@@ -122,13 +129,13 @@ case "${LEGACY}" in
 		fi
 
 		# generate the iso image
-		"${xorriso[@]}" -b boot.img -output ${OUT} ${dir}
+		"${mkisofs[@]}" -b boot.img -output ${OUT} ${dir}
 		;;
 	0)
 		# copy isolinux bootloader
 		cp ${ISOLINUX_BIN} ${dir}
 
-		xorriso+=(-b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table)
+		mkisofs+=(-b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table)
 
 		if [ "${EFI}" -eq 1 ]; then
 			# generate EFI image
@@ -140,7 +147,7 @@ case "${LEGACY}" in
 			mcopy -m -i ${img} bin-x86_64-efi/ipxe.efi "::EFI/BOOT/BOOTX64.EFI"
 			mcopy -m -i ${img} bin-i386-efi/ipxe.efi "::EFI/BOOT/BOOTIA32.EFI"
 
-			xorriso+=(-eltorito-alt-boot -e efiboot.img -isohybrid-gpt-basdat -no-emul-boot)
+			mkisofs+=(-eltorito-alt-boot -e efiboot.img -isohybrid-gpt-basdat -no-emul-boot)
 		fi
 
 		# syslinux 6.x needs a file called ldlinux.c32
@@ -150,7 +157,7 @@ case "${LEGACY}" in
 		fi
 
 		# generate the iso image
-		"${xorriso[@]}" -output ${OUT} ${dir}
+		"${mkisofs[@]}" -output ${OUT} ${dir}
 
 		# isohybrid will be used if available
 		if isohybrid --version >/dev/null 2>/dev/null; then
-- 
2.3.5




More information about the ipxe-devel mailing list