package/efitools: new package
PATCH 1/1 package/efitools: new package
From: Hendrik De Vloed <[email protected]>
The efitools package provides utilities for managing UEFI Secure Boot keys and includes sample EFI applications. Binaries such as efi-readvar, efi-updatevar and cert-to-efi-sig-list are built for the target system.
Inspired by https://lists.buildroot.org/pipermail/buildroot/2018-July/213212.html.
Patch series can be found here:
https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools
Note that 0001-add-binary-only-make-rules.patch has been moved to 0018-add-binary-only-make-rules.patch, because two patches start with 0001, and buildroot prepares the lowercase first while applying.
--- package/Config.in | 1 + package/Config.in.host | 1 + .../0001-Fix-for-the-cross-compilation.patch | 185 +++++++++++++++ ...e-_GNU_SOURCE-for-a-declaration-of-f.patch | 29 +++ ...e-wrong-dependency-for-blacklist.esl.patch | 29 +++ ...tem-warm-reset-after-the-key-provisi.patch | 45 ++++ ...w-to-override-tools-for-target-build.patch | 95 ++++++++ ...-Makefile-remove-help2man-dependency.patch | 35 +++ ...ic-keyword-for-IsValidVariableHeader.patch | 39 ++++ ...-openssl.cnf-for-openssl-1.0.x-1.1.x.patch | 51 ++++ ...mpilation-against-latest-usr-include.patch | 40 ++++ ...ckDown-enable-the-enrollment-for-DBX.patch | 86 +++++++ ...the-error-message-with-3-sec-timeout.patch | 97 ++++++++ ...kefile-do-not-build-signed-efi-image.patch | 43 ++++ .../efitools/0013-Build-DBX-by-default.patch | 47 ++++ ...-the-entrance-into-BIOS-setup-to-re-.patch | 50 ++++ ...5-fix-segfault-for-efitools-commands.patch | 220 ++++++++++++++++++ ...6-Make.rules-Pass-CFLAGS-to-Makefile.patch | 32 +++ ...les-fix-efi-files-for-gnu-efi-3.0.18.patch | 38 +++ .../0018-add-binary-only-make-rules.patch | 44 ++++ ...les-allow-to-specify-the-target-arch.patch | 27 +++ package/efitools/Config.in | 15 ++ package/efitools/Config.in.host | 13 ++ package/efitools/efitools.hash | 3 + package/efitools/efitools.mk | 42 ++++ 25 files changed, 1307 insertions(+) create mode 100644 package/efitools/0001-Fix-for-the-cross-compilation.patch create mode 100644 package/efitools/0002-Make.rules-define-_GNU_SOURCE-for-a-declaration-of-f.patch create mode 100644 package/efitools/0003-Fix-the-wrong-dependency-for-blacklist.esl.patch create mode 100644 package/efitools/0004-LockDown-run-system-warm-reset-after-the-key-provisi.patch create mode 100644 package/efitools/0005-Allow-to-override-tools-for-target-build.patch create mode 100644 package/efitools/0006-Makefile-remove-help2man-dependency.patch create mode 100644 package/efitools/0007-Add-static-keyword-for-IsValidVariableHeader.patch create mode 100644 package/efitools/0008-Dynamically-load-openssl.cnf-for-openssl-1.0.x-1.1.x.patch create mode 100644 package/efitools/0009-console.c-Fix-compilation-against-latest-usr-include.patch create mode 100644 package/efitools/0010-LockDown-enable-the-enrollment-for-DBX.patch create mode 100644 package/efitools/0011-LockDown-show-the-error-message-with-3-sec-timeout.patch create mode 100644 package/efitools/0012-Makefile-do-not-build-signed-efi-image.patch create mode 100644 package/efitools/0013-Build-DBX-by-default.patch create mode 100644 package/efitools/0014-LockDown-disable-the-entrance-into-BIOS-setup-to-re-.patch create mode 100644 package/efitools/0015-fix-segfault-for-efitools-commands.patch create mode 100644 package/efitools/0016-Make.rules-Pass-CFLAGS-to-Makefile.patch create mode 100644 package/efitools/0017-Make.rules-fix-efi-files-for-gnu-efi-3.0.18.patch create mode 100644 package/efitools/0018-add-binary-only-make-rules.patch create mode 100644 package/efitools/0019-Make.rules-allow-to-specify-the-target-arch.patch create mode 100644 package/efitools/Config.in create mode 100644 package/efitools/Config.in.host create mode 100644 package/efitools/efitools.hash create mode 100644 package/efitools/efitools.mk
package/Config.in +1 -0
@@ -2845,6 +2845,7 @@ menu "System tools" source "package/earlyoom/Config.in" source "package/efibootmgr/Config.in" source "package/efivar/Config.in" + source "package/efitools/Config.in" source "package/embiggen-disk/Config.in" source "package/emlog/Config.in" source "package/fluent-bit/Config.in"
package/Config.in.host +1 -0
@@ -33,6 +33,7 @@ menu "Host utilities" source "package/dtc/Config.in.host" source "package/e2fsprogs/Config.in.host" source "package/e2tools/Config.in.host" + source "package/efitools/Config.in.host" source "package/environment-setup/Config.in.host" source "package/erofs-utils/Config.in.host" source "package/eudev/Config.in.host"
package/efitools/0001-Fix-for-the-cross-compilation.patch new file +185 -0
185 lines not on this page · raw message
package/efitools/0002-Make.rules-define-_GNU_SOURCE-for-a-declaration-of-f.patch new file +29 -0
@@ -0,0 +1,29 @@ +From b8f346ccaad6d39828a90c56630f2ed10e41a08f Mon Sep 17 00:00:00 2001 +From: Yi Zhao <[email protected]> +Date: Sat, 24 Jun 2023 14:58:14 +0800 +Subject: [PATCH] Make.rules: define _GNU_SOURCE for a declaration of function + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Pending +Signed-off-by: Yi Zhao <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + Make.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Make.rules b/Make.rules +index 65a634c..66d63f0 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -14,7 +14,7 @@ else + $(error unknown architecture $(ARCH)) + endif + INCDIR = -I$(TOPDIR)include/ -I$(INCDIR_PREFIX)/usr/include -I$(INCDIR_PREFIX)/usr/include/efi -I$(INCDIR_PREFIX)/usr/include/efi/$(ARCH) -I$(INCDIR_PREFIX)/usr/include/efi/protocol +-cppflags = -DCONFIG_$(ARCH) ++cppflags = -DCONFIG_$(ARCH) -D_GNU_SOURCE + cflags = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check + ldflags = -nostdlib + CRTOBJ = crt0-efi-$(ARCH).o +-- +2.43.0 +
package/efitools/0003-Fix-the-wrong-dependency-for-blacklist.esl.patch new file +29 -0
@@ -0,0 +1,29 @@ +From 4325daa8e467e232e696ed22a3d3c0b76554334c Mon Sep 17 00:00:00 2001 +From: Lans Zhang <[email protected]> +Date: Tue, 15 Mar 2016 21:07:31 +0800 +Subject: [PATCH] Fix the wrong dependency for %-blacklist.esl + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Pending +Signed-off-by: Lans Zhang <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + Make.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Make.rules b/Make.rules +index 66d63f0..fed93b9 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -75,7 +75,7 @@ endif + %.hash: %.efi hash-to-efi-sig-list + ./hash-to-efi-sig-list $< $@ + +-%-blacklist.esl: %.crt cert-to-efi-hash-list ++%-blacklist.esl: %.crt cert-to-efi-sig-list + ./cert-to-efi-sig-list $< $@ + + %-hash-blacklist.esl: %.crt cert-to-efi-hash-list +-- +2.43.0 +
package/efitools/0004-LockDown-run-system-warm-reset-after-the-key-provisi.patch new file +45 -0
45 lines not on this page · raw message
package/efitools/0005-Allow-to-override-tools-for-target-build.patch new file +95 -0
95 lines not on this page · raw message
package/efitools/0006-Makefile-remove-help2man-dependency.patch new file +35 -0
@@ -0,0 +1,35 @@ +From ef44a16cc563659d5b108664c1eca709ba6903e4 Mon Sep 17 00:00:00 2001 +From: Yi Zhao <[email protected]> +Date: Sat, 24 Jun 2023 15:26:27 +0800 +Subject: [PATCH] Makefile: remove help2man dependency + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Inappropriate [embedded specific] +Signed-off-by: Yi Zhao <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 0343224..f493778 100644 +--- a/Makefile ++++ b/Makefile +@@ -27,13 +27,11 @@ include Make.rules + + EFISIGNED = $(patsubst %.efi,%-signed.efi,$(EFIFILES)) + +-all: $(EFISIGNED) $(BINARIES) $(MANPAGES) noPK.auth $(KEYAUTH) \ ++all: $(EFISIGNED) $(BINARIES) noPK.auth $(KEYAUTH) \ + $(KEYUPDATEAUTH) $(KEYBLACKLISTAUTH) $(KEYHASHBLACKLISTAUTH) + + + install: all +- $(INSTALL) -m 755 -d $(MANDIR) +- $(INSTALL) -m 644 $(MANPAGES) $(MANDIR) + $(INSTALL) -m 755 -d $(EFIDIR) + $(INSTALL) -m 755 $(EFIFILES) $(EFIDIR) + $(INSTALL) -m 755 -d $(BINDIR) +-- +2.43.0 +
package/efitools/0007-Add-static-keyword-for-IsValidVariableHeader.patch new file +39 -0
@@ -0,0 +1,39 @@ +From c17225f9681e5ec04bc1e69db943f044061a0cf8 Mon Sep 17 00:00:00 2001 +From: Lans Zhang <[email protected]> +Date: Sun, 12 Jun 2016 13:45:54 +0800 +Subject: [PATCH] Add static keyword for IsValidVariableHeader() + +GCC does not inline any functions when not optimizing (-O0 specified) unless +you specify "always_inline" attribute for the function. + +By default, GCC complies with C89 standard for c code, which means +"inline" equals to "extern inline" and thus the definition is used only for +inlining with the assembly code actually generated. + +Therefore, "static inline" is used for both purposes. If -O0 is specified, +GCC will generate the assembly code as long as the function is referred. + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Inappropriate [embedded specific] +Signed-off-by: Lans Zhang <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + include/variableformat.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/variableformat.h b/include/variableformat.h +index 32cde05..45d0ebb 100644 +--- a/include/variableformat.h ++++ b/include/variableformat.h +@@ -109,7 +109,7 @@ typedef struct { + + #pragma pack() + +-inline BOOLEAN ++static inline BOOLEAN + IsValidVariableHeader (VARIABLE_HEADER *vh) { + if (vh == NULL || vh->StartId != VARIABLE_DATA) + return FALSE; +-- +2.43.0 +
package/efitools/0008-Dynamically-load-openssl.cnf-for-openssl-1.0.x-1.1.x.patch new file +51 -0
51 lines not on this page · raw message
package/efitools/0009-console.c-Fix-compilation-against-latest-usr-include.patch new file +40 -0
@@ -0,0 +1,40 @@ +From ea384e6462f41d425370a081efa0400ed60d35b7 Mon Sep 17 00:00:00 2001 +From: Jason Wessel <[email protected]> +Date: Mon, 4 Nov 2019 12:42:49 -0800 +Subject: [PATCH] console.c: Fix compilation against latest /usr/include/efi +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +| gcc -I/opt/tmp/work/x86_64-linux/efitools-native/1.9.2+gitAUTOINC+392836a46c-r0/git/include/ -I/opt/tmp/work/x86_64-linux/efitools-native/1.9.2+gitAUTOINC+392836a46c-r0/recipe-sysroot-native/usr/include -I/opt/tmp/work/x86_64-linux/efitools-native/1.9.2+gitAUTOINC+392836a46c-r0/recipe-sysroot-native/usr/include/efi -I/opt/tmp/work/x86_64-linux/efitools-native/1.9.2+gitAUTOINC+392836a46c-r0/recipe-sysroot-native/usr/include/efi/x86_64 -I/opt/tmp/work/x86_64-linux/efitools-native/1.9.2+gitAUTOINC+392836a46c-r0/recipe-sysroot-native/usr/include/efi/protocol -O2 -g -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check -DGNU_EFI_USE_MS_ABI -DEFI_FUNCTION_WRAPPER -mno-red-zone -DCONFIG_x86_64 -fno-toplevel-reorder -DBUILD_EFI -c console.c -o console.efi.o +| console.c:360:5: error: ‘EFI_WARN_UNKOWN_GLYPH’ undeclared here (not in a function); did you mean ‘EFI_WARN_UNKNOWN_GLYPH’? +| { EFI_WARN_UNKOWN_GLYPH, L"Warning Unknown Glyph"}, +| ^~~~~~~~~~~~~~~~~~~~~ +| EFI_WARN_UNKNOWN_GLYPH +| ../Make.rules:113: recipe for target 'console.efi.o' failed +| + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Pending +Signed-off-by: Jason Wessel <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + lib/console.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/console.c b/lib/console.c +index 9c10560..b932a44 100644 +--- a/lib/console.c ++++ b/lib/console.c +@@ -357,7 +357,7 @@ static struct { + { EFI_SECURITY_VIOLATION, L"Security Violation"}, + + // warnings +- { EFI_WARN_UNKOWN_GLYPH, L"Warning Unknown Glyph"}, ++ { EFI_WARN_UNKNOWN_GLYPH, L"Warning Unknown Glyph"}, + { EFI_WARN_DELETE_FAILURE, L"Warning Delete Failure"}, + { EFI_WARN_WRITE_FAILURE, L"Warning Write Failure"}, + { EFI_WARN_BUFFER_TOO_SMALL, L"Warning Buffer Too Small"}, +-- +2.43.0 +
package/efitools/0010-LockDown-enable-the-enrollment-for-DBX.patch new file +86 -0
86 lines not on this page · raw message
package/efitools/0011-LockDown-show-the-error-message-with-3-sec-timeout.patch new file +97 -0
97 lines not on this page · raw message
package/efitools/0012-Makefile-do-not-build-signed-efi-image.patch new file +43 -0
43 lines not on this page · raw message
package/efitools/0013-Build-DBX-by-default.patch new file +47 -0
47 lines not on this page · raw message
package/efitools/0014-LockDown-disable-the-entrance-into-BIOS-setup-to-re-.patch new file +50 -0
50 lines not on this page · raw message
package/efitools/0015-fix-segfault-for-efitools-commands.patch new file +220 -0
220 lines not on this page · raw message
package/efitools/0016-Make.rules-Pass-CFLAGS-to-Makefile.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 0a35118497477f30d4b5ae0c60882072c5fc9a97 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Thu, 17 Aug 2023 15:11:25 +0800 +Subject: [PATCH] Make.rules: Pass CFLAGS to Makefile + +Make sure the right debug directory remapping options are passed to +the compiler. + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Pending +Signed-off-by: Mingli Yu <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + Make.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Make.rules b/Make.rules +index 0316ce5..90f444a 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -15,7 +15,7 @@ $(error unknown architecture $(ARCH)) + endif + INCDIR = -I$(TOPDIR)include/ -I$(INCDIR_PREFIX)/usr/include -I$(INCDIR_PREFIX)/usr/include/efi -I$(INCDIR_PREFIX)/usr/include/efi/$(ARCH) -I$(INCDIR_PREFIX)/usr/include/efi/protocol + cppflags = -DCONFIG_$(ARCH) -D_GNU_SOURCE +-cflags = -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check ++cflags = $(CFLAGS) -O2 -g $(ARCH3264) -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -fno-stack-protector -ffreestanding -fno-stack-check + ldflags = -nostdlib + CRTOBJ = crt0-efi-$(ARCH).o + CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi /usr/lib/gnuefi /usr/lib64/gnuefi +-- +2.43.0 +
package/efitools/0017-Make.rules-fix-efi-files-for-gnu-efi-3.0.18.patch new file +38 -0
@@ -0,0 +1,38 @@ +From 5832f5d81438cdaf92f79f01921bfa35873e21a2 Mon Sep 17 00:00:00 2001 +From: Yi Zhao <[email protected]> +Date: Thu, 6 Jun 2024 22:16:52 +0800 +Subject: [PATCH] Make.rules: fix efi files for gnu-efi 3.0.18 + +With commit [1] and [2] in gnu-efi 3.0.18, For efi files, the .dynsym +section was dropped and the .rodata section was splitted out from lds +files. These changes make LockDown.efi no longer work. Referring to +gnu-efi 3.0.18, copy .rodata section and remove .dynsym section to efi +files. + +[1] https://sourceforge.net/p/gnu-efi/code/ci/1be024100e80885cfbc840e322673cb850b57316 +[2] https://sourceforge.net/p/gnu-efi/code/ci/b3e80c38bcab002bef2b9e66b7037fbb1980e173 + +Source: https://github.com/Wind-River/meta-secure-core/tree/c4f7798/meta-efi-secure-boot/recipes-bsp/efitools/efitools +Upstream: Pending +Signed-off-by: Yi Zhao <[email protected]> +Signed-off-by: Hendrik De Vloed <[email protected]> +--- + Make.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Make.rules b/Make.rules +index 90f444a..2c08e48 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -65,7 +65,7 @@ ifeq ($(ARCH),aarch64) + endif + + %.efi: %.so +- $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ ++ $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .rodata \ + -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ + -j .reloc $(FORMAT) $*.so $@ + %.so: %.o +-- +2.43.0 +
package/efitools/0018-add-binary-only-make-rules.patch new file +44 -0
44 lines not on this page · raw message
package/efitools/0019-Make.rules-allow-to-specify-the-target-arch.patch new file +27 -0
@@ -0,0 +1,27 @@ +From 09f491cec9aaf9156926f89abbf0aa2feaf99502 Mon Sep 17 00:00:00 2001 +From: Thomas Devoogdt <[email protected]> +Date: Thu, 4 Dec 2025 23:08:35 +0100 +Subject: [PATCH] Make.rules: allow to specify the target arch + +Upstream: Inappropriate [embedded specific] +Signed-off-by: Thomas Devoogdt <[email protected]> +--- + Make.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Make.rules b/Make.rules +index 2c08e48..ba42d75 100644 +--- a/Make.rules ++++ b/Make.rules +@@ -1,7 +1,7 @@ + EFISIGNED = $(patsubst %.efi,%-signed.efi,$(EFIFILES)) + MANPAGES = $(patsubst doc/%.1.in,doc/%.1,$(wildcard doc/*.1.in)) + HELP2MAN = help2man +-ARCH = $(shell uname -m | sed 's/i.86/ia32/;s/arm.*/arm/') ++ARCH ?= $(shell uname -m | sed 's/i.86/ia32/;s/arm.*/arm/') + ifeq ($(ARCH),ia32) + ARCH3264 = -m32 + else ifeq ($(ARCH),x86_64) +-- +2.43.0 +
package/efitools/Config.in new file +15 -0
@@ -0,0 +1,15 @@ +config BR2_PACKAGE_EFITOOLS + bool "efitools" + depends on BR2_PACKAGE_GNU_EFI_ARCH_SUPPORTS \ + && !BR2_RISCV_64 + select BR2_PACKAGE_GNU_EFI + select BR2_PACKAGE_LIBOPENSSL_ENGINES + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL + help + The efitools package provides utilities for managing UEFI + Secure Boot keys and includes sample EFI applications. + Binaries such as efi-readvar, efi-updatevar and + cert-to-efi-sig-list are built for the target system. + + https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git
package/efitools/Config.in.host new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_HOST_EFITOOLS + bool "host efitools" + select BR2_PACKAGE_HOST_GNU_EFI + select BR2_PACKAGE_HOST_LIBOPENSSL_ENGINES + select BR2_PACKAGE_HOST_OPENSSL + select BR2_PACKAGE_HOST_OPENSSL_FORCE_LIBOPENSSL + help + The efitools package provides utilities for managing UEFI + Secure Boot keys and includes sample EFI applications. + Binaries such as efi-readvar, efi-updatevar and + cert-to-efi-sig-list are built for the target system. + + https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git
package/efitools/efitools.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed +sha256 0f315b36e7d1ba74bfc97ab9f304f0a3072c47578bbe5e42594acae381f9acfe efitools-1.9.2.tar.gz +sha256 824d6063f4319acb32fe5de52738c72e54ce8ff3dea3470462ff135b958480b5 COPYING
package/efitools/efitools.mk new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.43.0
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot