[PATCH][meta-zephyr 2/4] zephyr-kernel: fix cross compilation

[email protected]
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
From: Lee Chee Yang <[email protected]>

set CONFIG_STATIC_INIT_GNU=y when cross-compile toochain selected.

Fix:
| /data/wrynose/bitbake-builds/zephyr-master/build/tmp/work/i586-yocto-elf/zephyr-helloworld/4.3.0+git/recipe-sysroot-native/usr/bin/i586-yocto-elf/i586-yocto-elf-ld.bfd: GNU-style constructors required but STATIC_INIT_GNU not enabled
| /data/wrynose/bitbake-builds/zephyr-master/build/tmp/work/i586-yocto-elf/zephyr-helloworld/4.3.0+git/recipe-sysroot-native/usr/bin/i586-yocto-elf/i586-yocto-elf-ld.bfd: warning: zephyr/zephyr_pre0.elf has a LOAD segment with RWX permissions
| collect2: error: ld returned 1 exit status
| ninja: build stopped: subcommand failed.

Signed-off-by: Lee Chee Yang <[email protected]>
---
 .../recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc        | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
index 3a8a4da..eb8f224 100644
--- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
+++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc
@@ -26,6 +26,7 @@ EXTRA_OECMAKE = "\
     -DSOC_ROOT=${SOC_ROOT} \
     -DZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT} \
     -DZEPHYR_MODULES=${ZEPHYR_MODULES} \
+    ${@bb.utils.contains('ZEPHYR_TOOLCHAIN_VARIANT', 'cross-compile', '-DCONFIG_STATIC_INIT_GNU=y', '', d)} \
     "
 
 ZEPHYR_EXTRA_MODULES = ""
-- 
2.37.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.