diff mbox series

[v2] grub: Allow build on armv7ve/a with softfp

Message ID 20220915125922.1666515-1-andrei@gherzan.com
State Accepted, archived
Commit 75dbdea94057b6977a20fb738c00c226ca694243
Headers show
Series [v2] grub: Allow build on armv7ve/a with softfp | expand

Commit Message

Andrei Gherzan Sept. 15, 2022, 12:59 p.m. UTC
From: Andrei Gherzan <andrei.gherzan@huawei.com>

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.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 meta/recipes-bsp/grub/grub2.inc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Yu, Mingli Oct. 17, 2022, 7:47 a.m. UTC | #1
It fails on qemuarm during do_configure.

| checking for compile options to get strict alignment... 
-mno-unaligned-access
| checking if compiler generates unaligned accesses... no
| checking if C symbols get an underscore after compilation... no
| checking whether target compiler is working... no
| configure: error: cannot compile for the target

Thanks,

On 9/15/22 20:59, Andrei Gherzan wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> From: Andrei Gherzan <andrei.gherzan@huawei.com>
> 
> 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.
> 
> Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
> ---
>   meta/recipes-bsp/grub/grub2.inc | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
> index 47ea561002..e257c31235 100644
> --- a/meta/recipes-bsp/grub/grub2.inc
> +++ b/meta/recipes-bsp/grub/grub2.inc
> @@ -43,9 +43,13 @@ 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')}"
> 
>   # 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.
> --
> 2.25.1
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#170695): https://lists.openembedded.org/g/openembedded-core/message/170695
> Mute This Topic: https://lists.openembedded.org/mt/93699232/3618448
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mingli.yu@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index 47ea561002..e257c31235 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -43,9 +43,13 @@  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')}"
 
 # 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.