diff mbox series

[wrynose,06/79] kernel-yocto-rust: Add clang toolchain check for riscv64

Message ID 8256d2c19680fb8111471cdefc99fb89839d23ab.1789681419.git.yoann.congal@smile.fr
State New
Headers show
Series [wrynose,01/79] rootfs.py: fix run-postinsts removal on multilib images | expand

Commit Message

Yoann Congal Sept. 17, 2026, 10:05 p.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

Kernel Rust support on riscv64 requires Clang. Wrynose doesn't
provide a Clang toolchain for kernel builds, but downstream layers
may add this support via a linux-yocto_%.bbappend. Rather than
unconditionally skipping riscv64, check whether a Clang toolchain
is available and only error out with a clear message when it isn't,
so that users with Clang-enabled downstream configurations aren't broken.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
[YC: fixed a typo in message. This matches master commit 2b228490b7ef]
---
 meta/classes-recipe/kernel-yocto-rust.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
index 49f2bfc1ae8..4c0b7231e6a 100644
--- a/meta/classes-recipe/kernel-yocto-rust.bbclass
+++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
@@ -25,3 +25,13 @@  do_kernel_configme:append () {
 # More details in: https://lists.openembedded.org/g/openembedded-core/message/229336
 # Disable ccache for kernel build if kernel rust support is enabled to workaround this.
 CCACHE_DISABLE ?= "1"
+
+python () {
+    if d.getVar('TARGET_ARCH') == 'riscv64' and d.getVar('TOOLCHAIN') != 'clang':
+        raise bb.parse.SkipRecipe(
+            "Rust support in the kernel on riscv64 requires kernel to be build with clang "
+            "toolchain, but the kernel is built with toolchain '%s'. See "
+            "https://docs.kernel.org/rust/arch-support.html for details."
+            % d.getVar('TOOLCHAIN')
+        )
+}