zephyr-kernel: fix cross compilation

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 <chee.yang.lee@intel.com>
This commit is contained in:
Lee Chee Yang
2026-05-07 08:56:45 +08:00
parent 6361f29ecd
commit af5a3a8508

View File

@@ -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 = ""