From: Harish Sadineni <[email protected]>

Add initial support for building the Linux kernel with Rust enabled:

- Introduce `rust.cfg rust-samples.cfg rust-debug.cfg` to set Rust-related 
kernel config options, including:
  - `CONFIG_RUST=y`
  - Rust sample modules and developer checks (overflow/debug assertions)

- Update `linux-yocto_${PV}.bb` to:
  - Append `rust.scc rust-samples.scc` to `SRC_URI` and `KERNEL_FEATURES`

when sending non-RFC version, we will send kernel-config-fragment to the 
yocto-kenrel-cache

Signed-off-by: Harish Sadineni <[email protected]>
---
 meta/recipes-kernel/linux/files/rust-debug.cfg   | 1 +
 meta/recipes-kernel/linux/files/rust-debug.scc   | 3 +++
 meta/recipes-kernel/linux/files/rust-samples.cfg | 4 ++++
 meta/recipes-kernel/linux/files/rust-samples.scc | 3 +++
 meta/recipes-kernel/linux/files/rust.cfg         | 3 +++
 meta/recipes-kernel/linux/files/rust.scc         | 3 +++
 meta/recipes-kernel/linux/linux-yocto_6.16.bb    | 2 ++
 meta/recipes-kernel/linux/linux-yocto_6.17.bb    | 2 ++
 8 files changed, 21 insertions(+)
 create mode 100644 meta/recipes-kernel/linux/files/rust-debug.cfg
 create mode 100644 meta/recipes-kernel/linux/files/rust-debug.scc
 create mode 100644 meta/recipes-kernel/linux/files/rust-samples.cfg
 create mode 100644 meta/recipes-kernel/linux/files/rust-samples.scc
 create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
 create mode 100644 meta/recipes-kernel/linux/files/rust.scc

diff --git a/meta/recipes-kernel/linux/files/rust-debug.cfg 
b/meta/recipes-kernel/linux/files/rust-debug.cfg
new file mode 100644
index 0000000000..d9aeeb4e91
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust-debug.cfg
@@ -0,0 +1 @@
+CONFIG_RUST_DEBUG_ASSERTIONS=y
diff --git a/meta/recipes-kernel/linux/files/rust-debug.scc 
b/meta/recipes-kernel/linux/files/rust-debug.scc
new file mode 100644
index 0000000000..ef0ef3af6e
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust-debug.scc
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: MIT
+
+kconf non-hardware rust-debug.cfg
diff --git a/meta/recipes-kernel/linux/files/rust-samples.cfg 
b/meta/recipes-kernel/linux/files/rust-samples.cfg
new file mode 100644
index 0000000000..c6cc803702
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust-samples.cfg
@@ -0,0 +1,4 @@
+CONFIG_SAMPLES_RUST=y
+CONFIG_SAMPLE_RUST_MINIMAL=m
+CONFIG_SAMPLE_RUST_PRINT=y
+CONFIG_SAMPLE_RUST_HOSTPROGS=y
diff --git a/meta/recipes-kernel/linux/files/rust-samples.scc 
b/meta/recipes-kernel/linux/files/rust-samples.scc
new file mode 100644
index 0000000000..476cc92f93
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust-samples.scc
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: MIT
+
+kconf non-hardware rust-samples.cfg
diff --git a/meta/recipes-kernel/linux/files/rust.cfg 
b/meta/recipes-kernel/linux/files/rust.cfg
new file mode 100644
index 0000000000..105eb0a14d
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust.cfg
@@ -0,0 +1,3 @@
+CONFIG_RUST=y
+CONFIG_RUST_OVERFLOW_CHECKS=y
+CONFIG_RUST_BUILD_ASSERT_ALLOW=y
diff --git a/meta/recipes-kernel/linux/files/rust.scc 
b/meta/recipes-kernel/linux/files/rust.scc
new file mode 100644
index 0000000000..51d9de1673
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust.scc
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: MIT
+
+kconf non-hardware rust.cfg
diff --git a/meta/recipes-kernel/linux/linux-yocto_6.16.bb 
b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
index 2188c7fed2..9d52dc4d9d 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.16.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
@@ -77,3 +77,5 @@ KERNEL_FEATURES:append:powerpc64le = " 
arch/powerpc/powerpc-debug.scc"
 # Check again during next major version upgrade
 KERNEL_FEATURES:remove:riscv32 = "features/debug/debug-kernel.scc"
 INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel"
+SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' 
file://rust.scc file://rust-samples.scc', '', d)}"
+KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 
'rust-kernel', ' rust.scc rust-samples.scc', '', d)}"
diff --git a/meta/recipes-kernel/linux/linux-yocto_6.17.bb 
b/meta/recipes-kernel/linux/linux-yocto_6.17.bb
index 5d10a17e70..d15f7c6e6d 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.17.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.17.bb
@@ -77,3 +77,5 @@ KERNEL_FEATURES:append:powerpc64le = " 
arch/powerpc/powerpc-debug.scc"
 # Check again during next major version upgrade
 KERNEL_FEATURES:remove:riscv32 = "features/debug/debug-kernel.scc"
 INSANE_SKIP:kernel-vmlinux:qemuppc64 = "textrel"
+SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' 
file://rust.scc file://rust-samples.scc', '', d)}"
+KERNEL_FEATURES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 
'rust-kernel', ' rust.scc rust-samples.scc', '', d)}"
-- 
2.49.0

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

Reply via email to