Skip to contentSkip to conversation

efivar: fix comment after uClibc compatibility patch

PATCH New Erico Nunes 3 participants 7 messages Dec 5, 2016 – Dec 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 efivar: fix comment after uClibc compatibility patch

uClibc support was recently added to efivar through a small compatibility patch.
This commit updates a comment in the efivar recipe to reflect this, as we no longer have glibc as the only supported C library.

Cc Thomas Petazzoni <[email protected]>
---
 package/efivar/efivar.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/efivar/efivar.mk +2 -2
index 913322e..84735b8 100644
@@ -12,8 +12,8 @@ EFIVAR_DEPENDENCIES = popt
 EFIVAR_INSTALL_STAGING = YES
 
 # BINTARGETS is set to skip efivar-static which requires static popt,
-# and since we depend on glibc, we will never be built in a
-# static-only environment.
+# and since we depend on dynamic libraries, efivar will never be built
+# in a static-only environment.
 # -fPIC is needed at least on MIPS, otherwise fails to build shared
 # -library.
 EFIVAR_MAKE_OPTS = \
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 gcc: fix powerpc64le arch config name

Buildroot references powerpc64 little endian as BR2_powerpc64le and not BR2_powerpc64el.

---
 package/gcc/Config.in.host | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/gcc/Config.in.host +3 -3
index 0fc1ec4..582f115 100644
@@ -25,7 +25,7 @@ choice
 		# Unsupported for MIPS R6
 		depends on !BR2_MIPS_CPU_MIPS32R6 && !BR2_MIPS_CPU_MIPS64R6
 		# musl ppc64 unsupported
-		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64el))
+		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64le))
 		# musl mips64 unsupported
 		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_mips64 || BR2_mips64el))
 		select BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
@@ -51,7 +51,7 @@ choice
 		# musl microblaze unsupported
 		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_microblazeel || BR2_microblazebe))
 		# musl ppc64 unsupported
-		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64el))
+		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64le))
 		# musl mips64 unsupported
 		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_mips64 || BR2_mips64el))
 		# PR60102 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60102
@@ -62,7 +62,7 @@ choice
 		# Broken or unsupported architectures
 		depends on !BR2_arc && !BR2_bfin
 		# musl ppc64 unsupported
-		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64el))
+		depends on !(BR2_TOOLCHAIN_USES_MUSL && (BR2_powerpc64 || BR2_powerpc64le))
 		# Unsupported MIPS cores
 		depends on !BR2_mips_interaptiv && !BR2_mips_m5150 && \
 			!BR2_mips_m6250 && !BR2_mips_i6400 && !BR2_mips_p6600
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/1 gcc: fix powerpc64le arch config name

Quoted 4 lines · Erico Nunes

Buildroot references powerpc64 little endian as BR2_powerpc64le and not BR2_powerpc64el.

Committed, thanks.

--
Bye, Peter Korsgaard

#3 lore raw

PATCH 2/3 efivar: introduce BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS

In reply to Erico Nunes

efivar only makes sense on platforms that support UEFI.
UEFI is only supported by some architectures at the moment, being mostly employed on platforms such as x86, x86_64 and aarch64. Some other platforms such as MIPS and PowerPC may have some unofficial UEFI support. UEFI is also limited to little endian architectures.

efivar was being supported in Buildroot without architecture restrictions so far, however this has led to the creation of a number of hacks in the recipes, mostly for architectures that are not supported by UEFI.
In order to avoid spending more time to debug these failures and maintaining more hacks for unsupported architectures, efivar can be restricted to that platforms where it makes sense and where it is more likely to receive some testing and actual usage.

The existing hacks for the now unsupported architectures are removed, and the dependency is propagated to efibootmgr as it depends on efivar.

Cc Thomas Petazzoni <[email protected]>
---
 package/efibootmgr/Config.in |  8 ++++----
 package/efivar/Config.in     | 14 ++++++++++----
 package/efivar/efivar.mk     |  6 ------
 3 files changed, 14 insertions(+), 14 deletions(-)
package/efibootmgr/Config.in +4 -4
index cd4bda1..a4011d6 100644
@@ -1,11 +1,11 @@
 config BR2_PACKAGE_EFIBOOTMGR
 	bool "efibootmgr"
+	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS # efivar
 	depends on !BR2_STATIC_LIBS # efivar
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 # efivar
 	depends on !BR2_TOOLCHAIN_USES_MUSL # efivar
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # efivar
-	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS && \
-		!BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII # efivar
+	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
 	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT
 	select BR2_PACKAGE_EFIVAR
 	help
@@ -17,9 +17,9 @@ config BR2_PACKAGE_EFIBOOTMGR
 	  https://github.com/rhinstaller/efibootmgr
 
 comment "efibootmgr needs a glibc or uClibc toolchain w/ dynamic library, headers >= 3.12, gcc >= 4.9"
+	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \
 		BR2_TOOLCHAIN_USES_MUSL || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
-	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS && \
-		!BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
+	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
package/efivar/Config.in +10 -4
index a97c766..0ec8360 100644
@@ -1,5 +1,12 @@
+config BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
+	bool
+	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64 \
+		|| BR2_powerpc64le || BR2_mipsel || BR2_mips64el
+	default y
+
 config BR2_PACKAGE_EFIVAR
 	bool "efivar"
+	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
 	depends on !BR2_STATIC_LIBS # dlfcn.h
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 # linux/nvme.h
 	# linux/nvme.h has been renamed to linux/nvme_ioctl.h since 4.4,
@@ -8,8 +15,7 @@ config BR2_PACKAGE_EFIVAR
 	# don't have that header file renamed, and that is causing build
 	# failures. So, prevent this package to be built using those
 	# toolchains.
-	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS && \
-		!BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
+	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
 	# doesn't build with musl due to lack of __bswap_constant_16
 	depends on !BR2_TOOLCHAIN_USES_MUSL
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
@@ -20,9 +26,9 @@ config BR2_PACKAGE_EFIVAR
 	  https://github.com/rhinstaller/efivar
 
 comment "efivar needs a glibc or uClibc toolchain w/ dynamic library, headers >= 3.12, gcc >= 4.9"
+	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \
 		BR2_TOOLCHAIN_USES_MUSL || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
-	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS && \
-		!BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
+	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
package/efivar/efivar.mk +0 -6
index 84735b8..c31d87b 100644
@@ -21,12 +21,6 @@ EFIVAR_MAKE_OPTS = \
 	BINTARGETS=efivar \
 	LDFLAGS="$(TARGET_LDFLAGS) -fPIC"
 
-# Explicitly linking with shared libgcc is required on MicroBlaze and
-# Nios II, otherwise it fails due to FDE encoding in static libgcc.
-ifeq ($(BR2_microblaze)$(BR2_nios2),y)
-EFIVAR_MAKE_OPTS += SOFLAGS="-shared -shared-libgcc"
-endif
-
 define EFIVAR_BUILD_CMDS
 	# makeguids is an internal host tool and must be built separately with
 	# $(HOST_CC), otherwise it gets cross-built.
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/3 efibootmgr: depends on wchar

In reply to Erico Nunes

After commit 3ae07b4746 recently, efibootmgr now selects BR2_PACKAGE_GETTEXT if the toolchain requires it.
gettext depends on wchar, so this dependency should be propagated as well.
menuconfig currently complains loudly if you select efibootmgr, with an error such as:

warning: (... && BR2_PACKAGE_EFIBOOTMGR ... && ) selects BR2_PACKAGE_GETTEXT which has unmet direct dependencies (BR2_USE_WCHAR)

---
This "select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT" is slightly complicated to handle for the propagated wchar dependency, if the unavailability Kconfig "comment" is added.
Looks like we don't need to always have the wchar dependency as the dependency on gettext is optional, however this complicates the mention to 'needs wchar' in the Kconfig comment.
Some packages seem to try to handle this in some smarter way (BR2_PACKAGE_LINUX_TOOLS_CPUPOWER) but then the comment is not always accurate.
Please let me know if there is a better way to do this, right now it seems to be simpler to just require wchar always.

---
 package/efibootmgr/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/efibootmgr/Config.in +4 -2
index a4011d6..57874fc 100644
@@ -6,6 +6,7 @@ config BR2_PACKAGE_EFIBOOTMGR
 	depends on !BR2_TOOLCHAIN_USES_MUSL # efivar
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # efivar
 	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
+	depends on BR2_USE_WCHAR # gettext
 	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT
 	select BR2_PACKAGE_EFIVAR
 	help
@@ -16,10 +17,11 @@ config BR2_PACKAGE_EFIBOOTMGR
 
 	  https://github.com/rhinstaller/efibootmgr
 
-comment "efibootmgr needs a glibc or uClibc toolchain w/ dynamic library, headers >= 3.12, gcc >= 4.9"
+comment "efibootmgr needs a glibc or uClibc toolchain w/ wchar, dynamic library, headers >= 3.12, gcc >= 4.9"
 	depends on BR2_PACKAGE_EFIVAR_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \
 		BR2_TOOLCHAIN_USES_MUSL || \
-		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \
+		!BR2_USE_WCHAR
 	depends on !BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/3 efibootmgr: depends on wchar

Hello,

Quoted 11 lines · Erico Nunes

This "select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT" is slightly complicated to handle for the propagated wchar dependency, if the unavailability Kconfig "comment" is added.
Looks like we don't need to always have the wchar dependency as the dependency on gettext is optional, however this complicates the mention to 'needs wchar' in the Kconfig comment.
Some packages seem to try to handle this in some smarter way (BR2_PACKAGE_LINUX_TOOLS_CPUPOWER) but then the comment is not always accurate.
Please let me know if there is a better way to do this, right now it seems to be simpler to just require wchar always.

If you really want to be pedantic, you could write:

	depends on !BR2_NEEDS_GETTEXT || BR2_USE_WCHAR

but it anyway makes the Config.in comment handling a bit annoying. And it's in fact a bit useless:

- On glibc, BR2_USE_WCHAR is always 'y', and BR2_NEEDS_GETTEXT is false

- On musl, BR2_USE_WCHAR is always 'y', and BR2_NEEDS_GETTEXT is false

- On uClibc, BR2_NEEDS_GETTEXT is 'y', and indeed BR2_USE_WCHAR needs to be set.

So in fact, a "depends on BR2_USE_WCHAR" is good enough.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/3 efivar: fix comment after uClibc compatibility patch

In reply to Erico Nunes

Hello,

Quoted 10 lines · Erico Nunes

uClibc support was recently added to efivar through a small compatibility patch.
This commit updates a comment in the efivar recipe to reflect this, as we no longer have glibc as the only supported C library.

Cc Thomas Petazzoni <[email protected]>
---
 package/efivar/efivar.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

All three patches applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com