@@ -18,5 +18,18 @@ EXTRA_OECMAKE:append = " -DUSER_CACHE_DIR=${ZEPHYR_USER_CACHE_DIR}"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
+# INHIBIT_DEFAULT_DEPS means no Yocto cross toolchain is built for this recipe,
+# so the exported CC/LD/AR/... point at binaries which do not exist. Zephyr
+# itself ignores them and uses the SDK, but external module build systems
+# invoked by Zephyr (for example Trusted Firmware-A, which is built with its own
+# Makefile) honour them and fail instead of using the SDK passed through
+# CROSS_COMPILE. Keep them out of the task environment.
+ZEPHYR_UNEXPORT_TOOLS = "AR AS CC CPP CXX LD NM OBJCOPY OBJDUMP RANLIB STRIP"
+
+python () {
+ for tool in d.getVar("ZEPHYR_UNEXPORT_TOOLS").split():
+ d.setVarFlag(tool, "unexport", "1")
+}
+
# Set Zephyr work directory to describe toolchain accurately
MULTIMACH_TARGET_SYS = "${ZEPHYR_BOARD}-zephyr"
When ZEPHYR_TOOLCHAIN_VARIANT is "zephyr", INHIBIT_DEFAULT_DEPS is set and no Yocto cross toolchain is built for the recipe. BitBake still exports CC, LD, AR and friends into the task environment, where they reference aarch64-yocto-elf-* binaries that do not exist. Zephyr ignores these and uses the SDK, but external module build systems invoked from the Zephyr build do not. Trusted Firmware-A is built by its own Makefile, which prefers CC/LD/AR from the environment over the CROSS_COMPILE value pointing at the Zephyr SDK. Its tool detection then fails and expands a multi-line warning macro into the tool identifier variable, leaving embedded newlines that break a later conditional: lib/libfdt/libfdt.mk:16: *** invalid syntax in conditional. Stop. Set the unexport flag on the toolchain variables so they are unset in the task environment and TF-A falls back to CROSS_COMPILE. AI-Generated: GitHub Copilot (Claude Opus 5) Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> --- .../zephyr-kernel/zephyr-toolchain-zephyr.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+)