]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
kernel-yocto-rust: Add clang toolchain check for riscv64
authorHarish Sadineni <Harish.Sadineni@windriver.com>
Wed, 5 Aug 2026 17:46:39 +0000 (10:46 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 6 Aug 2026 10:42:22 +0000 (11:42 +0100)
Rust support in the upstream kernel on riscv64 currently requires the
LLVM/Clang toolchain and does not work with gcc [1]. Add a sanity check to skip
the recipe if TOOLCHAIN is not set to "clang" when building a riscv64 kernel with
rust support enabled, point the user to the local.conf change needed to fix it.

[1] https://docs.kernel.org/rust/arch-support.html

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/kernel-yocto-rust.bbclass

index 49f2bfc1ae82f4f2a8f329711bf64dd5c08b433f..c7dc01ba1c77227427a8708e0faa229baf7a8cc0 100644 (file)
@@ -25,3 +25,15 @@ 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 the clang "
+            "toolchain, but TOOLCHAIN is set to '%s'. Set "
+            "KERNEL_TOOLCHAIN = \"clang\" in local.conf to build a "
+            "riscv64 kernel with rust enabled. See "
+            "https://docs.kernel.org/rust/arch-support.html for details."
+            % d.getVar('TOOLCHAIN')
+        )
+}