summaryrefslogtreecommitdiff
path: root/efi
diff options
context:
space:
mode:
Diffstat (limited to 'efi')
-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
4 files changed, 55 insertions, 13 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"