From 631ab9757851ab642fa5509d6d3cac21a1fdd7f7 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 20 Nov 2014 14:50:04 -0500 Subject: [PATCH] Use patches upstream is going to take for the build fixes - Add some new protocol definitons. Signed-off-by: Peter Jones --- ...-Make-gnuefi-build-and-install-right.patch | 38 ++++++---- ...es-work-with-FreeBSD-s-objcopy-versi.patch | 54 +++++++++++++++ 0003-Add-the-capsule-API.patch | 69 +++++++++++++++++++ 0004-Add-the-QueryVariableInfo-API.patch | 41 +++++++++++ 0005-Add-current-OsIndications-values.patch | 31 +++++++++ gnu-efi.spec | 15 +++- 6 files changed, 230 insertions(+), 18 deletions(-) rename build-fix.patch => 0001-Make-gnuefi-build-and-install-right.patch (68%) create mode 100644 0002-Make-command-lines-work-with-FreeBSD-s-objcopy-versi.patch create mode 100644 0003-Add-the-capsule-API.patch create mode 100644 0004-Add-the-QueryVariableInfo-API.patch create mode 100644 0005-Add-current-OsIndications-values.patch diff --git a/build-fix.patch b/0001-Make-gnuefi-build-and-install-right.patch similarity index 68% rename from build-fix.patch rename to 0001-Make-gnuefi-build-and-install-right.patch index 3f78d96..6be94b5 100644 --- a/build-fix.patch +++ b/0001-Make-gnuefi-build-and-install-right.patch @@ -1,17 +1,25 @@ -From 0a69c42779d1d28aa406fa2c435b180156ee3435 Mon Sep 17 00:00:00 2001 -From: Fedora Ninjas +From d5cf0561d87d755e28b03816964c432b5d943554 Mon Sep 17 00:00:00 2001 +From: Peter Jones Date: Thu, 15 May 2014 21:29:25 -0400 -Subject: [PATCH] Try to make this build. +Subject: [PATCH 1/5] Make gnuefi/ build and install right. +Right now we wind up trying to build gnuefi/.o from a source file that's +an empty string. This is caused by the macros trying to generate +install rules, but there's no real reason to have all that anyway. So +just have some static install rules that are simpler and don't generate +stuff on the fly. + +Signed-off-by: Peter Jones --- - Make.defaults - inc/Makefile - 2 files changed, 12 insertions(+), 22 deletion(-) + gnu-efi-3.0/gnuefi/Makefile | 34 ++++++++++++---------------------- + gnu-efi-3.0/inc/Makefile | 36 +++++++++++------------------------- + 2 files changed, 23 insertions(+), 47 deletions(-) -diff -up a/gnuefi/Makefile b/gnuefi/Makefile ---- a/gnuefi/Makefile 2014-05-15 17:15:54.000000000 -0500 -+++ b/gnuefi/Makefile 2014-05-19 14:02:29.048732554 -0500 -@@ -52,19 +52,6 @@ reloc_aarch64.o: CFLAGS += -fno-jump-tab +diff --git a/gnu-efi-3.0/gnuefi/Makefile b/gnu-efi-3.0/gnuefi/Makefile +index 4717227..d234ac0 100644 +--- a/gnu-efi-3.0/gnuefi/Makefile ++++ b/gnu-efi-3.0/gnuefi/Makefile +@@ -52,19 +52,6 @@ reloc_aarch64.o: CFLAGS += -fno-jump-tables TARGETS = crt0-efi-$(ARCH).o libgnuefi.a @@ -31,7 +39,7 @@ diff -up a/gnuefi/Makefile b/gnuefi/Makefile all: $(TARGETS) libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS)) -@@ -72,14 +59,17 @@ libgnuefi.a: $(patsubst %,libgnuefi.a(%) +@@ -72,14 +59,17 @@ libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS)) clean: rm -f $(TARGETS) *~ *.o $(OBJS) @@ -58,10 +66,10 @@ diff -up a/gnuefi/Makefile b/gnuefi/Makefile +endif include $(SRCDIR)/../Make.rules -diff --git a/inc/Makefile b/inc/Makefile +diff --git a/gnu-efi-3.0/inc/Makefile b/gnu-efi-3.0/inc/Makefile index 526af22..71fded5 100644 ---- a/inc/Makefile -+++ b/inc/Makefile +--- a/gnu-efi-3.0/inc/Makefile ++++ b/gnu-efi-3.0/inc/Makefile @@ -8,34 +8,20 @@ TOPDIR = $(SRCDIR)/.. CDIR=$(TOPDIR)/.. @@ -109,5 +117,5 @@ index 526af22..71fded5 100644 include $(SRCDIR)/../Make.rules -- -1.8.3.1 +2.1.0 diff --git a/0002-Make-command-lines-work-with-FreeBSD-s-objcopy-versi.patch b/0002-Make-command-lines-work-with-FreeBSD-s-objcopy-versi.patch new file mode 100644 index 0000000..bdf86d5 --- /dev/null +++ b/0002-Make-command-lines-work-with-FreeBSD-s-objcopy-versi.patch @@ -0,0 +1,54 @@ +From 079c0b997c8011657e3baed6658fb77b969675b3 Mon Sep 17 00:00:00 2001 +From: Bill Paul +Date: Thu, 20 Nov 2014 14:29:29 -0500 +Subject: [PATCH 2/5] Make command lines work with FreeBSD's objcopy version. + +FreeBSD's binutils doesn't have "-j " support, so we need to +include non-globbed versions of .rel/.rela individually. + +Signed-off-by: Peter Jones +Signed-Off-By: Bill Paul +--- + gnu-efi-3.0/Make.defaults | 7 +++++++ + gnu-efi-3.0/Make.rules | 5 +++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/gnu-efi-3.0/Make.defaults b/gnu-efi-3.0/Make.defaults +index 807205d..169273d 100644 +--- a/gnu-efi-3.0/Make.defaults ++++ b/gnu-efi-3.0/Make.defaults +@@ -133,8 +133,15 @@ endif + # Generic compilation flags + INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \ + -I$(TOPDIR)/inc/protocol ++ ++ifeq (FreeBSD, $(findstring FreeBSD, $(OS))) ++CFLAGS += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \ ++ -ffreestanding -fno-stack-protector ++else + CFLAGS += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \ + -fno-merge-constants -ffreestanding -fno-stack-protector \ + -fno-stack-check ++endif ++ + ASFLAGS += $(ARCH3264) + LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings +diff --git a/gnu-efi-3.0/Make.rules b/gnu-efi-3.0/Make.rules +index 7113b3e..02c7088 100644 +--- a/gnu-efi-3.0/Make.rules ++++ b/gnu-efi-3.0/Make.rules +@@ -35,8 +35,9 @@ + # + + %.efi: %.so +- $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel* \ +- -j .rela* -j .reloc $(FORMAT) $*.so $@ ++ $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ ++ -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ ++ -j .reloc $(FORMAT) $*.so $@ + + %.so: %.o + $(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES) +-- +2.1.0 + diff --git a/0003-Add-the-capsule-API.patch b/0003-Add-the-capsule-API.patch new file mode 100644 index 0000000..0b3b4e2 --- /dev/null +++ b/0003-Add-the-capsule-API.patch @@ -0,0 +1,69 @@ +From ed71ce3a579279c6f60d10c8aecef42292504d5c Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 20 Nov 2014 13:43:18 -0500 +Subject: [PATCH 3/5] Add the capsule API + +Signed-off-by: Peter Jones +--- + gnu-efi-3.0/inc/efiapi.h | 38 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 38 insertions(+) + +diff --git a/gnu-efi-3.0/inc/efiapi.h b/gnu-efi-3.0/inc/efiapi.h +index 2ab9f1f..a3e3fd9 100644 +--- a/gnu-efi-3.0/inc/efiapi.h ++++ b/gnu-efi-3.0/inc/efiapi.h +@@ -585,6 +585,42 @@ EFI_STATUS + OUT UINT32 *HighCount + ); + ++typedef struct { ++ UINT64 Length; ++ union { ++ EFI_PHYSICAL_ADDRESS DataBlock; ++ EFI_PHYSICAL_ADDRESS ContinuationPointer; ++ } Union; ++} EFI_CAPSULE_BLOCK_DESCRIPTOR; ++ ++typedef struct { ++ EFI_GUID CapsuleGuid; ++ UINT32 HeaderSize; ++ UINT32 Flags; ++ UINT32 CapsuleImageSize; ++} EFI_CAPSULE_HEADER; ++ ++#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 ++#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 ++#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000 ++ ++typedef ++EFI_STATUS ++(EFIAPI *EFI_UPDATE_CAPSULE) ( ++ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, ++ IN UINTN CapsuleCount, ++ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL ++ ); ++ ++typedef ++EFI_STATUS ++(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) ( ++ IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, ++ IN UINTN CapsuleCount, ++ OUT UINT64 *MaximumCapsuleSize, ++ OUT EFI_RESET_TYPE *ResetType ++ ); ++ + // + // Protocol handler functions + // +@@ -720,6 +756,8 @@ typedef struct { + EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; + EFI_RESET_SYSTEM ResetSystem; + ++ EFI_UPDATE_CAPSULE UpdateCapsule; ++ EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities; + } EFI_RUNTIME_SERVICES; + + +-- +2.1.0 + diff --git a/0004-Add-the-QueryVariableInfo-API.patch b/0004-Add-the-QueryVariableInfo-API.patch new file mode 100644 index 0000000..9b7b4be --- /dev/null +++ b/0004-Add-the-QueryVariableInfo-API.patch @@ -0,0 +1,41 @@ +From 99050251a94d1cf2179cc614e9a9b19277afea5f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 20 Nov 2014 13:43:38 -0500 +Subject: [PATCH 4/5] Add the QueryVariableInfo() API. + +Signed-off-by: Peter Jones +--- + gnu-efi-3.0/inc/efiapi.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/gnu-efi-3.0/inc/efiapi.h b/gnu-efi-3.0/inc/efiapi.h +index a3e3fd9..708c67f 100644 +--- a/gnu-efi-3.0/inc/efiapi.h ++++ b/gnu-efi-3.0/inc/efiapi.h +@@ -621,6 +621,15 @@ EFI_STATUS + OUT EFI_RESET_TYPE *ResetType + ); + ++typedef ++EFI_STATUS ++(EFIAPI *EFI_QUERY_VARIABLE_INFO) ( ++ IN UINT32 Attributes, ++ OUT UINT64 *MaximumVariableStorageSize, ++ OUT UINT64 *RemainingVariableStorageSize, ++ OUT UINT64 *MaximumVariableSize ++ ); ++ + // + // Protocol handler functions + // +@@ -758,6 +767,7 @@ typedef struct { + + EFI_UPDATE_CAPSULE UpdateCapsule; + EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities; ++ EFI_QUERY_VARIABLE_INFO QueryVariableInfo; + } EFI_RUNTIME_SERVICES; + + +-- +2.1.0 + diff --git a/0005-Add-current-OsIndications-values.patch b/0005-Add-current-OsIndications-values.patch new file mode 100644 index 0000000..69b4f94 --- /dev/null +++ b/0005-Add-current-OsIndications-values.patch @@ -0,0 +1,31 @@ +From d06cdc04a15ba913d64d04d118486dc02ab8f190 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 20 Nov 2014 13:45:25 -0500 +Subject: [PATCH 5/5] Add current OsIndications values. + +Signed-off-by: Peter Jones +--- + gnu-efi-3.0/inc/efidef.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/gnu-efi-3.0/inc/efidef.h b/gnu-efi-3.0/inc/efidef.h +index 666b193..8b70051 100644 +--- a/gnu-efi-3.0/inc/efidef.h ++++ b/gnu-efi-3.0/inc/efidef.h +@@ -208,4 +208,13 @@ typedef UINT8 ISO_639_2; + #define EFI_SIZE_TO_PAGES(a) \ + ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) ) + ++#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 ++#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002 ++#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \ ++ 0x0000000000000004 ++#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \ ++ 0x0000000000000008 ++#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \ ++ 0x0000000000000010 ++ + #endif +-- +2.1.0 + diff --git a/gnu-efi.spec b/gnu-efi.spec index 15bd74a..ebf4e33 100644 --- a/gnu-efi.spec +++ b/gnu-efi.spec @@ -1,16 +1,21 @@ Summary: Development Libraries and headers for EFI Name: gnu-efi Version: 3.0w -Release: 0.1%{?dist} +Release: 2%{?dist} Group: Development/System License: BSD URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 -Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi_%{version}.orig.tar.gz -Patch0: build-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExclusiveArch: %{ix86} x86_64 ia64 aarch64 BuildRequires: git +Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi_%{version}.orig.tar.gz +Patch0001: 0001-Make-gnuefi-build-and-install-right.patch +Patch0002: 0002-Make-command-lines-work-with-FreeBSD-s-objcopy-versi.patch +Patch0003: 0003-Add-the-capsule-API.patch +Patch0004: 0004-Add-the-QueryVariableInfo-API.patch +Patch0005: 0005-Add-current-OsIndications-values.patch + %define debug_package %{nil} # Figure out the right file path to use @@ -84,6 +89,10 @@ rm -rf %{buildroot} %attr(0644,root,root) /boot/efi/EFI/%{efidir}/*.efi %changelog +* Thu Nov 20 2014 Peter Jones - 3.0w-2 +- Use patches upstream is going to take for the build fixes +- Add some new protocol definitons. + * Fri Aug 22 2014 Kyle McMartin - 3.0w-0.1 - New upstream version 3.0w - Add pjones' build fixes patch from that other distro.