Skip to contentSkip to conversation

arm-toolchain: grub: fix do_configure() breakage with external-arm toolchain

PATCH Superseded Denys Dmytriyenko 2 participants 2 messages Aug 12, 2021 – Aug 13, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm-toolchain: grub: fix do_configure() breakage with external-arm toolchain

From: Denys Dmytriyenko <[email protected]>

grub and grub-efi break in do_configure() when using external-arm toolchain:

| checking for aarch64-poky-linux-objcopy... no
| checking for objcopy... objcopy
| checking for aarch64-poky-linux-strip... no
| checking for strip... strip
| checking for aarch64-poky-linux-nm... no
| checking for nm... nm
| checking for aarch64-poky-linux-ranlib... no
| checking for ranlib... ranlib

...
| checking whether objcopy works for absolute addresses... configure: error: objcopy cannot create binary files

That is due to external-arm toolchain's target triplet aarch64-none-linux-gnu being different from OE triplet like aarch64-poky-linux and configure script trying to use it to find binutils binaries like objcopy, falling back to host ones.

Help configure script to find correct objcopy and other binaries by passing the correct target triplet with --target parameter set to EAT_TARGET_SYS, overriding the default OE one.

---
 meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend
meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend new file +9 -0
new file mode 100644
index 0000000..3bdfe3d
@@ -0,0 +1,9 @@
+# When external-arm toolchain is not in use, EAT_TARGET_SYS is undefined,
+# causing below :append expansion to break - just weakly set it to empty
+EAT_TARGET_SYS ?= ""
+
+# grub uses --target triplet to find binutils binaries such as objcopy
+# Since external-arm toolchain uses aarch64-none-linux-gnu triplet,
+# OE-defined TARGET_SYS differs from EAT_TARGET_SYS used by external-arm
+# toolchain, grub needs passing the correct --target to configure script
+CONFIGUREOPTS:append:class-target = "${@['',' --target=${EAT_TARGET_SYS}'][d.getVar('TCMODE') == 'external-arm']}"
Signature · 1 line
2.7.4
#1 lore raw
Quoted 21 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

grub and grub-efi break in do_configure() when using external-arm toolchain:

| checking for aarch64-poky-linux-objcopy... no
| checking for objcopy... objcopy
| checking for aarch64-poky-linux-strip... no
| checking for strip... strip
| checking for aarch64-poky-linux-nm... no
| checking for nm... nm
| checking for aarch64-poky-linux-ranlib... no
| checking for ranlib... ranlib

...
| checking whether objcopy works for absolute addresses... configure: error: objcopy cannot create binary files

That is due to external-arm toolchain's target triplet aarch64-none-linux-gnu being different from OE triplet like aarch64-poky-linux and configure script trying to use it to find binutils binaries like objcopy, falling back to host ones.

Quoted 6 lines

Help configure script to find correct objcopy and other binaries by passing the correct target triplet with --target parameter set to EAT_TARGET_SYS, overriding the default OE one.

With this change, CI no longer passes check-layers. See
https://gitlab.com/jonmason00/meta-arm/-/jobs/1500144360

Quoted 26 lines
---
 meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100644 meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend
meta-arm-toolchain/recipes-bsp/grub/grub%.bbappend new file +9 -1
new file mode 100644
index 0000000..3bdfe3d
@@ -0,0 +1,9 @@
+# When external-arm toolchain is not in use, EAT_TARGET_SYS is undefined,
+# causing below :append expansion to break - just weakly set it to empty
+EAT_TARGET_SYS ?= ""
+
+# grub uses --target triplet to find binutils binaries such as objcopy
+# Since external-arm toolchain uses aarch64-none-linux-gnu triplet,
+# OE-defined TARGET_SYS differs from EAT_TARGET_SYS used by external-arm
+# toolchain, grub needs passing the correct --target to configure script
+CONFIGUREOPTS:append:class-target = "${@['',' --target=${EAT_TARGET_SYS}'][d.getVar('TCMODE') == 'external-arm']}"
--

2.7.4