efivar: new package
PATCH v2 1/2 efivar: new package
efivar contains tools and libraries to manipulate EFI variables.
This package has some restrictions to build. It needs uchar.h which apparently does not come in uClibc, and it also needs __bswap_constant_*() definitions which are only present in glibc. So, this package was limited to build with glibc toolchains.
Although it probably makes sense mostly on x86, x86-64 and aarch64 architectures, there are no architecture specific limitations which would prevent it to build for other architectures, so this restriction was not imposed. This package has been build-tested additionaly on many architectures which support glibc, such as mips, MicroBlaze, sparc64, ppc64. There were some build flag issues found when building to some of these some architectures, although the flags can be also added in the general case, so they were added by default.
It has also been found that in some host systems it failed to build due to not generating the .pc files. This has been tracked to the use of make 3.81, so a patch was prepared for it and was submitted upstream. There's also a dependency on the linux/nvme.h header, which is somewhat conturbed, as it has appeared in user space linux headers 3.12 and in 4.4 it was renamed. This has been solved by restricting it to build with linux headers >= 3.12 and a patch from upstream was picked which fixes it for linux headers >= 4.4.
---
Changes v1 -> v2:
- Remove musl as a possibility as it doesn't define __bswap_constant_*() which are required.
- Add -fPIC and -shared-libgcc to fix issues in mips and MicroBlaze
- Fix license to LGPLv2.1
- Fix HOST_CFLAGS for makeguids host build
- Use EFIVAR_MAKE_OPTS to change variables instead of patching Makefile (pointed out by Thomas Petazzoni)
--- package/Config.in | 1 + .../0001-Workaround-rename-of-linux-nvme.h.patch | 32 ++++++++++++++ .../0002-Make.rules-fix-build-with-make-3.81.patch | 45 +++++++++++++++++++ package/efivar/Config.in | 15 +++++++ package/efivar/efivar.hash | 2 + package/efivar/efivar.mk | 50 ++++++++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 package/efivar/0001-Workaround-rename-of-linux-nvme.h.patch create mode 100644 package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch create mode 100644 package/efivar/Config.in create mode 100644 package/efivar/efivar.hash create mode 100644 package/efivar/efivar.mk
package/Config.in +1 -0
@@ -1625,6 +1625,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS endif source "package/cgroupfs-mount/Config.in" source "package/dsp-tools/Config.in" + source "package/efivar/Config.in" source "package/emlog/Config.in" source "package/ftop/Config.in" source "package/getent/Config.in"
package/efivar/0001-Workaround-rename-of-linux-nvme.h.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 75a73111371526a12712bb7211da2116c0bf40f7 Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <[email protected]> +Date: Thu, 14 Jan 2016 17:02:31 -0500 +Subject: [PATCH] Workaround rename of linux/nvme.h + +Bug: https://bugs.gentoo.org/571548 + +Signed-off-by: Erico Nunes <[email protected]> +--- + src/linux.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/linux.c b/src/linux.c +index b618cfd..9388cd3 100644 +--- a/src/linux.c ++++ b/src/linux.c +@@ -22,7 +22,12 @@ + #include <inttypes.h> + #include <limits.h> + #include <linux/ethtool.h> ++#include <linux/version.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) ++#include <linux/nvme_ioctl.h> ++#else + #include <linux/nvme.h> ++#endif + #include <linux/sockios.h> + #include <net/if.h> + #include <scsi/scsi.h> +-- +2.7.4 +
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch new file +45 -0
45 lines not on this page · raw message
package/efivar/Config.in new file +15 -0
@@ -0,0 +1,15 @@ +config BR2_PACKAGE_EFIVAR + bool "efivar" + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 # linux/nvme.h + # doesn't build with uclibc due to lack of uchar.h + # doesn't build with musl due to lack of __bswap_constant_16 + depends on BR2_TOOLCHAIN_USES_GLIBC + select BR2_PACKAGE_POPT + help + Tools and libraries to manipulate EFI variables + + https://github.com/rhinstaller/efivar + +comment "efivar requires an (e)glibc toolchain w/ headers >= 3.12" + depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \ + !BR2_TOOLCHAIN_USES_GLIBC
package/efivar/efivar.hash new file +2 -0
@@ -0,0 +1,2 @@ +# locally computed hash +sha256 f807f5f0846323bc21b18043542b296f5ad81514f91f13c74a4b8da30c965c94 efivar-0.23.tar.gz
package/efivar/efivar.mk new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
2.8.0
PATCH v2 2/2 efibootmgr: new package
A Linux user-space application to modify the Intel Extensible Firmware Interface (EFI) Boot Manager. This application can create and destroy boot entries, change the boot order, change the next running boot option, and more.
The only issue found was that it was trying to include headers from the host, so $(STAGING_DIR) has been prepended to the include path so that the package finds the right headers.
efibootmgr depends on the libraries provided by efivar.
---
Changes v1 -> v2:
- Only rebase to v2 submission of the efivar patch.
--- package/Config.in | 1 + package/efibootmgr/Config.in | 10 ++++++++++ package/efibootmgr/efibootmgr.hash | 2 ++ package/efibootmgr/efibootmgr.mk | 23 +++++++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 package/efibootmgr/Config.in create mode 100644 package/efibootmgr/efibootmgr.hash create mode 100644 package/efibootmgr/efibootmgr.mk
package/Config.in +1 -0
@@ -1625,6 +1625,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS endif source "package/cgroupfs-mount/Config.in" source "package/dsp-tools/Config.in" + source "package/efibootmgr/Config.in" source "package/efivar/Config.in" source "package/emlog/Config.in" source "package/ftop/Config.in"
package/efibootmgr/Config.in new file +10 -0
@@ -0,0 +1,10 @@ +config BR2_PACKAGE_EFIBOOTMGR + bool "efibootmgr" + depends on BR2_PACKAGE_EFIVAR + help + A Linux user-space application to modify the Intel Extensible + Firmware Interface (EFI) Boot Manager. This application can create + and destroy boot entries, change the boot order, change the next + running boot option, and more. + + https://github.com/rhinstaller/efibootmgr
package/efibootmgr/efibootmgr.hash new file +2 -0
@@ -0,0 +1,2 @@ +# locally computed hash +sha256 b180d7d6b377d24b0872869f2571e2700b618e4d7ebdc2133134a918efe2623b efibootmgr-efibootmgr-0.12.tar.gz
package/efibootmgr/efibootmgr.mk new file +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# efibootmgr +# +################################################################################ + +EFIBOOTMGR_VERSION = efibootmgr-0.12 +EFIBOOTMGR_SITE = $(call github,rhinstaller,efibootmgr,$(EFIBOOTMGR_VERSION)) +EFIBOOTMGR_LICENSE = GPLv2 +EFIBOOTMGR_LICENSE_FILES = COPYING +EFIBOOTMGR_DEPENDENCIES = efivar + +define EFIBOOTMGR_BUILD_CMDS + $(SED) 's,-I/,-I$(STAGING_DIR)/,' $(@D)/Makefile + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) +endef + +define EFIBOOTMGR_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/src/efibootmgr/efibootmgr \ + $(TARGET_DIR)/usr/bin/efibootmgr +endef + +$(eval $(generic-package))
Signature · 1 line
2.8.0
PATCH v2 2/2 efibootmgr: new package
Hello,
Quoted 5 lines · Erico Nunes
A Linux user-space application to modify the Intel Extensible Firmware Interface (EFI) Boot Manager. This application can create and destroy boot entries, change the boot order, change the next running boot option, and more.
Quoted 7 lines
The only issue found was that it was trying to include headers from the host, so $(STAGING_DIR) has been prepended to the include path so that the package finds the right headers.
efibootmgr depends on the libraries provided by efivar.
Signed-off-by Erico Nunes <[email protected]>
I've applied your patch, after making a few changes. See below for some comments.
package/efibootmgr/Config.in line 3
Quoted 3 lines
package/efibootmgr/Config.in new file +3
-0+config BR2_PACKAGE_EFIBOOTMGR + bool "efibootmgr" + depends on BR2_PACKAGE_EFIVAR
We normally use a "select" for such dependencies, so I've changed this to a select (and of course propagated the dependencies of efivar and added a comment).
Quoted 6 lines
package/efibootmgr/efibootmgr.mk new file +0
-0
package/efibootmgr/efibootmgr.mk line 9
Quoted 9 lines
package/efibootmgr/efibootmgr.mk new file +9
-0@@ -0,0 +1,23 @@ +################################################################################ +# +# efibootmgr +# +################################################################################ + +EFIBOOTMGR_VERSION = efibootmgr-0.12 +EFIBOOTMGR_SITE = $(call github,rhinstaller,efibootmgr,$(EFIBOOTMGR_VERSION)) +EFIBOOTMGR_LICENSE = GPLv2
The license is really GPLv2+, at least according to efibootmgr.c.
package/efibootmgr/efibootmgr.mk line 14
Quoted 2 lines
package/efibootmgr/efibootmgr.mk new file +2
-0+define EFIBOOTMGR_BUILD_CMDS + $(SED) 's,-I/,-I$(STAGING_DIR)/,' $(@D)/Makefile
I've moved this tweak to a post-patch hook.
In fact, it would have been better to have a patch, submitted upstream, that uses the -I= syntax. = gets automatically replaced by the sysroot of the compiler. However, upstream has significantly changed the makefiles since the 0.12 release, so it didn't make much sense.
BTW, have you seen that after the 0.12 release, they have made some fixes to efibootmgr to make it work properly with efivar 0.24 (which we have) ? See
https://github.com/rhinstaller/efibootmgr/commit/d44b6bba411587c77ed25775bc1f9d962550604c.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 efivar: new package
In reply to Erico NunesHello,
Quoted 12 lines · Erico Nunes
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch new file +6
-0@@ -0,0 +1,45 @@ +From 00376f4dec71d4abb591ba07bc8164ba29e5955e Mon Sep 17 00:00:00 2001 +From: Erico Nunes <[email protected]> +Date: Tue, 22 Mar 2016 21:43:44 -0300 +Subject: [PATCH] Make.rules: fix build with make <= 3.81 + +Building with host make 3.81 resulted in an issue where src/efivar.pc
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch line 16
Quoted 10 lines
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch new file +10
-0+was never generated. +Even by running 'make efivar.pc' inside the src directory, make always +returned that there was nothing to do. +This was not observed when using make 3.82 or 4.x. +It is apparently caused by the assignment operators in the multi-line +defines in Make.rules, which do not seem to be supported by make 3.81. +By omitting the assignment operators, the rule works with both versions +of make. + +Signed-off-by: Erico Nunes <[email protected]>
Please make sure to send this patch upstream.
Quoted 25 lines
package/efivar/efivar.hash new file +2
-0@@ -0,0 +1,2 @@ +# locally computed hash +sha256 f807f5f0846323bc21b18043542b296f5ad81514f91f13c74a4b8da30c965c94 efivar-0.23.tar.gzpackage/efivar/efivar.mk new file +11
-0@@ -0,0 +1,50 @@ +################################################################################ +# +# efivar +# +################################################################################ + +EFIVAR_VERSION = 0.23 +EFIVAR_SITE = $(call github,rhinstaller,efivar,$(EFIVAR_VERSION)) +EFIVAR_LICENSE = LGPLv2.1 +EFIVAR_LICENSE_FILES = COPYING +EFIVAR_DEPENDENCIES = popt
package/efivar/efivar.mk line 21
Quoted 10 lines
package/efivar/efivar.mk new file +10
-0+EFIVAR_INSTALL_STAGING = YES + +# BINTARGETS is set to skip efivar-static which requires static popt. +# -fPIC is requested at least on MIPS, otherwise fails to build shared library. +# Explicitly linking with shared libgcc is required at least on MicroBlaze, +# otherwise it fails due to FDE encoding in static libgcc. +EFIVAR_MAKE_OPTS = \ + libdir=/usr/lib \ + BINTARGETS=efivar \ + LDFLAGS=-fPIC \
I've changed this to
LDFLAGS="$(TARGET_LDFLAGS) -fPIC"
so that the standard LDFLAGS are also passed.
package/efivar/efivar.mk line 22
Quoted 1 line
package/efivar/efivar.mk new file +1
-0+ SOFLAGS="-shared -shared-libgcc"
I've made this line conditional on Microblaze.
Applied with those changes, thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 efivar: new package
In reply to Erico NunesHello,
Quoted 25 lines · Erico Nunes
efivar contains tools and libraries to manipulate EFI variables.
This package has some restrictions to build. It needs
uchar.hwhich apparently does not come in uClibc, and it also needs __bswap_constant_*() definitions which are only present in glibc. So, this package was limited to build with glibc toolchains.Although it probably makes sense mostly on x86, x86-64 and aarch64 architectures, there are no architecture specific limitations which would prevent it to build for other architectures, so this restriction was not imposed. This package has been build-tested additionaly on many architectures which support glibc, such as mips, MicroBlaze, sparc64, ppc64. There were some build flag issues found when building to some of these some architectures, although the flags can be also added in the general case, so they were added by default.
It has also been found that in some host systems it failed to build due to not generating the .pc files. This has been tracked to the use of make 3.81, so a patch was prepared for it and was submitted upstream. There's also a dependency on the
linux/nvme.hheader, which is somewhat conturbed, as it has appeared in user space linux headers 3.12 and in 4.4 it was renamed. This has been solved by restricting it to build with linux headers >= 3.12 and a patch from upstream was picked which fixes it for linux headers >= 4.4.
Quoted 1 line
Signed-off-by Erico Nunes <[email protected]>
This package breaks the build on hosts where the host gcc is old:
/usr/bin/gcc -O2 -I/home/peko/autobuild/instance-2/output/host/usr/include -std=c99 -I/home/peko/autobuild/instance-2/output/build/efivar-0.23/src/include/efivar/ -specs=/home/peko/autobuild/instance-2/output/build/efivar-0.23/gcc.specs -L. -L/home/peko/autobuild/instance-2/output/host/lib -L/home/peko/autobuild/instance-2/output/host/usr/lib -Wl,-rpath,/home/peko/autobuild/instance-2/output/host/usr/lib -I/home/peko/autobuild/instance-2/output/host/usr/include -DEFIVAR_BUILD_ENVIRONMENT -o makeguids makeguids.c guid.c -ldl
cc1: error: unrecognized command line option "-std=gnu11"
cc1: error: unrecognized command line option "-Wmaybe-uninitialized"
cc1: error: unrecognized command line option "-flto"
cc1: error: unrecognized command line option "-std=gnu11"
cc1: error: unrecognized command line option "-Wmaybe-uninitialized"
cc1: error: unrecognized command line option "-flto"
This happens when you build the makeguids tool for the host: you're passing cflags that are not supported by old versions of gcc.
Could you have a look at fixing this? Most likely, you don't need all those cflags just to build makeguids.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/2 efivar: new package
Hello, Thomas.
Quoted 16 lines · Thomas Petazzoni
Quoted 16 lines
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch new file +10
-0@@ -0,0 +1,45 @@ +From 00376f4dec71d4abb591ba07bc8164ba29e5955e Mon Sep 17 00:00:00 2001 +From: Erico Nunes <[email protected]> +Date: Tue, 22 Mar 2016 21:43:44 -0300 +Subject: [PATCH] Make.rules: fix build with make <= 3.81 + +Building with host make 3.81 resulted in an issue where src/efivar.pc +was never generated. +Even by running 'make efivar.pc' inside the src directory, make always +returned that there was nothing to do. +This was not observed when using make 3.82 or 4.x.
Quoted 8 lines
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch line 16
Quoted 6 lines
package/efivar/0002-Make.rules-fix-build-with-make-3.81.patch new file +6
-0+It is apparently caused by the assignment operators in the multi-line +defines in Make.rules, which do not seem to be supported by make 3.81. +By omitting the assignment operators, the rule works with both versions +of make. + +Signed-off-by: Erico Nunes <[email protected]>Please make sure to send this patch upstream.
The patch had been submitted to efivar upstream since this package was submitted to Buildroot, but had not been applied yet at the time. It has been applied to upstream efivar since then, however we still don't have a 0.24 release which includes it. There's a pending github Issue to tag a 0.24 release and when it happens, we will be able to drop the two patches included here.
Quoted 10 lines
This package breaks the build on hosts where the host gcc is old:
/usr/bin/gcc-O2 -I/home/peko/autobuild/instance-2/output/host/usr/include -std=c99 -I/home/peko/autobuild/instance-2/output/build/efivar-0.23/src/include/efivar/ -specs=/home/peko/autobuild/instance-2/output/build/efivar-0.23/gcc.specs -L. -L/home/peko/autobuild/instance-2/output/host/lib -L/home/peko/autobuild/instance-2/output/host/usr/lib -Wl,-rpath,/home/peko/autobuild/instance-2/output/host/usr/lib -I/home/peko/autobuild/instance-2/output/host/usr/include -DEFIVAR_BUILD_ENVIRONMENT -o makeguidsmakeguids.cguid.c-ldl
cc1: error: unrecognized command line option "-std=gnu11"
cc1: error: unrecognized command line option "-Wmaybe-uninitialized"
cc1: error: unrecognized command line option "-flto"
cc1: error: unrecognized command line option "-std=gnu11"
cc1: error: unrecognized command line option "-Wmaybe-uninitialized"
cc1: error: unrecognized command line option "-flto"
Quoted 5 lines
This happens when you build the makeguids tool for the host: you're passing cflags that are not supported by old versions of gcc.
Could you have a look at fixing this? Most likely, you don't need all those cflags just to build makeguids.
The parameters are added internally by efivar.
I'm not sure there is an easy way to solve this though, at a first look it seems that the listed parameters are used both by host and target builds. So maybe one cleaner way to solve this would be to restrict the host gcc version as is done for some packages (kodi, nodejs).
I'll have a closer look though to confirm whether the arguments are really needed anyway and submit a patch.
Erico