[syslinux] [PATCH 3/4] mk/efi.mk: Build gnu-efi with the Makefile

celelibi at gmail.com celelibi at gmail.com
Sun Sep 13 20:50:58 PDT 2015


From: Sylvain Gault <sylvain.gault at gmail.com>

The error-prone shell scripts for building gnu-efi are replaced by a
Makefile recipe.

This is accompanied with a small update of gnu-efi which, despite not
strongly mandatory, avoid recompiling gnu-efi and all the efi subtree on
each invocation of make.

Signed-off-by: Sylvain Gault <sylvain.gault at gmail.com>
---
 efi/build-gnu-efi.sh | 45 ---------------------------------------------
 efi/check-gnu-efi.sh | 38 --------------------------------------
 gnu-efi              |  2 +-
 mk/efi.mk            |  9 ++++++++-
 4 files changed, 9 insertions(+), 85 deletions(-)
 delete mode 100755 efi/build-gnu-efi.sh
 delete mode 100755 efi/check-gnu-efi.sh

diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh
deleted file mode 100755
index e72d872..0000000
--- a/efi/build-gnu-efi.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Initialise the gnu-efi submodule and ensure the source is up-to-date.
-# Then build and install it for the given architecture.
-
-if [ $# -lt 2 ]; then
-cat <<EOF
-Usage: $0: <arch> <objdir>
-
-Build the <arch> gnu-efi libs and header files and install in <objdir>.
-
-  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
-  <objdir> - The Syslinux object directory
-
-EOF
-    exit 1
-fi
-
-ARCH="$1"
-objdir="$(readlink -f $2)"
-
-if [ ! -e ../version.h ]; then
-    printf "build-gnu-efi.sh: Cannot be run outside Syslinux object tree\n"
-    pwd
-    exit 1
-fi
-
-(
-	cd ../..
-	if [ -d .git ]; then
-	    git submodule update --init
-	fi
-)
-
-mkdir -p "$objdir/gnu-efi"
-cd "$objdir/gnu-efi"
-
-EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"
-
-make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH
-make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH PREFIX="$objdir" install
-
-cd "$objdir/efi"
diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh
deleted file mode 100755
index 7d99e9a..0000000
--- a/efi/check-gnu-efi.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-# Verify that gnu-efi is installed in the object directory for our
-# firmware. If it isn't, build it.
-
-if [ $# -lt 2 ]; then
-cat <<EOF
-Usage: $0: <arch> <objdir>
-
-Check for gnu-efi libraries and header files in <objdir> and, if none
-exist, build and install them.
-
-  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
-  <objdir> - The Syslinux object directory
-
-EOF
-    exit 1
-fi
-
-ARCH=$1
-objdir=$2
-
-if [ ! \( -f "$objdir/include/efi/$ARCH/efibind.h" -a -f "$objdir/lib/libefi.a" -a -f "$objdir/lib/libgnuefi.a" \) ]; then
-    # Build the external project with a clean make environment, as
-    # Syslinux disables built-in implicit rules.
-    export MAKEFLAGS=
-
-    ../../efi/build-gnu-efi.sh $ARCH "$objdir"
-    if [ $? -ne 0 ]; then
-	printf "Failed to build gnu-efi. "
-	printf "Execute the following command for full details: \n\n"
-	printf "build-gnu-efi.sh $ARCH $objdir\n\n"
-
-	exit 1
-    fi
-else
-    printf "skip gnu-efi build/install\n"
-fi
diff --git a/gnu-efi b/gnu-efi
index ab54e2b..06744d6 160000
--- a/gnu-efi
+++ b/gnu-efi
@@ -1 +1 @@
-Subproject commit ab54e2b40e914d0ca01dc3d44c8d4eb8517bf999
+Subproject commit 06744d69273de4945cf0ffcaa4a6abf7cec707b6
diff --git a/mk/efi.mk b/mk/efi.mk
index a705440..5ef6702 100644
--- a/mk/efi.mk
+++ b/mk/efi.mk
@@ -10,6 +10,7 @@ core = $(topdir)/core
 GCCOPT := $(call gcc_ok,-fno-stack-protector,)
 EFIINC = $(objdir)/include/efi
 LIBDIR  = $(objdir)/lib
+EFIDIR = $(topdir)/gnu-efi/gnu-efi-3.0
 
 ifeq ($(ARCH),i386)
 	ARCHOPT = -m32 -march=i386
@@ -55,7 +56,13 @@ $(EFIINC)/%.h $(EFIINC)/protocol/%.h $(EFIINC)/$(EFI_SUBARCH)/%.h: gnuefi ;
 .PHONY: gnuefi
 gnuefi:
 	@echo Building gnu-efi for $(EFI_SUBARCH)
-	$(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
+	cd $(topdir) && git submodule update --init
+	mkdir -p "$(objdir)/gnu-efi"
+	MAKEFLAGS= make SRCDIR="$(EFIDIR)" TOPDIR="$(EFIDIR)" \
+		ARCH=$(EFI_SUBARCH) ARFLAGS=rvU -f "$(EFIDIR)/Makefile"
+	MAKEFLAGS= make SRCDIR="$(EFIDIR)" TOPDIR="$(EFIDIR)" \
+		ARCH=$(EFI_SUBARCH) PREFIX="$(objdir)" ARFLAGS=rvU \
+		-f "$(EFIDIR)/Makefile" install
 
 %.o: %.S	# Cancel old rule
 
-- 
2.5.1



More information about the Syslinux mailing list