kernel-arch: limit KERNEL_TOOLCHAIN to the kbuild recipes
PATCH v2 1/1 kernel-arch: limit KERNEL_TOOLCHAIN to the kbuild recipes
From: "mark.yang" <[email protected]>
u-boot and barebox inherit kernel-arch for the ARCH mapping, so since 0e3756efe0 ("kernel-arch: add KERNEL_TOOLCHAIN to switch the whole kernel toolchain") KERNEL_TOOLCHAIN = "clang" switches them too. That swaps u-boot's gcc-cross dependency for clang-cross, but its kbuild hardcodes ${CROSS_COMPILE}gcc:
/bin/sh: 1: x86_64-oe-linux-gcc: not found
Full log: https://errors.yoctoproject.org/Errors/Build/242654/
Pin TOOLCHAIN back to gcc in kernel-arch and set it from KERNEL_TOOLCHAIN in kernel.bbclass, module-base and make-mod-scripts.
---
v2: add a comment explaining why kernel-arch keeps TOOLCHAIN pinned
to gcc
The v2 series was merged, so this carries the remaining v3 3/3 delta (<[email protected]>) as a follow-up fix.
meta/classes-recipe/kernel-arch.bbclass | 5 ++++- meta/classes-recipe/kernel.bbclass | 1 + meta/classes-recipe/module-base.bbclass | 1 + meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb | 1 + 4 files changed, 7 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-arch.bbclass +4 -1
@@ -92,5 +92,8 @@ KERNEL_LD:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld' KERNEL_AR:toolchain-clang = "llvm-ar ${HOST_AR_KERNEL_ARCH}" KERNEL_OBJCOPY:toolchain-clang = "llvm-objcopy ${HOST_OBJCOPY_KERNEL_ARCH}" KERNEL_STRIP:toolchain-clang = "llvm-strip" +# The kbuild recipes (kernel, modules, make-mod-scripts) set TOOLCHAIN +# from KERNEL_TOOLCHAIN; other inheritors like u-boot and barebox only +# use kernel-arch for the ARCH mapping and must stay on gcc. KERNEL_TOOLCHAIN ?= "gcc" -TOOLCHAIN = "${KERNEL_TOOLCHAIN}" +TOOLCHAIN = "gcc"
meta/classes-recipe/kernel.bbclass +1 -0
@@ -214,6 +214,7 @@ python do_symlink_kernsrc () { addtask symlink_kernsrc before do_patch do_configure after do_unpack inherit kernel-arch deploy +TOOLCHAIN = "${KERNEL_TOOLCHAIN}" PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-module-.*" PACKAGES_DYNAMIC += "^${KERNEL_PACKAGE_NAME}-image-.*"
meta/classes-recipe/module-base.bbclass +1 -0
@@ -5,6 +5,7 @@ # inherit kernel-arch +TOOLCHAIN = "${KERNEL_TOOLCHAIN}" # We do the dependency this way because the output is not preserved # in sstate, so we must force do_compile to run (once).
meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb +1 -0
@@ -4,6 +4,7 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" inherit kernel-arch linux-kernel-base +TOOLCHAIN = "${KERNEL_TOOLCHAIN}" inherit pkgconfig PACKAGE_ARCH = "${MACHINE_ARCH}"
Quoted 20 lines · mark.yang via lists.openembedded.org
From: "mark.yang" <[email protected]>
u-boot and barebox inherit kernel-arch for the ARCH mapping, so since
0e3756efe0("kernel-arch: addKERNEL_TOOLCHAINto switch the whole kernel toolchain")KERNEL_TOOLCHAIN= "clang" switches them too. That swaps u-boot's gcc-cross dependency for clang-cross, but its kbuild hardcodes ${CROSS_COMPILE}gcc:
/bin/sh: 1: x86_64-oe-linux-gcc: not foundFull log: https://errors.yoctoproject.org/Errors/Build/242654/
Pin TOOLCHAIN back to gcc in kernel-arch and set it from
KERNEL_TOOLCHAINin kernel.bbclass, module-base and make-mod-scripts.Signed-off-by mark.yang <[email protected]>---
v2: add a comment explaining why kernel-arch keeps TOOLCHAIN pinned to gcc
Quoted 8 lines
The v2 series was merged, so this carries the remaining v3 3/3 delta (<[email protected]>) as a follow-up fix.
meta/classes-recipe/kernel-arch.bbclass | 5 ++++- meta/classes-recipe/kernel.bbclass | 1 + meta/classes-recipe/module-base.bbclass | 1 + meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb | 1 +
4 files changed, 7 insertions(+), 1 deletion(-)
I really don't like having to set the same thing in multiple places, it will cause a maintenance nightmare in the future. The kernel classes are getting too convoluted and too much of a twisted maze already.
There is very little u-boot and barebox actually need from the class anyway. Instead, I suggest we move the arch function to the python library and then have u-boot and barebox call what they need from there.
I've some patches on master-next which start to do this.
Cheers
Richard