aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2014-02-22 12:00:11 -0500
committerGene Cumm <gene.cumm@gmail.com>2014-02-22 12:00:11 -0500
commitdd68a012cbf39d543d34ac6927cb4e4737e16445 (patch)
tree90d2b1659a1df7a6b780e46ac5aca8ea70385501
parent269a518780bd33f3c1085c402c30e225e5c48663 (diff)
downloadsyslinux-dd68a012cbf39d543d34ac6927cb4e4737e16445.tar.gz
syslinux-dd68a012cbf39d543d34ac6927cb4e4737e16445.tar.xz
syslinux-dd68a012cbf39d543d34ac6927cb4e4737e16445.zip
efi: fix up gnu-efi build
This eliminates the forking and pushes the build under the efi32/ and efi64/ object directories eliminating a build race and preventing the build from breaking as gnu-efi takes a few seconds to complete. Depends on gnu-efi commit 52d88dd Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
-rw-r--r--efi/Makefile4
-rwxr-xr-xefi/build-gnu-efi.sh23
-rwxr-xr-xefi/check-gnu-efi.sh6
-rwxr-xr-xefi/clean-gnu-efi.sh35
-rw-r--r--mk/efi.mk11
5 files changed, 61 insertions, 18 deletions
diff --git a/efi/Makefile b/efi/Makefile
index 4bf5a229..d5443bd5 100644
--- a/efi/Makefile
+++ b/efi/Makefile
@@ -41,7 +41,8 @@ CORE_OBJS += $(addprefix $(OBJ)/../core/, \
fs/pxe/pxe.o fs/pxe/tftp.o fs/pxe/urlparse.o fs/pxe/dhcp_option.o \
fs/pxe/ftp.o fs/pxe/ftp_readdir.o fs/pxe/http.o fs/pxe/http_readdir.o)
-LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS))
+LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
+ $(LIBEFI)
CSRC = $(wildcard $(SRC)/*.c)
OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
@@ -100,6 +101,7 @@ tidy dist:
rm -f *.so *.o wrapper
find . \( -name \*.o -o -name \*.a -o -name .\*.d -o -name \*.tmp \) -print0 | \
xargs -0r rm -f
+ $(topdir)/efi/clean-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
clean: tidy
diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh
index f9bab988..c87e67c2 100755
--- a/efi/build-gnu-efi.sh
+++ b/efi/build-gnu-efi.sh
@@ -18,23 +18,26 @@ EOF
exit 1
fi
-ARCH=$1
-objdir=`readlink -f $2`
+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 ../..
-git submodule init
-git submodule update
+(
+ cd ../..
+ git submodule update --init
+)
-cd gnu-efi/gnu-efi-3.0/
+mkdir -p "$objdir/gnu-efi"
+cd "$objdir/gnu-efi"
-make ARCH=$ARCH
+EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"
-make ARCH=$ARCH PREFIX=$objdir install
-make ARCH=$ARCH clean
+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
+cd "$objdir/efi"
diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh
index e16e20a1..85305f89 100755
--- a/efi/check-gnu-efi.sh
+++ b/efi/check-gnu-efi.sh
@@ -20,12 +20,12 @@ fi
ARCH=$1
objdir=$2
-if [ ! -f $objdir/include/efi/$ARCH/efibind.h ]; then
+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 > /dev/null 2>&1
+ ../../efi/build-gnu-efi.sh $ARCH "$objdir" > /dev/null 2>&1
if [ $? -ne 0 ]; then
printf "Failed to build gnu-efi. "
printf "Execute the following command for full details: \n\n"
@@ -33,4 +33,6 @@ if [ ! -f $objdir/include/efi/$ARCH/efibind.h ]; then
exit 1
fi
+else
+ printf "skip gnu-efi build/install\n"
fi
diff --git a/efi/clean-gnu-efi.sh b/efi/clean-gnu-efi.sh
new file mode 100755
index 00000000..84ed17a7
--- /dev/null
+++ b/efi/clean-gnu-efi.sh
@@ -0,0 +1,35 @@
+#!/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")
+
+(
+ cd ../..
+ git submodule update --init
+)
+
+if [ -d "$objdir/gnu-efi" ];then
+ cd "$objdir/gnu-efi"
+ EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"
+ make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH clean
+fi
+
+cd "$objdir/efi"
diff --git a/mk/efi.mk b/mk/efi.mk
index 5de3a844..3390cfcd 100644
--- a/mk/efi.mk
+++ b/mk/efi.mk
@@ -20,11 +20,6 @@ ifeq ($(ARCH),x86_64)
EFI_SUBARCH = $(ARCH)
endif
-output = $(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(objdir))
-ifneq ($(output),)
-$(error Failed to build gnu-efi for $(EFI_SUBARCH))
-endif
-
#LIBDIR=/usr/lib
FORMAT=efi-app-$(EFI_SUBARCH)
@@ -49,6 +44,12 @@ SFLAGS = $(GCCOPT) $(GCCWARN) $(ARCHOPT) \
-nostdinc -iwithprefix include \
-I$(com32)/libutil/include -I$(com32)/include -I$(com32)/include/sys $(GPLINCLUDE)
+LIBEFI = $(objdir)/lib/libefi.a
+
+$(LIBEFI):
+ @echo Building gnu-efi for $(EFI_SUBARCH)
+ $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(objdir)
+
%.o: %.S # Cancel old rule
%.o: %.c