[syslinux:master] efi: fix up gnu-efi build
syslinux-bot for Gene Cumm
gene.cumm at gmail.com
Sun Feb 23 10:57:07 PST 2014
Commit-ID: dd68a012cbf39d543d34ac6927cb4e4737e16445
Gitweb: http://www.syslinux.org/commit/dd68a012cbf39d543d34ac6927cb4e4737e16445
Author: Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sat, 22 Feb 2014 12:00:11 -0500
Committer: Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 22 Feb 2014 12:00:11 -0500
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 at gmail.com>
---
efi/Makefile | 4 +++-
efi/build-gnu-efi.sh | 23 ++++++++++++----------
efi/check-gnu-efi.sh | 6 ++++--
efi/{build-gnu-efi.sh => clean-gnu-efi.sh} | 31 +++++++++++++-----------------
mk/efi.mk | 11 ++++++-----
5 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/efi/Makefile b/efi/Makefile
index 4bf5a22..d5443bd 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 f9bab98..c87e67c 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 e16e20a..85305f8 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/build-gnu-efi.sh b/efi/clean-gnu-efi.sh
similarity index 56%
copy from efi/build-gnu-efi.sh
copy to efi/clean-gnu-efi.sh
index f9bab98..84ed17a 100755
--- a/efi/build-gnu-efi.sh
+++ b/efi/clean-gnu-efi.sh
@@ -18,23 +18,18 @@ 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"
- exit 1
+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 ../..
-git submodule init
-git submodule update
-
-cd gnu-efi/gnu-efi-3.0/
-
-make ARCH=$ARCH
-
-make ARCH=$ARCH PREFIX=$objdir install
-make ARCH=$ARCH clean
-
-cd $objdir/efi
+cd "$objdir/efi"
diff --git a/mk/efi.mk b/mk/efi.mk
index 5de3a84..3390cfc 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
More information about the Syslinux-commits
mailing list