diff mbox series

[wrynose] kernel-yocto-rust: Add clang toolchain check for riscv64

Message ID 20260911090739.914789-1-Harish.Sadineni@windriver.com
State New
Headers show
Series [wrynose] kernel-yocto-rust: Add clang toolchain check for riscv64 | expand

Commit Message

Harish Sadineni Sept. 11, 2026, 9:07 a.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>
---
 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 49f2bfc1ae..be85002903 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 toolchian '%s'. See "
+            "https://docs.kernel.org/rust/arch-support.html for details."
+            % d.getVar('TOOLCHAIN')
+        )
+}