Skip to contentSkip to conversation

grub: Allow build on armv7ve/a with softfp

PATCH Superseded Andrei Gherzan 1 participant 2 messages Sep 15, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grub: Allow build on armv7ve/a with softfp

From: Andrei Gherzan <[email protected]>

Grub tries to force the compilation in softfp mode for some known target CPU. That is because it doesn't use floats or doubles and there are known limitations of using a configuration with hardfp. There are though target CPUs that grub won't know how to configure failing with something similar to:

| checking for options to get soft-float... no
| configure: error: could not force soft-float

This change relaxes a bit the COMPATIBLE_HOST restriction to only apply for hardfp configuration even for arm7ve/a.

---
 meta/recipes-bsp/grub/grub2.inc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta/recipes-bsp/grub/grub2.inc +12 -3
index 47ea561002..6c9952d2d7 100644
@@ -43,9 +43,18 @@ CVE_CHECK_IGNORE += "CVE-2021-46705"
 
 DEPENDS = "flex-native bison-native gettext-native"
 
-COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
-COMPATIBLE_HOST:armv7a = 'null'
-COMPATIBLE_HOST:armv7ve = 'null'
+GRUB_COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'
+COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}"
+# Grub doesn't support hard float toolchain and won't be able to forcefully
+# disable it on some of the target CPUs. See 'configure.ac' for
+# supported/unsupported CPUs in hardfp.
+COMPATIBLE_HOST:armv7a = "${@'null' if d.getVar('TUNE_CCARGS_MFLOAT') == 'hardfp' else d.getVar('GRUB_COMPATIBLE_HOST')}"
+COMPATIBLE_HOST:armv7ve = "${@'null' if d.getVar('TUNE_CCARGS_MFLOAT') == 'hardfp' else d.getVar('GRUB_COMPATIBLE_HOST')}"
+
+# Grub doesn't use float or doubles and tries to disable forcefully floating
+# point at configure time. That dynamic flags configuration doesn't always work
+# (for example on arm 32bit) so force the compilation in softfp.
+TUNE_CCARGS_MFLOAT:class-target = "softfp"
 
 # configure.ac has code to set this automagically from the target tuple
 # but the OE freeform one (core2-foo-bar-linux) don't work with that.
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 47 lines · Andrei Gherzan

From: Andrei Gherzan <[email protected]>

Grub tries to force the compilation in softfp mode for some known target CPU. That is because it doesn't use floats or doubles and there are known limitations of using a configuration with hardfp. There are though target CPUs that grub won't know how to configure failing with something similar to:

| checking for options to get soft-float... no
| configure: error: could not force soft-float

This change relaxes a bit the COMPATIBLE_HOST restriction to only apply for hardfp configuration even for arm7ve/a.

---
 meta/recipes-bsp/grub/grub2.inc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
meta/recipes-bsp/grub/grub2.inc +0 -1
index 47ea561002..6c9952d2d7 100644
@@ -43,9 +43,18 @@ CVE_CHECK_IGNORE += "CVE-2021-46705"
 
 DEPENDS = "flex-native bison-native gettext-native"
 
-COMPATIBLE_HOST = 

'(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'

meta/recipes-bsp/grub/grub2.inc +1 -2
-COMPATIBLE_HOST:armv7a = 'null'
-COMPATIBLE_HOST:armv7ve = 'null'
+GRUB_COMPATIBLE_HOST = 

'(x86_64.*|i.86.*|arm.*|aarch64.*|riscv.*)-(linux.*|freebsd.*)'

meta/recipes-bsp/grub/grub2.inc +2 -0
+COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}"
+# Grub doesn't support hard float toolchain and won't be able to 

forcefully

meta/recipes-bsp/grub/grub2.inc +3 -0
+# disable it on some of the target CPUs. See 'configure.ac' for
+# supported/unsupported CPUs in hardfp.
+COMPATIBLE_HOST:armv7a = "${@'null' if d.getVar('TUNE_CCARGS_MFLOAT') 

== 'hardfp' else d.getVar('GRUB_COMPATIBLE_HOST')}" +COMPATIBLE_HOST:armv7ve = "${@'null' if d.getVar('TUNE_CCARGS_MFLOAT') == 'hardfp' else d.getVar('GRUB_COMPATIBLE_HOST')}"

meta/recipes-bsp/grub/grub2.inc +2 -0
+
+# Grub doesn't use float or doubles and tries to disable forcefully 

floating
+# point at configure time. That dynamic flags configuration doesn't always work

meta/recipes-bsp/grub/grub2.inc CVE_CHECK_IGNORE += "CVE-2021-46705" · line 57

Quoted 2 lines
meta/recipes-bsp/grub/grub2.inc +2 -0
+# (for example on arm 32bit) so force the compilation in softfp.
+TUNE_CCARGS_MFLOAT:class-target = "softfp"

Please ignore this v1 patch as the above was not supposed to be part of the patch. I've sent a cleaned up v2: https://lists.openembedded.org/g/openembedded-core/message/170695

Thanks,
Andrei