On 2026-07-08 14:57, Sadineni, Harish via lists.openembedded.org wrote:
From: Harish Sadineni<[email protected]>

Enable LLVM/Clang toolchain for riscv64 kernel builds when Rust support
is enabled, as Rust is only supported with LLVM toolchains for this
architecture.

This aligns with upstream kernel Rust architecture requirements as
documented in:
https://docs.kernel.org/rust/arch-support.html

Acked-by: Bruce Ashfield<[email protected]>
Signed-off-by: Harish Sadineni<[email protected]>
---
  meta/recipes-kernel/linux/linux-yocto.inc | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc 
b/meta/recipes-kernel/linux/linux-yocto.inc
index 4e230d405a..5d047b5f01 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -91,3 +91,7 @@ do_devshell:prepend() {
      d.setVar("HOSTPKG_CONFIG", "pkg-config-native")
      d.appendVar("OE_TERMINAL_EXPORTS", " HOSTPKG_CONFIG")
  }
+
+# For riscv64, Rust support in kernel only works with LLVM/Clang only.
+#https://docs.kernel.org/rust/arch-support.html
+TOOLCHAIN:riscv64 ="${@bb.utils.contains('KERNEL_FEATURES', 'rust', 'clang', 'gcc', 
d)}"

Rather than silently switching the kernel toolchain,
check for this situation and exit with an error to force the user to specify the toolchain if they have enable the rust KERNEL_FEATURE .

The user should be responsible for and informed about the requirement rather than having them finding out some time later that
they have been silently switched from gcc to rust.

Also, if the user has already switched to using clang for the kernel for risvc, the no action is required.


This patch series was review in today's YP patch review meeting.
The first and last patch will be merged.

For the middle 2 commits, in addition to the change above, merge them together. This ensures that the shortlog for the lld-native change also specifies that it's rust specific.
and it enabled the build in one commit.


../Randy






--
# Randy MacLeod
# Wind River Linux
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#240848): 
https://lists.openembedded.org/g/openembedded-core/message/240848
Mute This Topic: https://lists.openembedded.org/mt/120178683/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to