Skip to content

Commit

Permalink
gnu-efi-3.0.6: add library to build system
Browse files Browse the repository at this point in the history
This patch adds the gnu-efi library to the ONIE build system.

Signed-off-by: Curt Brune <[email protected]>
  • Loading branch information
Curt Brune committed Feb 27, 2018
1 parent 329681a commit 10c8ed1
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
4 changes: 4 additions & 0 deletions build-config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ ONIE_MIRROR ?= http://mirror.opencompute.org/onie
SECURE_BOOT_ENABLE ?= no
ifeq ($(SECURE_BOOT_ENABLE),yes)
PESIGN_ENABLE = yes
GNU_EFI_ENABLE = yes
endif

include make/kernel-download.make
Expand Down Expand Up @@ -414,6 +415,9 @@ endif
ifeq ($(PESIGN_ENABLE),yes)
include make/pesign.make
endif
ifeq ($(GNU_EFI_ENABLE),yes)
include make/gnu-efi.make
endif
include make/images.make
include make/demo.make

Expand Down
99 changes: 99 additions & 0 deletions build-config/make/gnu-efi.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#-------------------------------------------------------------------------------
#
# Copyright (C) 2017 Curt Brune <[email protected]>
#
# SPDX-License-Identifier: GPL-2.0
#
#-------------------------------------------------------------------------------
#
# This is a makefile fragment that defines the build of gnu-efi
#

GNU_EFI_VERSION = 3.0.6
GNU_EFI_TARBALL = gnu-efi-$(GNU_EFI_VERSION).tar.bz2
GNU_EFI_TARBALL_URLS += $(ONIE_MIRROR) https://downloads.sourceforge.net/project/gnu-efi
GNU_EFI_BUILD_DIR = $(USER_BUILDDIR)/gnu-efi
GNU_EFI_DIR = $(GNU_EFI_BUILD_DIR)/gnu-efi-$(GNU_EFI_VERSION)

GNU_EFI_SRCPATCHDIR = $(PATCHDIR)/gnu-efi
GNU_EFI_DOWNLOAD_STAMP = $(DOWNLOADDIR)/gnu-efi-download
GNU_EFI_SOURCE_STAMP = $(USER_STAMPDIR)/gnu-efi-source
GNU_EFI_PATCH_STAMP = $(USER_STAMPDIR)/gnu-efi-patch
GNU_EFI_BUILD_STAMP = $(USER_STAMPDIR)/gnu-efi-build
GNU_EFI_INSTALL_STAMP = $(STAMPDIR)/gnu-efi-install
GNU_EFI_STAMP = $(GNU_EFI_SOURCE_STAMP) \
$(GNU_EFI_PATCH_STAMP) \
$(GNU_EFI_BUILD_STAMP) \
$(GNU_EFI_INSTALL_STAMP)

GNU_EFI_LIB_PATH = $(DEV_SYSROOT)/usr/lib
GNU_EFI_INCLUDE = $(DEV_SYSROOT)/usr/include/efi


PHONY += gnu-efi gnu-efi-download gnu-efi-source gnu-efi-patch \
gnu-efi-build gnu-efi-install gnu-efi-clean gnu-efi-download-clean

gnu-efi: $(GNU_EFI_STAMP)

DOWNLOAD += $(GNU_EFI_DOWNLOAD_STAMP)
gnu-efi-download: $(GNU_EFI_DOWNLOAD_STAMP)
$(GNU_EFI_DOWNLOAD_STAMP): $(PROJECT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Getting upstream gnu-efi ===="
$(Q) $(SCRIPTDIR)/fetch-package $(DOWNLOADDIR) $(UPSTREAMDIR) \
$(GNU_EFI_TARBALL) $(GNU_EFI_TARBALL_URLS)
$(Q) touch $@

SOURCE += $(GNU_EFI_SOURCE_STAMP)
gnu-efi-source: $(GNU_EFI_SOURCE_STAMP)
$(GNU_EFI_SOURCE_STAMP): $(USER_TREE_STAMP) $(GNU_EFI_DOWNLOAD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Extracting upstream gnu-efi ===="
$(Q) $(SCRIPTDIR)/extract-package $(GNU_EFI_BUILD_DIR) $(DOWNLOADDIR)/$(GNU_EFI_TARBALL)
$(Q) touch $@

gnu-efi-patch: $(GNU_EFI_PATCH_STAMP)
$(GNU_EFI_PATCH_STAMP): $(GNU_EFI_SRCPATCHDIR)/* $(GNU_EFI_SOURCE_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Patching gnu-efi ===="
$(Q) $(SCRIPTDIR)/apply-patch-series $(GNU_EFI_SRCPATCHDIR)/series $(GNU_EFI_DIR)
$(Q) touch $@

ifndef MAKE_CLEAN
GNU_EFI_NEW_FILES = $(shell test -d $(GNU_EFI_DIR) && test -f $(GNU_EFI_BUILD_STAMP) && \
find -L $(GNU_EFI_DIR) -newer $(GNU_EFI_BUILD_STAMP) -type f -print -quit)
endif

gnu-efi-build: $(GNU_EFI_BUILD_STAMP)
$(GNU_EFI_BUILD_STAMP): $(GNU_EFI_PATCH_STAMP) $(GNU_EFI_NEW_FILES) \
| $(DEV_SYSROOT_INIT_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Building gnu-efi-$(GNU_EFI_VERSION) ===="
$(Q) PATH='$(CROSSBIN):$(PATH)' \
$(MAKE) -j1 -C $(GNU_EFI_DIR) \
CROSS_COMPILE=$(CROSSPREFIX)
$(Q) PATH='$(CROSSBIN):$(PATH)' \
$(MAKE) -j1 -C $(GNU_EFI_DIR)/apps \
CROSS_COMPILE=$(CROSSPREFIX)
$(Q) touch $@

gnu-efi-install: $(GNU_EFI_INSTALL_STAMP)
$(GNU_EFI_INSTALL_STAMP): $(SYSROOT_INIT_STAMP) $(GNU_EFI_BUILD_STAMP)
$(Q) rm -f $@ && eval $(PROFILE_STAMP)
$(Q) echo "==== Installing gnu-efi in $(DEV_SYSROOT) ===="
$(Q) PATH='$(CROSSBIN):$(PATH)' \
$(MAKE) -j1 -C $(GNU_EFI_DIR) \
CROSS_COMPILE=$(CROSSPREFIX) \
INSTALLROOT=$(DEV_SYSROOT) PREFIX=/usr \
install
$(Q) touch $@

USERSPACE_CLEAN += gnu-efi-clean
gnu-efi-clean:
$(Q) rm -rf $(GNU_EFI_BUILD_DIR)
$(Q) rm -f $(GNU_EFI_STAMP)
$(Q) echo "=== Finished making $@ for $(PLATFORM)"

DOWNLOAD_CLEAN += gnu-efi-download-clean
gnu-efi-download-clean:
$(Q) rm -f $(GNU_EFI_DOWNLOAD_STAMP) $(DOWNLOADDIR)/$(GNU_EFI_TARBALL)
2 changes: 2 additions & 0 deletions patches/gnu-efi/series
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This series applies on GIT commit 57632e2e12d41deed491f5d1e90353b6e335c7ce
update-makefile-patch
42 changes: 42 additions & 0 deletions patches/gnu-efi/update-makefile-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
update makefile patch

Minor updates to the Makefile to pass in ONIE build environment
variables.

diff --git a/Make.defaults b/Make.defaults
index d825397..7c2f7d2 100755
--- a/Make.defaults
+++ b/Make.defaults
@@ -75,6 +75,11 @@ ifeq ($(ARCH),amd64)
override ARCH := x86_64
endif

+# Seed compiler and linker flags ONIE build environment flags
+CFLAGS = $(ONIE_CFLAGS)
+CPPFLAGS = $(ONIE_CPPFLAGS)
+LDFLAGS = $(ONIE_LDFLAGS)
+
#
# Where to build the package
#
diff --git a/apps/Makefile b/apps/Makefile
index cfae62d..3377d2a 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -45,14 +45,14 @@ TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
LINUX_HEADERS = /usr/src/sys/build
CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include
-CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o
+CRTOBJS = ../$(ARCH)/gnuefi/crt0-efi-$(ARCH).o

LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds
ifneq (,$(findstring FreeBSD,$(OS)))
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
endif

-LDFLAGS += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
+LDFLAGS += -shared -Bsymbolic -L../$(ARCH)/lib -L../$(ARCH)/gnuefi $(CRTOBJS)

LOADLIBES += -lefi -lgnuefi
LOADLIBES += $(LIBGCC)
1 change: 1 addition & 0 deletions upstream/gnu-efi-3.0.6.tar.bz2.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9f0f75b64c84423f3386da6f3200f5ed7471d9cb gnu-efi-3.0.6.tar.bz2

0 comments on commit 10c8ed1

Please sign in to comment.