diff options
-rwxr-xr-x | efi/build-gnu-efi.sh | 25 | ||||
-rwxr-xr-x | efi/check-gnu-efi.sh | 30 | ||||
-rw-r--r-- | mk/efi.mk | 2 |
3 files changed, 52 insertions, 5 deletions
diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh index e90b714d..3844e75b 100755 --- a/efi/build-gnu-efi.sh +++ b/efi/build-gnu-efi.sh @@ -1,10 +1,29 @@ #!/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 3 ]; then +cat <<EOF +Usage: $0: <arch> <srcdir> <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 + <srcdir> - The top-level directory of the Syslinux source + <objdir> - The Syslinux object directory + +EOF + exit 1 +fi + ARCH=$1 -objdir=$2 -topdir=$3 +srcdir=`realpath $2` +objdir=`realpath $3` -pushd $topdir +pushd $srcdir git submodule init git submodule update diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh index 719e9452..3fd193de 100755 --- a/efi/check-gnu-efi.sh +++ b/efi/check-gnu-efi.sh @@ -1,11 +1,39 @@ #!/bin/sh +# Verify that gnu-efi is installed in the object directory for our +# firmware. If it isn't, build it. + +if [ $# -lt 3 ]; then +cat <<EOF +Usage: $0: <arch> <srcdir> <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 + <srcdir> - The top-level directory of the Syslinux source + <objdir> - The Syslinux object directory + +EOF + exit 1 +fi + ARCH=$1 +srcdir=`realpath $2` +objdir=`realpath $3` if [ ! -f $objdir/include/$ARCH/efibind.h ]; then # Build the external project with a clean make environment, as # Syslinux disables built-in implicit rules. export MAKEFLAGS= - $topdir/efi/build-gnu-efi.sh $ARCH $objdir $topdir &> /dev/null + build=$srcdir/efi/build-gnu-efi.sh + $build $ARCH $srcdir $objdir &> /dev/null + if [ $? -ne 0 ]; then + printf "Failed to build gnu-efi. " + printf "Execute the following command for full details: \n\n" + printf "$build $ARCH $srcdir $objdir\n\n" + + exit 1 + fi fi @@ -21,7 +21,7 @@ ifeq ($(ARCH),x86_64) EFI_SUBARCH = $(ARCH) endif -$(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH)) +$(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(topdir) $(objdir)) #LIBDIR=/usr/lib FORMAT=efi-app-$(EFI_SUBARCH) |