[ipxe-devel] [PATCH 1/1] allow to build ISO image with EFI support (ipxe.eiso)

Christian Hesse list at eworm.de
Mon Apr 20 09:38:53 UTC 2015


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 src/arch/i386/Makefile.pcbios |  6 ++++++
 src/util/geniso               | 34 ++++++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/src/arch/i386/Makefile.pcbios b/src/arch/i386/Makefile.pcbios
index ff82373..c7a58eb 100644
--- a/src/arch/i386/Makefile.pcbios
+++ b/src/arch/i386/Makefile.pcbios
@@ -59,6 +59,12 @@ NON_AUTO_MEDIA	+= iso
 	$(QM)$(ECHO) "  [GENISO] $@"
 	$(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) VERSION="$(VERSION)" bash util/geniso -o $@ $<
 
+# rule to make a non-emulation ISO boot image with EFI support
+NON_AUTO_MEDIA	+= eiso
+%eiso:	%lkrn bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi util/geniso
+	$(QM)$(ECHO) "  [GENISO] $@"
+	$(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) VERSION="$(VERSION)" bash util/geniso -e -o $@ $<
+
 # rule to make a floppy emulation ISO boot image
 NON_AUTO_MEDIA	+= liso
 %liso:	%lkrn util/geniso
diff --git a/src/util/geniso b/src/util/geniso
index 521c929..b7e4a6f 100755
--- a/src/util/geniso
+++ b/src/util/geniso
@@ -6,16 +6,21 @@ function help() {
 	echo "usage: ${0} [OPTIONS] foo.lkrn [bar.lkrn,...]"
 	echo
 	echo "where OPTIONS are:"
+	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"
 }
 
+EFI=0
 LEGACY=0
 FIRST=""
 
-while getopts "hlo:" opt; do
+while getopts "ehlo:" opt; do
 	case ${opt} in
+		e)
+			EFI=1
+			;;
 		h)
 			help
 			exit 0
@@ -37,16 +42,20 @@ if [ -z "${OUT}" ]; then
 	exit 1
 fi
 
-# There should either be 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
-
+# There should either be mkisofs or compatible program.
+# xorriso (from libisoburn) needs extra parameter, so try first.
+if xorriso --version >/dev/null 2>/dev/null; then
+	mkisofs=(xorriso -as mkisofs)
+else
+	for command in genisoimage mkisofs; do
+		if ${command} --version >/dev/null 2>/dev/null; then
+			mkisofs=(${command})
+			break
+		fi
+	done
+fi
 if [ -z "${mkisofs}" ]; then
-	echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
+	echo "${0}: xorriso, mkisofs or genisoimage not found, please install or set PATH" >&2
 	exit 1
 fi
 
@@ -122,6 +131,11 @@ case "${LEGACY}" in
 		# copy isolinux bootloader
 		cp ${ISOLINUX_BIN} ${dir}
 
+		# copy EFI files
+		mkdir -p ${dir}/EFI/BOOT/
+		cp bin-x86_64-efi/ipxe.efi ${dir}/EFI/BOOT/BOOTX64.EFI
+		cp bin-i386-efi/ipxe.efi ${dir}/EFI/BOOT/BOOTIA32.EFI
+
 		# syslinux 6.x needs a file called ldlinux.c32
 		LDLINUX_C32=$(dirname ${ISOLINUX_BIN})/ldlinux.c32
 		if [ -s ${LDLINUX_C32} ]; then
-- 
2.3.5




More information about the ipxe-devel mailing list