New packages to support UEFI Secure Boot
cover New packages to support UEFI Secure Boot
Patch 1: add efitools package
Patch 2: add gnu-efi host variante required by host-sbsigntools Patch 3: add sbsigntools host and target package
Celso Varella (3):
efitools: new package
gnu-efi: add host variant
sbsigntools: new package
package/Config.in | 2 + package/Config.in.host | 1 + ...kefile-remove-all-dependencies-from-sbsig.patch | 155 ++++++++++++++++++++ ...ke.rules-remove-all-dependencies-from-sbs.patch | 159 +++++++++++++++++++++ ...tion-of-mount-command-to-turn-compatible-.patch | 27 ++++ package/efitools/Config.in | 9 ++ package/efitools/efitools.hash | 3 + package/efitools/efitools.mk | 21 +++ package/gnu-efi/gnu-efi.mk | 20 +++ .../0001-configure-fix-AM_INIT_AUTOMAKE-call.patch | 32 +++++ ...rove-error-handling-in-__fileio_read_file.patch | 68 +++++++++ package/sbsigntools/Config.in | 20 +++ package/sbsigntools/Config.in.host | 7 + package/sbsigntools/sbsigntools.hash | 10 ++ package/sbsigntools/sbsigntools.mk | 83 +++++++++++ 15 files changed, 617 insertions(+) create mode 100644 package/efitools/0001-Efitools-Makefile-remove-all-dependencies-from-sbsig.patch create mode 100644 package/efitools/0002-Efitools-Make.rules-remove-all-dependencies-from-sbs.patch create mode 100644 package/efitools/0003-remove-l-option-of-mount-command-to-turn-compatible-.patch create mode 100644 package/efitools/Config.in create mode 100644 package/efitools/efitools.hash create mode 100644 package/efitools/efitools.mk create mode 100644 package/sbsigntools/0001-configure-fix-AM_INIT_AUTOMAKE-call.patch create mode 100644 package/sbsigntools/0002-fileio-improve-error-handling-in-__fileio_read_file.patch create mode 100644 package/sbsigntools/Config.in create mode 100644 package/sbsigntools/Config.in.host create mode 100644 package/sbsigntools/sbsigntools.hash create mode 100644 package/sbsigntools/sbsigntools.mk
Signature · 1 line
2.7.4
PATCH 1/3 efitools: new package
Linux user-space application to manipulate UEFI signatures database
Patches 1 and 2 remove dependencies from sbsigntools and perl scripts
Patch 3 remove "-l" option from mount command in lib/kernel_efivars.c for compatibility with Busybox mount command
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/about/
--- package/Config.in | 1 + ...kefile-remove-all-dependencies-from-sbsig.patch | 155 ++++++++++++++++++++ ...ke.rules-remove-all-dependencies-from-sbs.patch | 159 +++++++++++++++++++++ ...tion-of-mount-command-to-turn-compatible-.patch | 27 ++++ package/efitools/Config.in | 9 ++ package/efitools/efitools.hash | 3 + package/efitools/efitools.mk | 21 +++ 7 files changed, 375 insertions(+) create mode 100644 package/efitools/0001-Efitools-Makefile-remove-all-dependencies-from-sbsig.patch create mode 100644 package/efitools/0002-Efitools-Make.rules-remove-all-dependencies-from-sbs.patch create mode 100644 package/efitools/0003-remove-l-option-of-mount-command-to-turn-compatible-.patch create mode 100644 package/efitools/Config.in create mode 100644 package/efitools/efitools.hash create mode 100644 package/efitools/efitools.mk
package/Config.in +1 -0
@@ -2011,6 +2011,7 @@ menu "System tools" source "package/docker-proxy/Config.in" source "package/dsp-tools/Config.in" source "package/efibootmgr/Config.in" + source "package/efitools/Config.in" source "package/efivar/Config.in" source "package/emlog/Config.in" source "package/ftop/Config.in"
package/efitools/0001-Efitools-Makefile-remove-all-dependencies-from-sbsig.patch new file +155 -0
155 lines not on this page · raw message
package/efitools/0002-Efitools-Make.rules-remove-all-dependencies-from-sbs.patch new file +159 -0
159 lines not on this page · raw message
package/efitools/0003-remove-l-option-of-mount-command-to-turn-compatible-.patch new file +27 -0
@@ -0,0 +1,27 @@ +From ccd65d5fa22a95c48c1301ab50d3547f162e3e54 Mon Sep 17 00:00:00 2001 +From: "celso.neto.cwi" <[email protected]> +Date: Tue, 26 Jun 2018 08:31:51 -0300 +Subject: [PATCH 3/3] remove "-l" option of mount command to turn compatible + with mount of busybox + +Signen-off-by: celso.neto.cwi <[email protected]> +--- + lib/kernel_efivars.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/kernel_efivars.c b/lib/kernel_efivars.c +index 630088b..636217b 100644 +--- a/lib/kernel_efivars.c ++++ b/lib/kernel_efivars.c +@@ -38,7 +38,7 @@ kernel_variable_init(void) + if (kernel_efi_path) + return; + mktemp(fname); +- snprintf(cmdline, sizeof(cmdline), "mount -l > %s", fname); ++ snprintf(cmdline, sizeof(cmdline), "mount > %s", fname); + ret = system(cmdline); + if (WEXITSTATUS(ret) != 0) + /* hopefully stderr said what was wrong */ +-- +2.7.4 +
package/efitools/Config.in new file +9 -0
@@ -0,0 +1,9 @@ +config BR2_PACKAGE_EFITOOLS + bool "efitools" + select BR2_PACKAGE_GNU_EFI + select BR2_PACKAGE_OPENSSL + help + A Linux user-space application to manipulate UEFI signatures + database + + https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/about/
package/efitools/efitools.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed: +sha256 64f4f53a1a1b92f38c4cfae9edcb5ba3eb4ef0e8c5d079e04cc03204699d3d38 efitools-1.8.1.tar.gz +sha256 824d6063f4319acb32fe5de52738c72e54ce8ff3dea3470462ff135b958480b5 COPYING
package/efitools/efitools.mk new file +21 -0
@@ -0,0 +1,21 @@ +################################################################################ +# +# efitools +# +################################################################################ + +EFITOOLS_VERSION = 1.8.1 +EFITOOLS_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot +EFITOOLS_LICENSE = GPL-2.0+ +EFITOOLS_LICENSE_FILES = COPYING +EFITOOLS_DEPENDENCIES = gnu-efi openssl + +define EFITOOLS_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) +endef + +define EFITOOLS_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install +endef + +$(eval $(generic-package))
Signature · 1 line
2.7.4
PATCH 1/3 efitools: new package
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Celso" == Celso Varella <[email protected]> writes:
Linux user-space application to manipulate UEFI signatures database Patches 1 and 2 remove dependencies from sbsigntools and perl scripts
These patches are not very nice, as they don't look upstreamable and are likely to cause conflicts every time this package is bumped. Can you explain why exactly they are needed? Your series already add a sbsigntools package, so why would we need to drop the dependency? host-perl is similary available.
Looking at the code, the sbsigntools dependency seems to be for the *-signed.efi files that gets signed by a just created key. That indeed might not be useful for real use cases, but presumably we can just pass EFISIGNED= to make to drop that?
Quoted 2 lines
Patch 3 remove "-l" option from mount command in
lib/kernel_efivars.cfor compatibility with Busybox mount command
Did you try to submit this upstream? What is the -l option used for in this context? E.G. what are we missing from not using it for builds with util-linux mount?
Quoted 4 lines
package/efitools/efitools.mk new file +4
-0+################################################################################ +# +# efitools +#
package/efitools/efitools.mk line 14
Quoted 10 lines
package/efitools/efitools.mk new file +10
-0+################################################################################ + +EFITOOLS_VERSION = 1.8.1 +EFITOOLS_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git/snapshot +EFITOOLS_LICENSE = GPL-2.0+ +EFITOOLS_LICENSE_FILES = COPYING +EFITOOLS_DEPENDENCIES = gnu-efi openssl + +define EFITOOLS_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
The Makefile does different things depending on ARCH (which comes from uname -m). This naturally doesn't work in a cross compilation setup, so we need to pass ARCH=<value> depending on the target architecture (and add the needed dependencies to the package so it can only be built for those supported architectures).
Signature · 1 line
Bye, Peter Korsgaard
PATCH 2/3 gnu-efi: add host variant
In reply to Celso VarellaIt will be required by host-sbsigntools (forthcoming package).
--- package/gnu-efi/gnu-efi.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
package/gnu-efi/gnu-efi.mk +20 -0
@@ -26,6 +26,12 @@ else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) GNU_EFI_PLATFORM = aarch64 endif +ifeq ($(HOSTARCH),x86) +HOST_GNU_EFI_PLATFORM = ia32 +else +HOST_GNU_EFI_PLATFORM = $(HOSTARCH) +endif + define GNU_EFI_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ $(TARGET_CONFIGURE_OPTS) \
@@ -39,4 +45,18 @@ define GNU_EFI_INSTALL_STAGING_CMDS PREFIX=/usr ARCH=$(GNU_EFI_PLATFORM) install endef +define HOST_GNU_EFI_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \ + $(HOST_CONFIGURE_OPTS) \ + ARCH=$(HOST_GNU_EFI_PLATFORM) +endef + +define HOST_GNU_EFI_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \ + $(HOST_CONFIGURE_OPTS) \ + INSTALLROOT=$(HOST_DIR) \ + PREFIX= ARCH=$(HOST_GNU_EFI_PLATFORM) install +endef + $(eval $(generic-package)) +$(eval $(host-generic-package))
Signature · 1 line
2.7.4
PATCH 2/3 gnu-efi: add host variant
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Celso" == Celso Varella <[email protected]> writes:
It will be required by host-sbsigntools (forthcoming package).
Signed-off-by Carlos Santos <[email protected]>--- package/gnu-efi/gnu-efi.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)package/gnu-efi/gnu-efi.mk +0
-0
package/gnu-efi/gnu-efi.mk else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) · line 33
Quoted 8 lines
package/gnu-efi/gnu-efi.mk +5
-0@@ -26,6 +26,12 @@ else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) GNU_EFI_PLATFORM = aarch64 endif +ifeq ($(HOSTARCH),x86) +HOST_GNU_EFI_PLATFORM = ia32 +else +HOST_GNU_EFI_PLATFORM = $(HOSTARCH) +endif
While host-gnu-efi shouldn't be a user visible config option, it would still be nice to add a Config.in.host with hidden BR2_PACKAGE_HOST_GNU_EFI_ARCH_SUPPORTS option depending on the supported host architectures, so E.G. host-sbsigntools can depend on it.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 3/3 sbsigntools: new package
In reply to Celso VarellaLinux user-space utility for signing and verifying files for UEFI Secure Boot.
The recipe is a bit complicated because sbsigntools requires a specific version of CCAN (see https://github.com/rustyrussell/ccan/) and uses a script to download, configure and build it. We must patch configure.ac, Makefile.am and the ccan Makefile to remove hard-coded paths and git invocations.
We must also apply two patches already sent to the maintainer by email
- Fix an automake warning that source file 'ccan/time/time.c' is in a subdirectory but option 'subdir-objects' is disabled.
- Improve error handling and prevent a memory leak in an internal function.
The project does not seem to have a bug tracking system neither a mailing list, just a page at kernel.org.
https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/about/
--- package/Config.in | 1 + package/Config.in.host | 1 + .../0001-configure-fix-AM_INIT_AUTOMAKE-call.patch | 32 +++++++++ ...rove-error-handling-in-__fileio_read_file.patch | 68 ++++++++++++++++++ package/sbsigntools/Config.in | 20 ++++++ package/sbsigntools/Config.in.host | 7 ++ package/sbsigntools/sbsigntools.hash | 10 +++ package/sbsigntools/sbsigntools.mk | 83 ++++++++++++++++++++++ 8 files changed, 222 insertions(+) create mode 100644 package/sbsigntools/0001-configure-fix-AM_INIT_AUTOMAKE-call.patch create mode 100644 package/sbsigntools/0002-fileio-improve-error-handling-in-__fileio_read_file.patch create mode 100644 package/sbsigntools/Config.in create mode 100644 package/sbsigntools/Config.in.host create mode 100644 package/sbsigntools/sbsigntools.hash create mode 100644 package/sbsigntools/sbsigntools.mk
package/Config.in +1 -0
@@ -2048,6 +2048,7 @@ menu "System tools" source "package/s6-linux-utils/Config.in" source "package/s6-portable-utils/Config.in" source "package/s6-rc/Config.in" + source "package/sbsigntools/Config.in" source "package/scrub/Config.in" source "package/scrypt/Config.in" source "package/smack/Config.in"
package/Config.in.host +1 -0
@@ -52,6 +52,7 @@ menu "Host utilities" source "package/rauc/Config.in.host" source "package/rustc/Config.in.host" source "package/s6-rc/Config.in.host" + source "package/sbsigntools/Config.in.host" source "package/sam-ba/Config.in.host" source "package/squashfs/Config.in.host" source "package/sunxi-tools/Config.in.host"
package/sbsigntools/0001-configure-fix-AM_INIT_AUTOMAKE-call.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 0af33976848d515703b07c45a2fbfd08b867d4b0 Mon Sep 17 00:00:00 2001 +From: Carlos Santos <[email protected]> +Date: Tue, 3 Jul 2018 15:45:04 -0300 +Subject: [PATCH] configure: fix AM_INIT_AUTOMAKE call + +Requires subdir-objects to prevent warning messages: + + lib/ccan/Makefile.am:2: warning: source file 'ccan/time/time.c' is in a subdirectory, + lib/ccan/Makefile.am:2: but option 'subdir-objects' is disabled + automake: warning: possible forward-incompatibility. + automake: At least a source file is in a subdirectory, but the 'subdir-objects' + +Signed-off-by: Carlos Santos <[email protected]> +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f39400a..e9fc906 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1,6 +1,6 @@ + AC_INIT([sbsigntool], [0.9.1], [James.Bottomley at HansenPartnership.com]) + +-AM_INIT_AUTOMAKE() ++AM_INIT_AUTOMAKE([subdir-objects]) + + AC_PREREQ(2.60) + +-- +2.14.4 +
package/sbsigntools/0002-fileio-improve-error-handling-in-__fileio_read_file.patch new file +68 -0
68 lines not on this page · raw message
package/sbsigntools/Config.in new file +20 -0
@@ -0,0 +1,20 @@ +config BR2_PACKAGE_SBSIGNTOOLS + bool "sbsigntools" + depends on BR2_ARM_CPU_HAS_ARM || BR2_aarch64 || \ + BR2_aarch64_be || BR2_i386 || BR2_x86_64 # gnu-efi + depends on !BR2_nios2 # binutils + depends on BR2_USE_WCHAR # binutils + select BR2_PACKAGE_BINUTILS + select BR2_PACKAGE_GNU_EFI + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_LIBUUID + help + A Linux user-space application to sign and verify application + for UEFI Secure Boot + + https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/about/ + +comment "sbsigntools needs a toolchain w/ wchar" + depends on !BR2_nios2 + depends on !BR2_USE_WCHAR
package/sbsigntools/Config.in.host new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_HOST_SBSIGNTOOLS + bool "host sbsigntools" + help + A Linux user-space application to sign and verify application + for UEFI Secure Boot + + https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/about/
package/sbsigntools/sbsigntools.hash new file +10 -0
@@ -0,0 +1,10 @@ +# locally computed +sha256 981b3576fc16392e2a764aa4089ce7e51843e3c787143ba7dec8cca88cf5ec07 sbsigntools-0.9.1.tar.gz +sha256 d479cffd70764aa6078d7b198472a9ec0b517b2123479fb578b3e5c8ddaa01b0 ccan-b1f28e17227f2320d07fe052a8a48942fe17caa5.tar.gz +sha256 7f424707cdb69df658b7b66ea1f9c9ab3ea0a0988999ecba3dad10a811db654f COPYING +sha256 02a66d6af5a4ef501849a33e6d8a0624e2b4284c8bed19ba0b0c24e8ac1add4e lib/ccan.git/licenses/BSD-3CLAUSE +sha256 89807acf2309bd285f033404ee78581602f3cd9b819a16ac2f0e5f60ff4a473e lib/ccan.git/licenses/BSD-MIT +sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 lib/ccan.git/licenses/GPL-2 +sha256 fc82ca8b6fdb18d4e3e85cfd8ab58d1bcd3f1b29abe782895abd91d64763f8e7 lib/ccan.git/licenses/GPL-3 +sha256 a9bdde5616ecdd1e980b44f360600ee8783b1f99b8cc83a2beb163a0a390e861 lib/ccan.git/licenses/LGPL-2.1 +sha256 a853c2ffec17057872340eee242ae4d96cbf2b520ae27d903e1b2fef1a5f9d1c lib/ccan.git/licenses/LGPL-3
package/sbsigntools/sbsigntools.mk new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/3 sbsigntools: new package
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Celso" == Celso Varella <[email protected]> writes:
Linux user-space utility for signing and verifying files for UEFI Secure Boot.
The recipe is a bit complicated because sbsigntools requires a specific version of CCAN (see https://github.com/rustyrussell/ccan/) and uses a script to download, configure and build it. We must patch configure.ac, Makefile.am and the ccan
Makefileto remove hard-coded paths and git invocations.
Does the script (I take it that you are referring to lib/ccan.git/tools/create-ccan-tree) really download anything? To me it just looks like it copies a number of files from lib/ccan.git to lib/ccan?
As this package comes from git and it already has submodule pointing to the specific version of ccan, perhaps the easiest solution is to get it from git and set SBSIGNTOOL_GIT_SUBMODULES = YES to also fetch the submodule?
Quoted 6 lines
We must also apply two patches already sent to the maintainer by email
- Fix an automake warning that source file '
ccan/time/time.c' is in a subdirectory but option 'subdir-objects' is disabled.
- Improve error handling and prevent a memory leak in an internal function.
While certainly nice, these doesn't sound like something really critical as sbsign isn't a long running program.
Quoted 13 lines
package/sbsigntools/sbsigntools.mk new file +13
-0+################################################################################ +# +# sbsigntools +# +################################################################################ + +SBSIGNTOOLS_VERSION = 0.9.1 +SBSIGNTOOLS_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/snapshot +SBSIGNTOOLS_LICENSE = GPL-3.0+ +SBSIGNTOOLS_LICENSE_FILES = COPYING \ + lib/ccan.git/licenses/BSD-3CLAUSE \ + lib/ccan.git/licenses/BSD-MIT \ + lib/ccan.git/licenses/GPL-2 \
package/sbsigntools/sbsigntools.mk line 23
Quoted 10 lines
package/sbsigntools/sbsigntools.mk new file +10
-0+ lib/ccan.git/licenses/GPL-3 \ + lib/ccan.git/licenses/LGPL-2.1 \ + lib/ccan.git/licenses/LGPL-3 +SBSIGNTOOLS_AUTORECONF = YES + +SBSIGNTOOLS_DEPENDENCIES = host-pkgconf binutils gnu-efi openssl util-linux +SBSIGNTOOLS_CFLAGS = \ + -I$(BINUTILS_DIR)/bfd \ + -I$(BINUTILS_DIR)/include \ + $(TARGET_CFLAGS)
Hmm, looking directly in the files of binutils isn't really nice. Doesn't the binutils package install these under $STAGING_DIR/usr/include? If not, shouldn't it?
package/sbsigntools/sbsigntools.mk line 25
Quoted 2 lines
package/sbsigntools/sbsigntools.mk new file +2
-0+SBSIGNTOOLS_EFI_CPPFLAGS = -I$(HOST_DIR)/include/efi \ + -I$(HOST_DIR)/include/efi/$(HOST_GNU_EFI_PLATFORM)
Hmm, why would a target package need to look at host includes? This variable doesn't seem to be used anywhere?
package/sbsigntools/sbsigntools.mk line 69
Quoted 12 lines
package/sbsigntools/sbsigntools.mk new file +12
-0+define SBSIGNTOOLS_FIX_EFI_CPPFLAGS + $(SED) 's|^EFI_ARCH=.*|EFI_ARCH=$(GNU_EFI_PLATFORM)|;\ + s|/usr/include/efi|$(STAGING_DIR)/usr/include/efi|g' \ + $(@D)/configure.ac +endef +define HOST_SBSIGNTOOLS_FIX_EFI_CPPFLAGS + $(SED) 's|^EFI_ARCH=.*|EFI_ARCH=$(HOST_GNU_EFI_PLATFORM)|;\ + s|/usr/include/efi|$(HOST_DIR)/include/efi|g' \ + $(@D)/configure.ac +endef +SBSIGNTOOLS_POST_EXTRACT_HOOKS += SBSIGNTOOLS_POST_EXTRACT SBSIGNTOOLS_FIX_EFI_CPPFLAGS +HOST_SBSIGNTOOLS_POST_EXTRACT_HOOKS += SBSIGNTOOLS_POST_EXTRACT HOST_SBSIGNTOOLS_FIX_EFI_CPPFLAGS
As we already autoreconf this package it would be great if we could create upstreamable patches add configure options for EFI_ARCH and the efi includes.
Signature · 1 line
Bye, Peter Korsgaard