[syslinux:firmware] efi: Add build scripts for gnu-efi

syslinux-bot for Matt Fleming matt.fleming at intel.com
Tue Dec 10 14:18:06 PST 2013


Commit-ID:  6e8321066866bf41a91e095fa9421d24dbb886c0
Gitweb:     http://www.syslinux.org/commit/6e8321066866bf41a91e095fa9421d24dbb886c0
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 10 Dec 2013 21:33:53 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Tue, 10 Dec 2013 22:14:06 +0000

efi: Add build scripts for gnu-efi

Now that we have a gnu-efi git submodule we need some scripts to build
and install it into architecture-specific build directories.

This actually simplifies things a bit because we no longer need to
account for the variations in distribution installation paths - we now
control the paths.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 efi/build-gnu-efi.sh | 18 ++++++++++++++++++
 efi/check-gnu-efi.sh | 11 +++++++++++
 efi/find-gnu-efi.sh  | 43 -------------------------------------------
 mk/efi.mk            | 21 ++++++---------------
 4 files changed, 35 insertions(+), 58 deletions(-)

diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh
new file mode 100755
index 0000000..e90b714
--- /dev/null
+++ b/efi/build-gnu-efi.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+ARCH=$1
+objdir=$2
+topdir=$3
+
+pushd $topdir
+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
+
+popd
diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh
new file mode 100755
index 0000000..719e945
--- /dev/null
+++ b/efi/check-gnu-efi.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+ARCH=$1
+
+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
+fi
diff --git a/efi/find-gnu-efi.sh b/efi/find-gnu-efi.sh
deleted file mode 100755
index bf203d8..0000000
--- a/efi/find-gnu-efi.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-# Find where the gnu-efi package has been installed as this location
-# differs across distributions.
-
-include_dirs="/usr/include /usr/local/include"
-lib_dirs="/usr/lib /usr/lib64 /usr/local/lib /usr/lib32"
-
-find_include()
-{
-    for d in $include_dirs; do
-	found=`find $d -name efi -type d 2> /dev/null`
-	if [ "$found"x != "x" ] && [ -e $found/$ARCH/efibind.h ]; then
-	    echo $found
-	    break;
-	fi
-    done
-}
-
-find_lib()
-{
-    for d in $lib_dirs; do
-	found=`find $d -name libgnuefi.a 2> /dev/null`
-	if [ "$found"x != "x" ]; then
-	    crt_name='crt0-efi-'$ARCH'.o'
-	    crt=`find $d -name $crt_name 2> /dev/null`
-	    if [ "$crt"x != "x" ]; then
-		echo $d
-		break;
-	    fi
-	fi
-    done
-}
-
-ARCH=$2
-case $1 in
-    include)
-	find_include
-	;;
-    lib)
-	find_lib
-	;;
-esac
diff --git a/mk/efi.mk b/mk/efi.mk
index a0c33ac..e12e0a6 100644
--- a/mk/efi.mk
+++ b/mk/efi.mk
@@ -7,11 +7,9 @@ core = $(topdir)/core
 # Set up architecture specifics; for cross compilation, set ARCH as apt
 # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories
 # set up the LIBDIR and EFIINC for building for the appropriate architecture
-# For now, the following assumptions are made:
-# 1. gnu-efi lib for IA32 is installed in /usr/local/lib
-# and the include files in /usr/local/include/efi.
-# 2. gnu-efi lib for x86_64 is installed in /usr/lib
-# and the include files in /usr/include/efi.
+EFIINC = $(objdir)/include/efi
+LIBDIR  = $(objdir)/lib
+
 ifeq ($(ARCH),i386)
 	SARCHOPT = -march=i386
 	CARCHOPT = -m32 -march=i386
@@ -23,13 +21,7 @@ ifeq ($(ARCH),x86_64)
 	EFI_SUBARCH = $(ARCH)
 endif
 
-EFIINC = $(shell $(topdir)/efi//find-gnu-efi.sh include $(EFI_SUBARCH))
-$(if $(EFIINC),, \
-	$(error Missing $(EFI_SUBARCH) gnu-efi header files))
-
-LIBDIR = $(shell $(topdir)/efi/find-gnu-efi.sh lib $(EFI_SUBARCH))
-$(if $(LIBDIR),, \
-	$(error Missing $(EFI_SUBARCH) gnu-efi libraries))
+$(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH))
 
 #LIBDIR=/usr/lib
 FORMAT=efi-app-$(EFI_SUBARCH)
@@ -44,9 +36,8 @@ CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \
 		-DLDLINUX=\"$(LDLINUX)\" -fvisibility=hidden \
 		-Wno-unused-parameter
 
-# gnuefi sometimes installs these under a gnuefi/ directory, and sometimes not
-CRT0 := $(shell find $(LIBDIR) -name crt0-efi-$(EFI_SUBARCH).o 2>/dev/null | tail -n1)
-LDSCRIPT := $(shell find $(LIBDIR) -name elf_$(EFI_SUBARCH)_efi.lds 2>/dev/null | tail -n1)
+CRT0 := $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o
+LDSCRIPT := $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds
 
 LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc \
 		-L$(LIBDIR) --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E


More information about the Syslinux-commits mailing list