Skip to content

Commit

Permalink
zephyr-core/zephyr-kernel: Use the upstream "cross-compile" toolchain
Browse files Browse the repository at this point in the history
Zephyr upstream contains CMake configuration for a "cross-compile"
toolchain for "other cross compilers" which works with the Yocto-built
toolchain out-of-the-box, so use this instead of the "yocto" toolchain,
which requires a downstream patch to be carried.

The Yocto-built toolchain does not support --print-sysroot so that
toolchains can be shared between multiple builds with different
sysroots, so manually set SYSROOT_DIR to the staging directory.

Use the "cross-compile" toolchain by default.

Signed-off-by: Peter Hoyes <[email protected]>
Signed-off-by: Naveen Saini <[email protected]>
  • Loading branch information
hoyes authored and saininav committed Feb 24, 2023
1 parent c2d10c6 commit 155bf06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inherit ${ZEPHYR_INHERIT_CLASSES}
# filesystem.
IMAGE_NO_MANIFEST = "1"

ZEPHYR_TOOLCHAIN_VARIANT ?= "yocto"
ZEPHYR_TOOLCHAIN_VARIANT ?= "cross-compile"
require zephyr-toolchain-${ZEPHYR_TOOLCHAIN_VARIANT}.inc

ZEPHYR_MAKE_OUTPUT = "zephyr.elf"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Additional definitions to use the cross-compile toolchain

CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}"
SYSROOT_DIR="${STAGING_DIR_TARGET}"

EXTRA_OECMAKE:append = " \
-DCROSS_COMPILE=${CROSS_COMPILE} \
-DSYSROOT_DIR=${SYSROOT_DIR} \
"

OE_TERMINAL_EXPORTS += "CROSS_COMPILE"
OE_TERMINAL_EXPORTS += "SYSROOT_DIR"

0 comments on commit 155bf06

Please sign in to comment.