public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v7 00/14] Enable rust support for linux kernel
@ 2026-03-04 17:43 Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
                   ` (13 more replies)
  0 siblings, 14 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

v7:
- The rust support in kernel runtime selftest intermittently fails on autobuilder armhost/qemuarm64 
  because qemu.run_serial(modprobe <module_name>) occasionally returns incorrect status even when the 
  module loads successfully. Since the test already validates module loading via dmesg, Disabled
  status assertion check to avoid flakiness.
  Bug Report: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16189

v6:
- rust-kernel support is now can be managed with a dedicated KERNEL_RUST_SUPPORT variable instead
  of DISTRO_FEATURES. Kernel rust support changes are now moved to new classes kernel-yocto-rust.bbclass
  & module-rust.bbclass for ease of maintenance.
- Dropped patch "kernel.bbclass: Export artifacts needed for out-of-tree Rust compilation"
- Extended disabling of cache to make-mod-scripts as well.

v5:
- Regression in autobuilder with v4 series is due to applying v4 series together with following patch
  "llvm: enable LLVMgold.so build by adding binutils dependency"(https://lists.openembedded.org/g/openembedded-core/message/229387)
  is fixed by droping Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091).
- Updated patch "rust: install Rust library sources for 'make rustavailable' support" to install
  rust standard library sources for rust-native.

v4:
- Resolved patchtest failures.

v3:
- Removed the DISTRO_FEATURES dependency for installing Rust library sources in the Rust recipe,
- Extended support for on target rust kernel module developmet by installing Rust library sources and
  introduced packaging of the Rust standard library sources in a dedicated ${PN}-src-lib package.
- Integrated Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091)
  that uses the Rust bootstrap tool to install Rust library sources for rust-native.
- Dropped the patch that added rust-kernel to native/nativesdk feature filters in bitbake.conf.
- Updated flags in the make-mod-scripts recipe to fix build failures when building Rust out-of-tree
  module recipes.
- Dropped the bindgen-cli patch extending BBCLASSEXTEND to include
  nativesdk, as it has been merged into oe-core.

v2:
- Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1.
- Updated commit message and added in code comments for patch "[PATCH 09/15] kernel-devsrc: copying
  rust-kernel source to $kerneldir/build"

[0] https://lists.openembedded.org/g/openembedded-core/message/228559
[1] https://lists.openembedded.org/g/openembedded-core/message/228560

v1:
The previous series was RFC v4, "Enable Rust support for Linux kernel"
(https://lists.openembedded.org/g/openembedded-core/message/226623).

In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module support"
(https://lists.openembedded.org/g/openembedded-core/message/227281), which builds on top of RFC v4.

The current patch series is a unified version that combines both efforts.
Compared to the earlier series, the main changes are:

-Kernel configuration fragments have been moved to yocto-kernel-cache.
-The kernel fragments have been removed from SRC_URI and from the files
 directory previously stored underrecipes-kernel/linux/files.
-Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for Linux Rust sample"
 by appending KERNEL_EXTRA_FEATURES:append = 'features/kernel-sample/kernel-rust-sample.scc'
 instead of adding this directly in the linux-yocto recipe.


This patch series introduces Rust support into the linux-yocto kernel recipe and
related build infrastructure in the Yocto Project. The goal is to enable building
the Linux kernel with Rust components and provide support for building kernel module
which is written in rust and also provide support to build rust kernel modules in sdk.

And this series adds test for Linux Rust sample and also added support
for out-of-tree kernel module written in Rust as well as associated test.

Summary of patches:

- Patch 01: Add required dependencies ('clang-native', 'rust-native','bindgen-cli-native') to the kernel to support Rust binding generation.
- Patch 02: Install the Rust standard library source ('library/') for  native,target and sdk.
- Patch 03: Updated `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness.
- Patch 04: Add kernel configuration support for Rust (via 'kernel-rust.scc'), enabling the Rust build options in kernel config.
- Patch 05: Fixed buildpaths errors when rust is enabled for kernel by appending --remap-path-prefix to RUST_DEBUG_REMAP
- Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix build issue with make-mod-scripts recipe.
- Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto.
- Patch 08: Copy Rust kernel sources into kernel-devsrc build directory which will be required while running 'make prepare' in sdk.
- Patch 09: Added oe-selftest case for the Linux Rust sample.
- patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR
- patch 11: Add support for rust-out-of-tree module compilation
- patch 12: Added rust-out-of-tree-module recipe in meta-skeleton layer
- Patch 13: Fixed buildpaths errors for rust-out-of-tree-module recipe by appending --remap-path-prefix to RUST_DEBUG_REMAP
- patch 14: Added rust-out-of-tree selftest

Patches have been build-tested successfully on:
- qemuarm64
- qemux86-64

Benchmark test-result for x86-64:
+-------------------------------+------------+-----------+-----------+-----------+
| DISTRO_FEATURES               |   real     |   user    |    sys    |  FS usage |
+-------------------------------+------------+-----------+-----------+-----------+
| rust-kernel (enabled)         | 46m1.720s  | 0m28.864s | 0m3.696s  |   58 GB   |
| rust-kernel (disabled)        | 30m1.053s  | 0m20.091s | 0m2.748s  |   33 GB   |
+-------------------------------+------------+-----------+-----------+-----------+

The increased in time & fs is due to kernel rust dependencies in
linux-yocto.

Harish Sadineni (10):
  linux-yocto: conditionally add clang/rust/bindgen-cli-native to
    DEPENDS
  rust: install Rust library sources for 'make rustavailable' support
  kernel-yocto-rust: enable Rust kernel support via 'make
    rustavailable'.
  linux-yocto: enable Rust support in kernel configuration
  kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for
    kernel
  make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto
  kernel: Disable ccache when kernel rust support is enabled
  kernel-devsrc: copying rust-kernel source to $kerneldir/build
  module-rust.bbclass: Prepare out-of-tree rust module compilation
  make-mod-scripts: fix for buildpath issues with rust-out-of-tree
    compilation

Yoann Congal (4):
  selftest/cases/runtime_test: Add test for Linux Rust sample
  kernel.bbclass: Copy include/config/auto.conf in
    STAGING_KERNEL_BUILDDIR
  meta-skeleton: Add rust-out-of-tree-module recipe
  runtime_test: Add rust-out-of-tree selftest

 .../rust-out-of-tree-module_git.bb            | 17 ++++++++
 meta/classes-recipe/kernel-yocto-rust.bbclass | 25 +++++++++++
 meta/classes-recipe/kernel-yocto.bbclass      |  2 +
 meta/classes-recipe/kernel.bbclass            |  1 +
 meta/classes-recipe/module-rust.bbclass       | 21 ++++++++++
 meta/lib/oeqa/selftest/cases/runtime_test.py  | 41 +++++++++++++++++++
 meta/recipes-devtools/rust/rust_1.93.0.bb     | 19 ++++++++-
 meta/recipes-kernel/linux/kernel-devsrc.bb    |  9 ++++
 meta/recipes-kernel/linux/linux-yocto.inc     |  3 ++
 meta/recipes-kernel/linux/linux-yocto_6.18.bb |  1 +
 .../make-mod-scripts/make-mod-scripts_1.0.bb  | 16 +++++++-
 11 files changed, 153 insertions(+), 2 deletions(-)
 create mode 100644 meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb
 create mode 100644 meta/classes-recipe/kernel-yocto-rust.bbclass
 create mode 100644 meta/classes-recipe/module-rust.bbclass

-- 
2.49.0



^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-09 11:26   ` [OE-core] " Richard Purdie
  2026-03-12 13:34   ` Richard Purdie
  2026-03-04 17:43 ` [PATCH v7 02/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
                   ` (12 subsequent siblings)
  13 siblings, 2 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
when Kernel Rust Support is enabled.

These tools are required for building Rust-enabled kernels and for
generating Rust FFI bindings via bindgen during the kernel build.

This ensures the additional dependencies are only pulled in when
Rust support is explicitly enabled, avoiding unnecessary native
dependencies for non-Rust kernel builds.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 4d0a726bb6..b7961bbcdf 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -76,11 +76,14 @@ do_install:append(){
 KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
 
 KERNEL_DEBUG ?= ""
+KERNEL_RUST_SUPPORT ?= ""
 # These used to be version specific, but are now common dependencies.  New
 # tools / dependencies will continue to be added in version specific recipes.
 DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
 DEPENDS += "openssl-native util-linux-native"
 DEPENDS += "gmp-native libmpc-native"
+RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}"
+DEPENDS += "${RUST_KERNEL_DEPENDS}"
 
 # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
 do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 02/14] rust: install Rust library sources for 'make rustavailable' support
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 03/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

The `make rustavailable` process (1) expects the Rust standard library source files (e.g., `lib.rs`)
to be present in the `library/` directory under `rustlib/src/rust/`.

This patch ensures the required sources are available by:
- Installing the `library/` directory (of size ~50MB) into `${D}${libdir}/rustlib/src/rust` for
  making them available during `make rustavailable` for native, target & sdk.
- packaging `${libdir}/rustlib/src/rust` sepearately with `${PN}-src-lib`.

1) See the kernel tree for Documentation/rust/quick-start.rst in the section: Requirements: Building

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/rust/quick-start.rst#n145

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-devtools/rust/rust_1.93.0.bb | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/rust/rust_1.93.0.bb b/meta/recipes-devtools/rust/rust_1.93.0.bb
index 2be0bd8d89..faafc63c96 100644
--- a/meta/recipes-devtools/rust/rust_1.93.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.93.0.bb
@@ -266,10 +266,11 @@ do_test_compile () {
 
 ALLOW_EMPTY:${PN} = "1"
 
-PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt"
+PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt ${PN}-src-lib"
 FILES:${PN}-rustdoc = "${bindir}/rustdoc"
 FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver"
 FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt"
+FILES:${PN}-src-lib = "${libdir}/rustlib/src/rust"
 
 RDEPENDS:${PN}-rustdoc = "${PN}"
 RDEPENDS:${PN}-tools-clippy = "${PN}"
@@ -286,6 +287,12 @@ rust_do_install() {
     rust_runx install
 }
 
+rust_do_install:append:class-native() {
+    install -d ${D}${libdir}/rustlib/src/rust
+    cp -r ${S}/library ${D}${libdir}/rustlib/src/rust
+    find ${D}${libdir}/rustlib/src/rust/ -name "*.sh" -type f -delete
+}
+
 rust_do_install:class-nativesdk() {
     export PSEUDO_UNLOAD=1
     rust_runx install
@@ -316,6 +323,11 @@ rust_do_install:class-nativesdk() {
 	export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}"
 	export CC_$RUST_HOST_CC="${CCACHE}${HOST_PREFIX}gcc"
 	EOF
+
+    install -d ${D}${libdir}/rustlib/src/rust
+    cp -r ${S}/library ${D}${libdir}/rustlib/src/rust
+    find ${D}${libdir}/rustlib/src/rust/ -name "*.sh" -type f -delete
+
 }
 
 FILES:${PN} += "${base_prefix}/environment-setup.d"
@@ -336,6 +348,11 @@ rust_do_install:class-target() {
 
     install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS}
     install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json
+    install -d ${D}${libdir}/rustlib/src/rust
+    cp -r ${S}/library ${D}${libdir}/rustlib/src/rust
+    find ${D}${libdir}/rustlib/src/rust -name "*.sh" -type f -delete
+    install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/${RUST_HOST_SYS}.json
+
 
     chown root:root ${D}/ -R
     rm ${D}${libdir}/rustlib/uninstall.sh
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 03/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable'.
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 02/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 04/14] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

This change adds support for Rust-enabled kernel builds by:

-Extending do_kernel_configme dependencies to include rust-native,
 clang-native, and bindgen-cli-native.

-Invoking make rustavailable during do_kernel_configme() to prepare the
 kernel build environment for Rust.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel-yocto-rust.bbclass | 12 ++++++++++++
 meta/classes-recipe/kernel-yocto.bbclass      |  2 ++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/classes-recipe/kernel-yocto-rust.bbclass

diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
new file mode 100644
index 0000000000..7acc81764f
--- /dev/null
+++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
@@ -0,0 +1,12 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+RUST_KERNEL_TASK_DEPENDS ?=  "rust-native:do_populate_sysroot clang-native:do_populate_sysroot bindgen-cli-native:do_populate_sysroot"
+do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
+
+do_kernel_configme:append () {
+        oe_runmake -C ${S} O=${B} rustavailable
+}
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e53bf15194..5939318101 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier: MIT
 #
 
+inherit_defer ${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', ' kernel-yocto-rust', '', d)}
+
 # remove tasks that modify the source tree in case externalsrc is inherited
 SRCTREECOVEREDTASKS += "do_validate_branches do_kernel_configcheck do_kernel_checkout do_fetch do_unpack do_patch"
 PATCH_GIT_USER_EMAIL ?= "kernel-yocto@oe"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 04/14] linux-yocto: enable Rust support in kernel configuration
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (2 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 03/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Add support for building the Linux kernel with Rust enabled:

- Update `linux-yocto_${PV}.bb` to:
  - Append `features/kernel-rust/kernel-rust.scc` to `KERNEL_FEATURES`.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/linux/linux-yocto_6.18.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-kernel/linux/linux-yocto_6.18.bb b/meta/recipes-kernel/linux/linux-yocto_6.18.bb
index cc3831f798..fee97748d9 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.18.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.18.bb
@@ -77,3 +77,4 @@ 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"
+KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', ' features/kernel-rust/kernel-rust.scc', '', d)}"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (3 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 04/14] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Fixes for buildpaths errors after enabling rust for linux-kernel

-Introduced KRUSTFLAGS to pass `--remap-path-prefix` to rustc while
 building kernel with rust support.

Co-authored-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel-yocto-rust.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
index 7acc81764f..fd9ee91c79 100644
--- a/meta/classes-recipe/kernel-yocto-rust.bbclass
+++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
@@ -4,6 +4,12 @@
 # SPDX-License-Identifier: MIT
 #
 
+RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=${TARGET_DBGSRC_DIR} \
+                    --remap-path-prefix=${TMPDIR}/work-shared=${TARGET_DBGSRC_DIR} \
+"
+KRUSTFLAGS = " ${RUST_DEBUG_REMAP}"
+EXTRA_OEMAKE:append = " KRUSTFLAGS='${KRUSTFLAGS}'"
+
 RUST_KERNEL_TASK_DEPENDS ?=  "rust-native:do_populate_sysroot clang-native:do_populate_sysroot bindgen-cli-native:do_populate_sysroot"
 do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (4 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

when compiling rust-out-of-tree module recipe 'make-mod-scripts' failing
with the following error:

HOSTRUSTC scripts/generate_rust_target
error: Unrecognized option: 'i'

This issue occurs because CFLAGS are being passed to HOSTRUSTC.
Updated the flags in the make-mod-scripts recipe to align with
the flags used by linux-yocto.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
index 8fcb5e6eb3..874e16e642 100644
--- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
+++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
@@ -18,7 +18,7 @@ DEV_PKG_DEPENDENCY = ""
 DEPENDS += "bc-native bison-native"
 DEPENDS += "gmp-native"
 
-EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
+EXTRA_OEMAKE = " HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}""
 EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}" CROSS_COMPILE=${TARGET_PREFIX}"
 
 KERNEL_LOCALVERSION = "${@get_kernellocalversion_file("${STAGING_KERNEL_BUILDDIR}")}"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 07/14] kernel: Disable ccache when kernel rust support is enabled
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (5 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Currently, a ccache enabled build fails with:
  |   HOSTRUSTC scripts/generate_rust_target
  |   HOSTCC  scripts/kallsyms
  |   HOSTCC  scripts/sorttable
  |   HOSTCC  scripts/asn1_compiler
  |   TOUCH   include/generated/gcc-plugins.h
  |   DESCEND objtool
  | error: multiple input filenames provided (first two filenames are gcc and
.../tmp/work-shared/qemux86-64/kernel-source/scripts/generate_rust_target.rs)

Linux rust build infrastructure does not currently support ccache (Opened bug[0]).

Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc
expect a path (and not a command)

Disable ccache if KERNEL_RUST_SUPPORT is 'True' for kernel and kernel module builds, including
auxiliary tooling such as make-mod-scripts.

More details in: https://lists.openembedded.org/g/openembedded-core/message/229336

[0]: https://github.com/Rust-for-Linux/linux/issues/1224

Co-developed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
Cc: Alban MOIZAN <alban.moizan@smile.fr>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel-yocto-rust.bbclass              | 7 +++++++
 .../make-mod-scripts/make-mod-scripts_1.0.bb               | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/meta/classes-recipe/kernel-yocto-rust.bbclass b/meta/classes-recipe/kernel-yocto-rust.bbclass
index fd9ee91c79..608ccc4609 100644
--- a/meta/classes-recipe/kernel-yocto-rust.bbclass
+++ b/meta/classes-recipe/kernel-yocto-rust.bbclass
@@ -16,3 +16,10 @@ do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
 do_kernel_configme:append () {
         oe_runmake -C ${S} O=${B} rustavailable
 }
+
+# Linux rust build infrastructure does not currently support ccache
+# see https://github.com/Rust-for-Linux/linux/issues/1224
+# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
+# 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"
diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
index 874e16e642..6226382001 100644
--- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
+++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
@@ -36,3 +36,10 @@ do_configure() {
 		-C ${STAGING_KERNEL_DIR} O=${STAGING_KERNEL_BUILDDIR} $t
 	done
 }
+
+# Linux rust build infrastructure does not currently support ccache
+# see https://github.com/Rust-for-Linux/linux/issues/1224
+# Quick summary: There are 2 issues: $HOSTCC is not escaped and rustc expect a path (and not a command)
+# 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 ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', '1', '0', d)}"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (6 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

When CONFIG_RUST is enabled, running 'make prepare' in the  target & SDK
fails because the Rust kernel infrastructure is incomplete in the staged
kernel sources.

The Rust build system requires a wider set of interdependent sources
during make prepare, including bindgen inputs, C helper sources,
generated headers, and other support files. These are all located under
the kernel rust/ directory.

To ensure make prepare succeeds and to support building Rust-based
kernel modules from the  target & SDK, copy the full rust/ directory
(of size 2.5MB) into $kerneldir/build when the rust-kernel distro feature
is enabled.

Additionally, when Rust support is enabled, 'make prepare' generates
.rmeta files (crate metadata in a custom binary format) and shared
objects (.so) that are required for compiling Rust kernel modules.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 23a9093ede..d9b09a3d9a 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -140,6 +140,15 @@ do_install() {
 
         cp -a scripts $kerneldir/build
 
+        # In sdk, when CONFIG_RUST is enabled, `make prepare` requires the full Rust
+        # kernel infrastructure. The Rust build system pulls in bindgen inputs, C helpers,
+        # generated headers, and generate crate metadata (.rmeta), and shared objects
+        # needed for building Rust kernel modules. Copy the entire rust/ directory (of size 2.5MB)
+        # to avoid failures with 'make prepare'.
+        if ${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'true', 'false', d)}; then
+            cp -a rust ${kerneldir}/build
+        fi
+
         # for v6.1+ (otherwise we are missing multiple default targets)
         cp -a --parents Kbuild $kerneldir/build 2>/dev/null || :
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (7 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Yoann Congal <yoann.congal@smile.fr>

This new case tests that the rust_mininal sample inside the kernel source
tree is buildable and works properly: check that the module can be
loaded and that it prints correctly.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index d58ffa80f5..6b7cd45684 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -481,3 +481,30 @@ IMAGE_INSTALL:append = " systemtap-runtime"
                 cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples
                 result = runCmd(cmd)
                 self.assertEqual(0, result.status, 'crosstap  syscalls_by_pid returned a non 0 status:%s' % result.output)
+@OETestTag("runqemu")
+class RustKernel(OESelftestTestCase):
+        @classmethod
+        def setUpClass(cls):
+            super(RustKernel, cls).setUpClass()
+            cls.image = "core-image-minimal"
+
+        def test_kernel_rust_sample(self):
+            import textwrap
+            self.write_config(textwrap.dedent("""
+                KERNEL_RUST_SUPPORT = 'True'
+                KERNEL_EXTRA_FEATURES:append = ' features/kernel-sample/kernel-rust-sample.scc'
+                CORE_IMAGE_EXTRA_INSTALL += "kernel-module-rust-minimal"
+            """))
+            bitbake(self.image)
+
+            with runqemu(self.image, runqemuparams = "nographic") as qemu:
+                qemu.run_serial("dmesg -c > /dev/null")
+                status, _ = qemu.run_serial("modprobe rust_minimal")
+                #Disable status check due to intermittent failures on armhost/qemuarm64.
+                #The module loads successfully, but qemu.run_serial() occasionally
+                #returns an incorrect status.
+                #Bug report: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16189
+                #self.assertEqual(status, 1, "Loading rust_minimal module failed!")
+                _, output = qemu.run_serial("dmesg")
+                self.logger.debug(f"rust_minimal dmesg output:\n" + textwrap.indent(output, "  "))
+                self.assertIn("Rust minimal sample", output, "Kernel Rust sample expected output not found in dmesg")
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (8 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Yoann Congal <yoann.congal@smile.fr>

Linux commit aaed5c7739be ("kbuild: slim down package for building
external modules")[0] states that include/config/auto.conf is also a
file needed for out-of-tree build.

This avoids this error when building an out-of-tree Rust kernel module:
| make -C .../tmp/work-shared/qemux86-64/kernel-source M=$PWD
| make[1]: Entering directory '.../tmp/work-shared/qemux86-64/kernel-source'
| make[2]: Entering directory '.../tmp/work/qemux86_64-poky-linux/rust-out-of-tree-module/git/sources/rust-out-of-tree-module-git'
| .../tmp/work-shared/qemux86-64/kernel-source/Makefile:779: .../tmp/work-shared/qemux86-64/kernel-build-artifacts/include/config/auto.conf: No such file or directory

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aaed5c7739be81ebdd6008aedc8befd98c88e67a

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 22568d6e9c..5c457ef5e6 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -563,6 +563,7 @@ do_shared_workdir () {
 	cp .config $kerneldir/
 	mkdir -p $kerneldir/include/config
 	cp include/config/kernel.release $kerneldir/include/config/kernel.release
+	cp include/config/auto.conf      $kerneldir/include/config/auto.conf
 	if [ -e certs/signing_key.x509 ]; then
 		# The signing_key.* files are stored in the certs/ dir in
 		# newer Linux kernels
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (9 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Add support for rust-out-of-tree module compilation:
- Add dependency to rust-native
- Remap ${S} in compiled output to avoid buildpath errors
- Added check to skip rust out-of-ree-module compilation,
  if rust kernel support is not enabled

Co-developed-by:Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/module-rust.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 meta/classes-recipe/module-rust.bbclass

diff --git a/meta/classes-recipe/module-rust.bbclass b/meta/classes-recipe/module-rust.bbclass
new file mode 100644
index 0000000000..f9cee5e5bd
--- /dev/null
+++ b/meta/classes-recipe/module-rust.bbclass
@@ -0,0 +1,21 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit module
+
+DEPENDS += " rust-native"
+
+RUST_DEBUG_REMAP = "--remap-path-prefix=${S}=${TARGET_DBGSRC_DIR} "
+KRUSTFLAGS = " ${RUST_DEBUG_REMAP}"
+EXTRA_OEMAKE:append = " KRUSTFLAGS='${KRUSTFLAGS}'"
+
+python __anonymous() {
+    features = (d.getVar('KERNEL_RUST_SUPPORT') or "").split()
+    if "True" not in features:
+        raise bb.parse.SkipRecipe(
+            "Skipping rust-out-of-tree-module: KERNEL_RUST_SUPPORT is not enabled"
+       )
+}
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 12/14] meta-skeleton: Add rust-out-of-tree-module recipe
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (10 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Yoann Congal <yoann.congal@smile.fr>

Basic template for an out-of-tree Linux kernel module written in Rust.

Mainly to test Rust integration into the kernel.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 .../rust-out-of-tree-module_git.bb              | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb

diff --git a/meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb b/meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb
new file mode 100644
index 0000000000..077780a192
--- /dev/null
+++ b/meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb
@@ -0,0 +1,17 @@
+SUMMARY = "Basic template for an out-of-tree Linux kernel module written in Rust"
+HOMEPAGE = "https://github.com/Rust-for-Linux/rust-out-of-tree-module"
+
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+inherit module-rust
+
+SRC_URI = "git://github.com/Rust-for-Linux/rust-out-of-tree-module.git;protocol=https;branch=main"
+SRCREV = "00b5a8ee2bf53532d115004d7636b61a54f49802"
+UPSTREAM_CHECK_COMMITS = "1"
+
+EXTRA_OEMAKE = "KDIR=${STAGING_KERNEL_DIR}"
+
+# The inherit of module.bbclass will automatically name module packages with
+# "kernel-module-" prefix as required by the oe-core build environment.
+RPROVIDES:${PN} += "kernel-module-rust-out-of-tree"
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (11 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  2026-03-04 17:43 ` [PATCH v7 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Harish Sadineni <Harish.Sadineni@windriver.com>

Fixes buildpath issues when compiling rust-out-of-tree recipe.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 .../make-mod-scripts/make-mod-scripts_1.0.bb               | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
index 6226382001..2de7d4976b 100644
--- a/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
+++ b/meta/recipes-kernel/make-mod-scripts/make-mod-scripts_1.0.bb
@@ -43,3 +43,10 @@ do_configure() {
 # 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 ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', '1', '0', d)}"
+
+#Fixes buildpath issues when compiling rust-out-of-tree module
+RUST_DEBUG_REMAP ?= "--remap-path-prefix=${TMPDIR}/work-shared=${TARGET_DBGSRC_DIR} \
+                     --remap-path-prefix=${TMPDIR}/work=${TARGET_DBGSRC_DIR} \
+"
+KRUSTFLAGS = " ${RUST_DEBUG_REMAP}"
+EXTRA_OEMAKE:append = ' KRUSTFLAGS="${KRUSTFLAGS}"'
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v7 14/14] runtime_test: Add rust-out-of-tree selftest
  2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
                   ` (12 preceding siblings ...)
  2026-03-04 17:43 ` [PATCH v7 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
@ 2026-03-04 17:43 ` Harish.Sadineni
  13 siblings, 0 replies; 27+ messages in thread
From: Harish.Sadineni @ 2026-03-04 17:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

From: Yoann Congal <yoann.congal@smile.fr>

This new case tests that the rust-out-of-tree-module recipe compiles and
run properly: check that the dmesg output is as expected.

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/lib/oeqa/selftest/cases/runtime_test.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 6b7cd45684..463dcc5396 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -493,8 +493,11 @@ class RustKernel(OESelftestTestCase):
             self.write_config(textwrap.dedent("""
                 KERNEL_RUST_SUPPORT = 'True'
                 KERNEL_EXTRA_FEATURES:append = ' features/kernel-sample/kernel-rust-sample.scc'
-                CORE_IMAGE_EXTRA_INSTALL += "kernel-module-rust-minimal"
+                CORE_IMAGE_EXTRA_INSTALL += "kernel-module-rust-minimal kernel-module-rust-out-of-tree"
             """))
+
+            runCmd('bitbake-layers add-layer %s' % os.path.join(get_bb_var("COREBASE"), 'meta-skeleton'))
+            self.add_command_to_tearDown('bitbake-layers remove-layer */meta-skeleton')
             bitbake(self.image)
 
             with runqemu(self.image, runqemuparams = "nographic") as qemu:
@@ -508,3 +511,14 @@ class RustKernel(OESelftestTestCase):
                 _, output = qemu.run_serial("dmesg")
                 self.logger.debug(f"rust_minimal dmesg output:\n" + textwrap.indent(output, "  "))
                 self.assertIn("Rust minimal sample", output, "Kernel Rust sample expected output not found in dmesg")
+
+                qemu.run_serial("dmesg -c > /dev/null")
+                status, _ = qemu.run_serial("modprobe rust_out_of_tree")
+                #Disable status check due to intermittent failures on armhost/qemuarm64.
+                #The module loads successfully, but qemu.run_serial() occasionally
+                #returns an incorrect status.
+                #Bug report: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16189
+                #self.assertEqual(status, 1, "Loading rust_out_of_tree module failed!")
+                _, output = qemu.run_serial("dmesg")
+                self.logger.debug(f"rust_out_of_tree dmesg output:\n" + textwrap.indent(output, "  "))
+                self.assertIn("Rust out-of-tree sample", output, "Out-of-tree Rust sample expected output not found in dmesg")
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
@ 2026-03-09 11:26   ` Richard Purdie
  2026-03-09 16:09     ` Harish Sadineni
  2026-03-12 13:34   ` Richard Purdie
  1 sibling, 1 reply; 27+ messages in thread
From: Richard Purdie @ 2026-03-09 11:26 UTC (permalink / raw)
  To: Harish.Sadineni, openembedded-core
  Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal,
	Bruce Ashfield

On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
> 
> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
> when Kernel Rust Support is enabled.
> 
> These tools are required for building Rust-enabled kernels and for
> generating Rust FFI bindings via bindgen during the kernel build.
> 
> This ensures the additional dependencies are only pulled in when
> Rust support is explicitly enabled, avoiding unnecessary native
> dependencies for non-Rust kernel builds.
> 
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
> index 4d0a726bb6..b7961bbcdf 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -76,11 +76,14 @@ do_install:append(){
>  KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>  
>  KERNEL_DEBUG ?= ""
> +KERNEL_RUST_SUPPORT ?= ""
>  # These used to be version specific, but are now common dependencies.  New
>  # tools / dependencies will continue to be added in version specific recipes.
>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>  DEPENDS += "openssl-native util-linux-native"
>  DEPENDS += "gmp-native libmpc-native"
> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}"
> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>  
>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'

I thought we were going to try and use KERNEL_FEATURES for this?

The implementation of KERNEL_RUST_SUPPORT is problematic as it only
works for the value of "True", not "true", or "1" or 1 or any other
thing people might dream up. "Contains" isn't really an appropriate
mechanism for a boolean either.

You can use bb.utils.to_boolean() as a way to better obtain a boolean
value from a random variable.

Cheers,

Richard







^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 11:26   ` [OE-core] " Richard Purdie
@ 2026-03-09 16:09     ` Harish Sadineni
  2026-03-09 16:29       ` Bruce Ashfield
  0 siblings, 1 reply; 27+ messages in thread
From: Harish Sadineni @ 2026-03-09 16:09 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core
  Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal,
	Bruce Ashfield

[-- Attachment #1: Type: text/plain, Size: 2937 bytes --]


On 3/9/2026 4:56 PM, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
>> From: Harish Sadineni<Harish.Sadineni@windriver.com>
>>
>> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
>> when Kernel Rust Support is enabled.
>>
>> These tools are required for building Rust-enabled kernels and for
>> generating Rust FFI bindings via bindgen during the kernel build.
>>
>> This ensures the additional dependencies are only pulled in when
>> Rust support is explicitly enabled, avoiding unnecessary native
>> dependencies for non-Rust kernel builds.
>>
>> Signed-off-by: Harish Sadineni<Harish.Sadineni@windriver.com>
>> ---
>>   meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
>> index 4d0a726bb6..b7961bbcdf 100644
>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>> @@ -76,11 +76,14 @@ do_install:append(){
>>   KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>>
>>   KERNEL_DEBUG ?= ""
>> +KERNEL_RUST_SUPPORT ?= ""
>>   # These used to be version specific, but are now common dependencies.  New
>>   # tools / dependencies will continue to be added in version specific recipes.
>>   DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>>   DEPENDS += "openssl-native util-linux-native"
>>   DEPENDS += "gmp-native libmpc-native"
>> +RUST_KERNEL_DEPENDS ?="${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native 
>> rust-native bindgen-cli-native', '', d)}"
>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>>
>>   # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>>   do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
> I thought we were going to try and use KERNEL_FEATURES for this?
Hi Richard,

I have tried this but i got circular dependency error with 
KERNEL_FEATURES. So, I opted using variable KERNEL_RUST_SUPPORT.
> The implementation of KERNEL_RUST_SUPPORT is problematic as it only
> works for the value of "True", not "true", or "1" or 1 or any other
> thing people might dream up. "Contains" isn't really an appropriate
> mechanism for a boolean either.
>
> You can use bb.utils.to_boolean() as a way to better obtain a boolean
> value from a random variable.
Understood, Earlier i took reference from the code that already present 
in that file.
I have updated the code we will send v8.

Thanks,
Harish
>
> Cheers,
>
> Richard
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 4315 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 16:09     ` Harish Sadineni
@ 2026-03-09 16:29       ` Bruce Ashfield
  2026-03-09 16:53         ` Harish Sadineni
  0 siblings, 1 reply; 27+ messages in thread
From: Bruce Ashfield @ 2026-03-09 16:29 UTC (permalink / raw)
  To: Harish Sadineni
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 3511 bytes --]

On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni <
Harish.Sadineni@windriver.com> wrote:

>
> On 3/9/2026 4:56 PM, Richard Purdie wrote:
>
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
>
> From: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
>
> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
> when Kernel Rust Support is enabled.
>
> These tools are required for building Rust-enabled kernels and for
> generating Rust FFI bindings via bindgen during the kernel build.
>
> This ensures the additional dependencies are only pulled in when
> Rust support is explicitly enabled, avoiding unnecessary native
> dependencies for non-Rust kernel builds.
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
> ---
>  meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
> index 4d0a726bb6..b7961bbcdf 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -76,11 +76,14 @@ do_install:append(){
>  KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>
>  KERNEL_DEBUG ?= ""
> +KERNEL_RUST_SUPPORT ?= ""
>  # These used to be version specific, but are now common dependencies.  New
>  # tools / dependencies will continue to be added in version specific recipes.
>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>  DEPENDS += "openssl-native util-linux-native"
>  DEPENDS += "gmp-native libmpc-native"
> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}" <$%7B@bb.utils.contains('KERNEL_RUST_SUPPORT','True','clang-nativerust-nativebindgen-cli-native','',d)%7D>
> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>
>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
>
> I thought we were going to try and use KERNEL_FEATURES for this?
>
> Hi Richard,
>
> I have tried this but i got circular dependency error with
> KERNEL_FEATURES. So, I opted using variable KERNEL_RUST_SUPPORT.
>

I'm curious about that. Can you share the details ? (diff and the bitbake
error)

Bruce



> The implementation of KERNEL_RUST_SUPPORT is problematic as it only
> works for the value of "True", not "true", or "1" or 1 or any other
> thing people might dream up. "Contains" isn't really an appropriate
> mechanism for a boolean either.
>
> You can use bb.utils.to_boolean() as a way to better obtain a boolean
> value from a random variable.
>
> Understood, Earlier i took reference from the code that already present in
> that file.
> I have updated the code we will send v8.
>
> Thanks,
> Harish
>
> Cheers,
>
> Richard
>
>
>
>
>
>
>

-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 5255 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 16:29       ` Bruce Ashfield
@ 2026-03-09 16:53         ` Harish Sadineni
  2026-03-09 18:01           ` Bruce Ashfield
  0 siblings, 1 reply; 27+ messages in thread
From: Harish Sadineni @ 2026-03-09 16:53 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 5732 bytes --]


On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
> **
> *CAUTION: This email comes from a non Wind River email account!*
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
>
>
> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni 
> <Harish.Sadineni@windriver.com> wrote:
>
>
>     On 3/9/2026 4:56 PM, Richard Purdie wrote:
>>     CAUTION: This email comes from a non Wind River email account!
>>     Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>
>>     On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish vialists.openembedded.org  <https://urldefense.com/v3/__http://lists.openembedded.org__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_U2VxaLk$>  wrote:
>>>     From: Harish Sadineni<Harish.Sadineni@windriver.com>  <mailto:Harish.Sadineni@windriver.com>
>>>
>>>     Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
>>>     when Kernel Rust Support is enabled.
>>>
>>>     These tools are required for building Rust-enabled kernels and for
>>>     generating Rust FFI bindings via bindgen during the kernel build.
>>>
>>>     This ensures the additional dependencies are only pulled in when
>>>     Rust support is explicitly enabled, avoiding unnecessary native
>>>     dependencies for non-Rust kernel builds.
>>>
>>>     Signed-off-by: Harish Sadineni<Harish.Sadineni@windriver.com>  <mailto:Harish.Sadineni@windriver.com>
>>>     ---
>>>       meta/recipes-kernel/linux/linux-yocto.inc  <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>  | 3 +++
>>>       1 file changed, 3 insertions(+)
>>>
>>>     diff --git a/meta/recipes-kernel/linux/linux-yocto.inc  <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>  b/meta/recipes-kernel/linux/linux-yocto.inc  <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>>>     index 4d0a726bb6..b7961bbcdf 100644
>>>     --- a/meta/recipes-kernel/linux/linux-yocto.inc  <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>>>     +++ b/meta/recipes-kernel/linux/linux-yocto.inc  <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>>>     @@ -76,11 +76,14 @@ do_install:append(){
>>>       KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>>>
>>>       KERNEL_DEBUG ?= ""
>>>     +KERNEL_RUST_SUPPORT ?= ""
>>>       # These used to be version specific, but are now common dependencies.  New
>>>       # tools / dependencies will continue to be added in version specific recipes.
>>>       DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>>>       DEPENDS += "openssl-native util-linux-native"
>>>       DEPENDS += "gmp-native libmpc-native"
>>>     +RUST_KERNEL_DEPENDS ?="${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
>>>     'clang-native rust-native bindgen-cli-native', '', d)}"  <mailto:$%7B@bb.utils.contains('KERNEL_RUST_SUPPORT','True','clang-nativerust-nativebindgen-cli-native','',d)%7D>
>>>     +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>>>
>>>       # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>>>       do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
>>     I thought we were going to try and use KERNEL_FEATURES for this?
>     Hi Richard,
>
>     I have tried this but i got circular dependency error with
>     KERNEL_FEATURES. So, I opted using variable KERNEL_RUST_SUPPORT.
>
>
> I'm curious about that. Can you share the details ? (diff and the 
> bitbake error)

As discussed previously, I attempted to use the following in 
meta/recipes-kernel/linux/linux-yocto_6.18.bb:

KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES', 
'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"

This resulted in a BitBake variable dependency chain failure. The issue 
occurs because the expression is trying to read KERNEL_FEATURES
while simultaneously modifying KERNEL_FEATURES, which creates a circular 
dependency.

example:
  The variable dependency chain for the failure is: KERNEL_FEATURES -> 
KERNEL_FEATURES -> KERNEL_FEATURES -> KERNEL_FEATURES...

Thanks,
Harish
>
> Bruce
>
>>     The implementation of KERNEL_RUST_SUPPORT is problematic as it only
>>     works for the value of "True", not "true", or "1" or 1 or any other
>>     thing people might dream up. "Contains" isn't really an appropriate
>>     mechanism for a boolean either.
>>
>>     You can use bb.utils.to_boolean() as a way to better obtain a boolean
>>     value from a random variable.
>     Understood, Earlier i took reference from the code that already
>     present in that file.
>     I have updated the code we will send v8.
>
>     Thanks,
>     Harish
>>     Cheers,
>>
>>     Richard
>>
>>
>>
>>
>>
>
>
> -- 
> - Thou shalt not follow the NULL pointer, for chaos and madness await 
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>

[-- Attachment #2: Type: text/html, Size: 9475 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 16:53         ` Harish Sadineni
@ 2026-03-09 18:01           ` Bruce Ashfield
  2026-03-09 19:20             ` Richard Purdie
  0 siblings, 1 reply; 27+ messages in thread
From: Bruce Ashfield @ 2026-03-09 18:01 UTC (permalink / raw)
  To: Harish Sadineni
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 5984 bytes --]

On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni <
Harish.Sadineni@windriver.com> wrote:

>
> On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
>
> *CAUTION: This email comes from a non Wind River email account!*
> Do not click links or open attachments unless you recognize the sender and
> know the content is safe.
>
>
> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni <
> Harish.Sadineni@windriver.com> wrote:
>
>>
>> On 3/9/2026 4:56 PM, Richard Purdie wrote:
>>
>> CAUTION: This email comes from a non Wind River email account!
>> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>
>> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org <https://urldefense.com/v3/__http://lists.openembedded.org__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_U2VxaLk$> wrote:
>>
>> From: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
>>
>> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
>> when Kernel Rust Support is enabled.
>>
>> These tools are required for building Rust-enabled kernels and for
>> generating Rust FFI bindings via bindgen during the kernel build.
>>
>> This ensures the additional dependencies are only pulled in when
>> Rust support is explicitly enabled, avoiding unnecessary native
>> dependencies for non-Rust kernel builds.
>>
>> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
>> ---
>>  meta/recipes-kernel/linux/linux-yocto.inc <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$> | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$> b/meta/recipes-kernel/linux/linux-yocto.inc <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>> index 4d0a726bb6..b7961bbcdf 100644
>> --- a/meta/recipes-kernel/linux/linux-yocto.inc <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!cWPq0za66UhcuPm1JB9FSYJ5JMWWpL_480vZLcrK0BTZbuoPaFvjdJly1r2bF4S-jo8X5LrrrXkmL3xU90Zr5Er_ybuc9RA$>
>> @@ -76,11 +76,14 @@ do_install:append(){
>>  KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>>
>>  KERNEL_DEBUG ?= ""
>> +KERNEL_RUST_SUPPORT ?= ""
>>  # These used to be version specific, but are now common dependencies.  New
>>  # tools / dependencies will continue to be added in version specific recipes.
>>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>>  DEPENDS += "openssl-native util-linux-native"
>>  DEPENDS += "gmp-native libmpc-native"
>> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}" <$%7B@bb.utils.contains('KERNEL_RUST_SUPPORT','True','clang-nativerust-nativebindgen-cli-native','',d)%7D>
>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>>
>>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
>>
>> I thought we were going to try and use KERNEL_FEATURES for this?
>>
>> Hi Richard,
>>
>> I have tried this but i got circular dependency error with
>> KERNEL_FEATURES. So, I opted using variable KERNEL_RUST_SUPPORT.
>>
>
> I'm curious about that. Can you share the details ? (diff and the bitbake
> error)
>
>
> As discussed previously, I attempted to use the following in
> meta/recipes-kernel/linux/linux-yocto_6.18.bb:
>
> KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES',
> 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
>
> This resulted in a BitBake variable dependency chain failure. The issue
> occurs because the expression is trying to read KERNEL_FEATURES
> while simultaneously modifying KERNEL_FEATURES, which creates a circular
> dependency.
>

Yes, that's clearly not going to work, but that wouldn't have been the
suggestion.

Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS based on the
KERNEL_FEATURES containing rust.scc ?

Bruce



>
> example:
>  The variable dependency chain for the failure is: KERNEL_FEATURES ->
> KERNEL_FEATURES -> KERNEL_FEATURES -> KERNEL_FEATURES...
>
> Thanks,
> Harish
>
>
> Bruce
>
>
>
>> The implementation of KERNEL_RUST_SUPPORT is problematic as it only
>> works for the value of "True", not "true", or "1" or 1 or any other
>> thing people might dream up. "Contains" isn't really an appropriate
>> mechanism for a boolean either.
>>
>> You can use bb.utils.to_boolean() as a way to better obtain a boolean
>> value from a random variable.
>>
>> Understood, Earlier i took reference from the code that already present
>> in that file.
>> I have updated the code we will send v8.
>>
>> Thanks,
>> Harish
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
>>
>>
>>
>>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await thee
> at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
>

-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 10456 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 18:01           ` Bruce Ashfield
@ 2026-03-09 19:20             ` Richard Purdie
  2026-03-10 10:57               ` Harish Sadineni
  0 siblings, 1 reply; 27+ messages in thread
From: Richard Purdie @ 2026-03-09 19:20 UTC (permalink / raw)
  To: Bruce Ashfield, Harish Sadineni
  Cc: openembedded-core, Randy.MacLeod, Sundeep.Kokkonda, paul,
	yoann.congal

On Mon, 2026-03-09 at 14:01 -0400, Bruce Ashfield wrote:
> 
> 
> 
> On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni
> <Harish.Sadineni@windriver.com> wrote:
> >  
> >  
> > 
> >  
> >  
> > On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
> >  
> >  
> > >    
> > > CAUTION: This email comes from a non Wind River email account!
> > >  Do not click links or open attachments unless you recognize the
> > > sender and know the content is safe.
> > >  
> > >  
> > >  
> > >  
> > >  
> > > 
> > >  
> > >  
> > >  
> > >  
> > >  
> > > On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni
> > > <Harish.Sadineni@windriver.com> wrote:
> > >  
> > >  
> > > >  
> > > >  
> > > > 
> > > >  
> > > >  
> > > > On 3/9/2026 4:56 PM, Richard Purdie wrote:
> > > >  
> > > >  
> > > > >  
> > > > > CAUTION: This email comes from a non Wind River email
> > > > > account!
> > > > > Do not click links or open attachments unless you recognize
> > > > > the sender and know the content is safe.
> > > > > 
> > > > > On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via
> > > > > lists.openembedded.org wrote:
> > > > >  
> > > > > >  
> > > > > > From: Harish Sadineni <Harish.Sadineni@windriver.com>
> > > > > > 
> > > > > > Conditionally add 'clang-native', 'rust-native' and
> > > > > > 'bindgen-cli-native' to 'DEPENDS'
> > > > > > when Kernel Rust Support is enabled.
> > > > > > 
> > > > > > These tools are required for building Rust-enabled kernels
> > > > > > and for
> > > > > > generating Rust FFI bindings via bindgen during the kernel
> > > > > > build.
> > > > > > 
> > > > > > This ensures the additional dependencies are only pulled in
> > > > > > when
> > > > > > Rust support is explicitly enabled, avoiding unnecessary
> > > > > > native
> > > > > > dependencies for non-Rust kernel builds.
> > > > > > 
> > > > > > Signed-off-by: Harish Sadineni
> > > > > > <Harish.Sadineni@windriver.com>
> > > > > > ---
> > > > > >  meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
> > > > > >  1 file changed, 3 insertions(+)
> > > > > > 
> > > > > > diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
> > > > > > b/meta/recipes-kernel/linux/linux-yocto.inc
> > > > > > index 4d0a726bb6..b7961bbcdf 100644
> > > > > > --- a/meta/recipes-kernel/linux/linux-yocto.inc
> > > > > > +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> > > > > > @@ -76,11 +76,14 @@ do_install:append(){
> > > > > >  KERNEL_FEATURES:append:qemuall = " features/kernel-
> > > > > > sample/kernel-sample.scc"
> > > > > > 
> > > > > >  KERNEL_DEBUG ?= ""
> > > > > > +KERNEL_RUST_SUPPORT ?= ""
> > > > > >  # These used to be version specific, but are now common
> > > > > > dependencies.  New
> > > > > >  # tools / dependencies will continue to be added in
> > > > > > version specific recipes.
> > > > > >  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86",
> > > > > > "arm64", "powerpc" ], "elfutils-native", "", d)}'
> > > > > >  DEPENDS += "openssl-native util-linux-native"
> > > > > >  DEPENDS += "gmp-native libmpc-native"
> > > > > > +RUST_KERNEL_DEPENDS ?=
> > > > > > "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
> > > > > > 'clang-native rust-native bindgen-cli-native', '', d)}"
> > > > > > +DEPENDS += "${RUST_KERNEL_DEPENDS}"
> > > > > > 
> > > > > >  # Some options depend on CONFIG_PAHOLE_VERSION, so need to
> > > > > > make pahole-native available before do_kernel_configme
> > > > > >  do_kernel_configme[depends] +=
> > > > > > '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-
> > > > > > native:do_populate_sysroot", "", d)}'
> > > > > >  
> > > > >  
> > > > > I thought we were going to try and use KERNEL_FEATURES for
> > > > > this?
> > > > >  
> > > >  Hi Richard,
> > > >  
> > > >  I have tried this but i got circular dependency error with
> > > > KERNEL_FEATURES. So, I opted using variable
> > > > KERNEL_RUST_SUPPORT.
> > > >  
> > > > 
> > >  
> > > 
> > >  
> > >  
> > >  
> > > I'm curious about that. Can you share the details ? (diff and the
> > > bitbake error)
> > >  
> > >  
> > >  
> > >  
> > >  
> > >  
> >  
> >  As discussed previously, I attempted to use the following in
> > meta/recipes-kernel/linux/linux-yocto_6.18.bb:
> >  
> >  KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES',
> > 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
> >  
> >  This resulted in a BitBake variable dependency chain failure. The
> > issue occurs because the expression is trying to read
> > KERNEL_FEATURES 
> >  while simultaneously modifying KERNEL_FEATURES, which creates a
> > circular dependency.
> > 
> 
> 
> Yes, that's clearly not going to work, but that wouldn't have been
> the suggestion.
> 
> Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS based on
> the KERNEL_FEATURES containing rust.scc ?

Yes, along with maybe with a tweak to the KERNEL_FEATURES code which
could expand " rust " or maybe " kernel-rust "in KERNEL_FEATURES into
"features/kernel-rust/kernel-rust.scc" too just so there was a nice
short cut for it?

Cheers,

Richard





^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-09 19:20             ` Richard Purdie
@ 2026-03-10 10:57               ` Harish Sadineni
  2026-03-10 12:44                 ` Bruce Ashfield
  0 siblings, 1 reply; 27+ messages in thread
From: Harish Sadineni @ 2026-03-10 10:57 UTC (permalink / raw)
  To: Richard Purdie, Bruce Ashfield
  Cc: openembedded-core, Randy.MacLeod, Sundeep.Kokkonda, paul,
	yoann.congal


On 3/10/2026 12:50 AM, Richard Purdie wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, 2026-03-09 at 14:01 -0400, Bruce Ashfield wrote:
>>
>>
>> On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni
>> <Harish.Sadineni@windriver.com> wrote:
>>>
>>>
>>>
>>>
>>> On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
>>>
>>>
>>>> CAUTION: This email comes from a non Wind River email account!
>>>>   Do not click links or open attachments unless you recognize the
>>>> sender and know the content is safe.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni
>>>> <Harish.Sadineni@windriver.com> wrote:
>>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 3/9/2026 4:56 PM, Richard Purdie wrote:
>>>>>
>>>>>
>>>>>> CAUTION: This email comes from a non Wind River email
>>>>>> account!
>>>>>> Do not click links or open attachments unless you recognize
>>>>>> the sender and know the content is safe.
>>>>>>
>>>>>> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via
>>>>>> lists.openembedded.org wrote:
>>>>>>
>>>>>>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>>>>>>>
>>>>>>> Conditionally add 'clang-native', 'rust-native' and
>>>>>>> 'bindgen-cli-native' to 'DEPENDS'
>>>>>>> when Kernel Rust Support is enabled.
>>>>>>>
>>>>>>> These tools are required for building Rust-enabled kernels
>>>>>>> and for
>>>>>>> generating Rust FFI bindings via bindgen during the kernel
>>>>>>> build.
>>>>>>>
>>>>>>> This ensures the additional dependencies are only pulled in
>>>>>>> when
>>>>>>> Rust support is explicitly enabled, avoiding unnecessary
>>>>>>> native
>>>>>>> dependencies for non-Rust kernel builds.
>>>>>>>
>>>>>>> Signed-off-by: Harish Sadineni
>>>>>>> <Harish.Sadineni@windriver.com>
>>>>>>> ---
>>>>>>>   meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>>>>>>>   1 file changed, 3 insertions(+)
>>>>>>>
>>>>>>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
>>>>>>> b/meta/recipes-kernel/linux/linux-yocto.inc
>>>>>>> index 4d0a726bb6..b7961bbcdf 100644
>>>>>>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>>>>>>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>>>>>>> @@ -76,11 +76,14 @@ do_install:append(){
>>>>>>>   KERNEL_FEATURES:append:qemuall = " features/kernel-
>>>>>>> sample/kernel-sample.scc"
>>>>>>>
>>>>>>>   KERNEL_DEBUG ?= ""
>>>>>>> +KERNEL_RUST_SUPPORT ?= ""
>>>>>>>   # These used to be version specific, but are now common
>>>>>>> dependencies.  New
>>>>>>>   # tools / dependencies will continue to be added in
>>>>>>> version specific recipes.
>>>>>>>   DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86",
>>>>>>> "arm64", "powerpc" ], "elfutils-native", "", d)}'
>>>>>>>   DEPENDS += "openssl-native util-linux-native"
>>>>>>>   DEPENDS += "gmp-native libmpc-native"
>>>>>>> +RUST_KERNEL_DEPENDS ?=
>>>>>>> "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
>>>>>>> 'clang-native rust-native bindgen-cli-native', '', d)}"
>>>>>>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>>>>>>>
>>>>>>>   # Some options depend on CONFIG_PAHOLE_VERSION, so need to
>>>>>>> make pahole-native available before do_kernel_configme
>>>>>>>   do_kernel_configme[depends] +=
>>>>>>> '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-
>>>>>>> native:do_populate_sysroot", "", d)}'
>>>>>>>
>>>>>> I thought we were going to try and use KERNEL_FEATURES for
>>>>>> this?
>>>>>>
>>>>>   Hi Richard,
>>>>>
>>>>>   I have tried this but i got circular dependency error with
>>>>> KERNEL_FEATURES. So, I opted using variable
>>>>> KERNEL_RUST_SUPPORT.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> I'm curious about that. Can you share the details ? (diff and the
>>>> bitbake error)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>   As discussed previously, I attempted to use the following in
>>> meta/recipes-kernel/linux/linux-yocto_6.18.bb:
>>>
>>>   KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES',
>>> 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
>>>
>>>   This resulted in a BitBake variable dependency chain failure. The
>>> issue occurs because the expression is trying to read
>>> KERNEL_FEATURES
>>>   while simultaneously modifying KERNEL_FEATURES, which creates a
>>> circular dependency.
>>>
>>
>> Yes, that's clearly not going to work, but that wouldn't have been
>> the suggestion.
>>
>> Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS based on
>> the KERNEL_FEATURES containing rust.scc ?
We understood like Richard suggestion is to use KERNEL_FEATURES 
everywhere instead of KERNEL_RUST_SUPPORT variable.

We can use the KERNEL_RUST_SUPPORT variable to append rust.scc to 
KERNEL_FEATURES and then we could make other checks depends on 
KERNEL_FEATURES.
But as the other recipes (make-mod-scripts, kernel-devsrc, 
module-rust.bbclass) do not know about KERNEL_FEATURES, so again we've 
to depend on KERNEL_RUST_SUPPORT Variable.

So, for consistency we used everywhere KERNEL_RUST_SUPPORT.

Is this implementation ok or we should switch to use -
KERNEL_FEATURES in kernel recipes and
KERNEL_RUST_SUPPORT in other recipes.

Thanks,
Harish
> Yes, along with maybe with a tweak to the KERNEL_FEATURES code which
> could expand " rust " or maybe " kernel-rust "in KERNEL_FEATURES into
> "features/kernel-rust/kernel-rust.scc" too just so there was a nice
> short cut for it?
>
> Cheers,
>
> Richard
>
>
>


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-10 10:57               ` Harish Sadineni
@ 2026-03-10 12:44                 ` Bruce Ashfield
  2026-03-10 13:30                   ` Harish Sadineni
  0 siblings, 1 reply; 27+ messages in thread
From: Bruce Ashfield @ 2026-03-10 12:44 UTC (permalink / raw)
  To: Harish Sadineni
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 6496 bytes --]

On Tue, Mar 10, 2026 at 6:58 AM Harish Sadineni <
Harish.Sadineni@windriver.com> wrote:

>
> On 3/10/2026 12:50 AM, Richard Purdie wrote:
> > CAUTION: This email comes from a non Wind River email account!
> > Do not click links or open attachments unless you recognize the sender
> and know the content is safe.
> >
> > On Mon, 2026-03-09 at 14:01 -0400, Bruce Ashfield wrote:
> >>
> >>
> >> On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni
> >> <Harish.Sadineni@windriver.com> wrote:
> >>>
> >>>
> >>>
> >>>
> >>> On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
> >>>
> >>>
> >>>> CAUTION: This email comes from a non Wind River email account!
> >>>>   Do not click links or open attachments unless you recognize the
> >>>> sender and know the content is safe.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni
> >>>> <Harish.Sadineni@windriver.com> wrote:
> >>>>
> >>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> On 3/9/2026 4:56 PM, Richard Purdie wrote:
> >>>>>
> >>>>>
> >>>>>> CAUTION: This email comes from a non Wind River email
> >>>>>> account!
> >>>>>> Do not click links or open attachments unless you recognize
> >>>>>> the sender and know the content is safe.
> >>>>>>
> >>>>>> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via
> >>>>>> lists.openembedded.org wrote:
> >>>>>>
> >>>>>>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
> >>>>>>>
> >>>>>>> Conditionally add 'clang-native', 'rust-native' and
> >>>>>>> 'bindgen-cli-native' to 'DEPENDS'
> >>>>>>> when Kernel Rust Support is enabled.
> >>>>>>>
> >>>>>>> These tools are required for building Rust-enabled kernels
> >>>>>>> and for
> >>>>>>> generating Rust FFI bindings via bindgen during the kernel
> >>>>>>> build.
> >>>>>>>
> >>>>>>> This ensures the additional dependencies are only pulled in
> >>>>>>> when
> >>>>>>> Rust support is explicitly enabled, avoiding unnecessary
> >>>>>>> native
> >>>>>>> dependencies for non-Rust kernel builds.
> >>>>>>>
> >>>>>>> Signed-off-by: Harish Sadineni
> >>>>>>> <Harish.Sadineni@windriver.com>
> >>>>>>> ---
> >>>>>>>   meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
> >>>>>>>   1 file changed, 3 insertions(+)
> >>>>>>>
> >>>>>>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
> >>>>>>> b/meta/recipes-kernel/linux/linux-yocto.inc
> >>>>>>> index 4d0a726bb6..b7961bbcdf 100644
> >>>>>>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> >>>>>>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> >>>>>>> @@ -76,11 +76,14 @@ do_install:append(){
> >>>>>>>   KERNEL_FEATURES:append:qemuall = " features/kernel-
> >>>>>>> sample/kernel-sample.scc"
> >>>>>>>
> >>>>>>>   KERNEL_DEBUG ?= ""
> >>>>>>> +KERNEL_RUST_SUPPORT ?= ""
> >>>>>>>   # These used to be version specific, but are now common
> >>>>>>> dependencies.  New
> >>>>>>>   # tools / dependencies will continue to be added in
> >>>>>>> version specific recipes.
> >>>>>>>   DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86",
> >>>>>>> "arm64", "powerpc" ], "elfutils-native", "", d)}'
> >>>>>>>   DEPENDS += "openssl-native util-linux-native"
> >>>>>>>   DEPENDS += "gmp-native libmpc-native"
> >>>>>>> +RUST_KERNEL_DEPENDS ?=
> >>>>>>> "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
> >>>>>>> 'clang-native rust-native bindgen-cli-native', '', d)}"
> >>>>>>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
> >>>>>>>
> >>>>>>>   # Some options depend on CONFIG_PAHOLE_VERSION, so need to
> >>>>>>> make pahole-native available before do_kernel_configme
> >>>>>>>   do_kernel_configme[depends] +=
> >>>>>>> '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-
> >>>>>>> native:do_populate_sysroot", "", d)}'
> >>>>>>>
> >>>>>> I thought we were going to try and use KERNEL_FEATURES for
> >>>>>> this?
> >>>>>>
> >>>>>   Hi Richard,
> >>>>>
> >>>>>   I have tried this but i got circular dependency error with
> >>>>> KERNEL_FEATURES. So, I opted using variable
> >>>>> KERNEL_RUST_SUPPORT.
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> I'm curious about that. Can you share the details ? (diff and the
> >>>> bitbake error)
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>   As discussed previously, I attempted to use the following in
> >>> meta/recipes-kernel/linux/linux-yocto_6.18.bb:
> >>>
> >>>   KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES',
> >>> 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
> >>>
> >>>   This resulted in a BitBake variable dependency chain failure. The
> >>> issue occurs because the expression is trying to read
> >>> KERNEL_FEATURES
> >>>   while simultaneously modifying KERNEL_FEATURES, which creates a
> >>> circular dependency.
> >>>
> >>
> >> Yes, that's clearly not going to work, but that wouldn't have been
> >> the suggestion.
> >>
> >> Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS based on
> >> the KERNEL_FEATURES containing rust.scc ?
> We understood like Richard suggestion is to use KERNEL_FEATURES
> everywhere instead of KERNEL_RUST_SUPPORT variable.
>
> We can use the KERNEL_RUST_SUPPORT variable to append rust.scc to
> KERNEL_FEATURES and then we could make other checks depends on
> KERNEL_FEATURES.
> But as the other recipes (make-mod-scripts, kernel-devsrc,
> module-rust.bbclass) do not know about KERNEL_FEATURES, so again we've
> to depend on KERNEL_RUST_SUPPORT Variable.
>

I'm curious as to what you think is different about KERNEL_RUST_SUPPORT
and KERNEL_FEATURES as variables ?

They are both defined in the kernel recipe namespace, so any limitations
about
the visibility of one, is true about the other.

or am I missing something ?

Bruce


>
> So, for consistency we used everywhere KERNEL_RUST_SUPPORT.
>
> Is this implementation ok or we should switch to use -
> KERNEL_FEATURES in kernel recipes and
> KERNEL_RUST_SUPPORT in other recipes.
>
> Thanks,
> Harish
> > Yes, along with maybe with a tweak to the KERNEL_FEATURES code which
> > could expand " rust " or maybe " kernel-rust "in KERNEL_FEATURES into
> > "features/kernel-rust/kernel-rust.scc" too just so there was a nice
> > short cut for it?
> >
> > Cheers,
> >
> > Richard
> >
> >
> >
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 11034 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-10 12:44                 ` Bruce Ashfield
@ 2026-03-10 13:30                   ` Harish Sadineni
  2026-03-10 13:40                     ` Bruce Ashfield
  0 siblings, 1 reply; 27+ messages in thread
From: Harish Sadineni @ 2026-03-10 13:30 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 9082 bytes --]


On 3/10/2026 6:14 PM, Bruce Ashfield wrote:
> **
> *CAUTION: This email comes from a non Wind River email account!*
> Do not click links or open attachments unless you recognize the sender 
> and know the content is safe.
>
>
> On Tue, Mar 10, 2026 at 6:58 AM Harish Sadineni 
> <Harish.Sadineni@windriver.com> wrote:
>
>
>     On 3/10/2026 12:50 AM, Richard Purdie wrote:
>     > CAUTION: This email comes from a non Wind River email account!
>     > Do not click links or open attachments unless you recognize the
>     sender and know the content is safe.
>     >
>     > On Mon, 2026-03-09 at 14:01 -0400, Bruce Ashfield wrote:
>     >>
>     >>
>     >> On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni
>     >> <Harish.Sadineni@windriver.com> wrote:
>     >>>
>     >>>
>     >>>
>     >>>
>     >>> On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
>     >>>
>     >>>
>     >>>> CAUTION: This email comes from a non Wind River email account!
>     >>>>   Do not click links or open attachments unless you recognize the
>     >>>> sender and know the content is safe.
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni
>     >>>> <Harish.Sadineni@windriver.com> wrote:
>     >>>>
>     >>>>
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>>
>     >>>>> On 3/9/2026 4:56 PM, Richard Purdie wrote:
>     >>>>>
>     >>>>>
>     >>>>>> CAUTION: This email comes from a non Wind River email
>     >>>>>> account!
>     >>>>>> Do not click links or open attachments unless you recognize
>     >>>>>> the sender and know the content is safe.
>     >>>>>>
>     >>>>>> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via
>     >>>>>> lists.openembedded.org
>     <https://urldefense.com/v3/__http://lists.openembedded.org__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8am36JgQ$>
>     wrote:
>     >>>>>>
>     >>>>>>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>     >>>>>>>
>     >>>>>>> Conditionally add 'clang-native', 'rust-native' and
>     >>>>>>> 'bindgen-cli-native' to 'DEPENDS'
>     >>>>>>> when Kernel Rust Support is enabled.
>     >>>>>>>
>     >>>>>>> These tools are required for building Rust-enabled kernels
>     >>>>>>> and for
>     >>>>>>> generating Rust FFI bindings via bindgen during the kernel
>     >>>>>>> build.
>     >>>>>>>
>     >>>>>>> This ensures the additional dependencies are only pulled in
>     >>>>>>> when
>     >>>>>>> Rust support is explicitly enabled, avoiding unnecessary
>     >>>>>>> native
>     >>>>>>> dependencies for non-Rust kernel builds.
>     >>>>>>>
>     >>>>>>> Signed-off-by: Harish Sadineni
>     >>>>>>> <Harish.Sadineni@windriver.com>
>     >>>>>>> ---
>     >>>>>>>   meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>     | 3 +++
>     >>>>>>>   1 file changed, 3 insertions(+)
>     >>>>>>>
>     >>>>>>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>     >>>>>>> b/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>     >>>>>>> index 4d0a726bb6..b7961bbcdf 100644
>     >>>>>>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>     >>>>>>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>     >>>>>>> @@ -76,11 +76,14 @@ do_install:append(){
>     >>>>>>>  KERNEL_FEATURES:append:qemuall = " features/kernel-
>     >>>>>>> sample/kernel-sample.scc"
>     >>>>>>>
>     >>>>>>>   KERNEL_DEBUG ?= ""
>     >>>>>>> +KERNEL_RUST_SUPPORT ?= ""
>     >>>>>>>   # These used to be version specific, but are now common
>     >>>>>>> dependencies.  New
>     >>>>>>>   # tools / dependencies will continue to be added in
>     >>>>>>> version specific recipes.
>     >>>>>>>   DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86",
>     >>>>>>> "arm64", "powerpc" ], "elfutils-native", "", d)}'
>     >>>>>>>   DEPENDS += "openssl-native util-linux-native"
>     >>>>>>>   DEPENDS += "gmp-native libmpc-native"
>     >>>>>>> +RUST_KERNEL_DEPENDS ?=
>     >>>>>>> "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
>     >>>>>>> 'clang-native rust-native bindgen-cli-native', '', d)}"
>     >>>>>>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>     >>>>>>>
>     >>>>>>>   # Some options depend on CONFIG_PAHOLE_VERSION, so need to
>     >>>>>>> make pahole-native available before do_kernel_configme
>     >>>>>>>   do_kernel_configme[depends] +=
>     >>>>>>> '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-
>     >>>>>>> native:do_populate_sysroot", "", d)}'
>     >>>>>>>
>     >>>>>> I thought we were going to try and use KERNEL_FEATURES for
>     >>>>>> this?
>     >>>>>>
>     >>>>>   Hi Richard,
>     >>>>>
>     >>>>>   I have tried this but i got circular dependency error with
>     >>>>> KERNEL_FEATURES. So, I opted using variable
>     >>>>> KERNEL_RUST_SUPPORT.
>     >>>>>
>     >>>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>> I'm curious about that. Can you share the details ? (diff and the
>     >>>> bitbake error)
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>   As discussed previously, I attempted to use the following in
>     >>> meta/recipes-kernel/linux/linux-yocto_6.18.bb
>     <https://urldefense.com/v3/__http://linux-yocto_6.18.bb__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8cBMffSY$>:
>     >>>
>     >>>   KERNEL_FEATURES:append = "
>     ${@bb.utils.contains('KERNEL_FEATURES',
>     >>> 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
>     >>>
>     >>>   This resulted in a BitBake variable dependency chain
>     failure. The
>     >>> issue occurs because the expression is trying to read
>     >>> KERNEL_FEATURES
>     >>>   while simultaneously modifying KERNEL_FEATURES, which creates a
>     >>> circular dependency.
>     >>>
>     >>
>     >> Yes, that's clearly not going to work, but that wouldn't have been
>     >> the suggestion.
>     >>
>     >> Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS
>     based on
>     >> the KERNEL_FEATURES containing rust.scc ?
>     We understood like Richard suggestion is to use KERNEL_FEATURES
>     everywhere instead of KERNEL_RUST_SUPPORT variable.
>
>     We can use the KERNEL_RUST_SUPPORT variable to append rust.scc to
>     KERNEL_FEATURES and then we could make other checks depends on
>     KERNEL_FEATURES.
>     But as the other recipes (make-mod-scripts, kernel-devsrc,
>     module-rust.bbclass) do not know about KERNEL_FEATURES, so again
>     we've
>     to depend on KERNEL_RUST_SUPPORT Variable.
>
>
> I'm curious as to what you think is different about KERNEL_RUST_SUPPORT
> and KERNEL_FEATURES as variables ?
There is no difference i guess.
>
> They are both defined in the kernel recipe namespace, so any 
> limitations about
> the visibility of one, is true about the other.

We will set KERNEL_RUST_SUPPORT = "true" in local.conf, so it is 
globally visible.
In contrast, KERNEL_FEATURES is conditionally set based on 
KERNEL_RUST_SUPPORT inside the kernel recipe,
meaning its value is only determined at the recipe level and not 
accessible elsewhere.

Thanks,
Harish
>
> or am I missing something ?
>
> Bruce
>
>
>     So, for consistency we used everywhere KERNEL_RUST_SUPPORT.
>
>     Is this implementation ok or we should switch to use -
>     KERNEL_FEATURES in kernel recipes and
>     KERNEL_RUST_SUPPORT in other recipes.
>
>     Thanks,
>     Harish
>     > Yes, along with maybe with a tweak to the KERNEL_FEATURES code which
>     > could expand " rust " or maybe " kernel-rust "in KERNEL_FEATURES
>     into
>     > "features/kernel-rust/kernel-rust.scc" too just so there was a nice
>     > short cut for it?
>     >
>     > Cheers,
>     >
>     > Richard
>     >
>     >
>     >
>
>
>
> -- 
> - Thou shalt not follow the NULL pointer, for chaos and madness await 
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>

[-- Attachment #2: Type: text/html, Size: 18830 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-10 13:30                   ` Harish Sadineni
@ 2026-03-10 13:40                     ` Bruce Ashfield
  0 siblings, 0 replies; 27+ messages in thread
From: Bruce Ashfield @ 2026-03-10 13:40 UTC (permalink / raw)
  To: Harish Sadineni
  Cc: Richard Purdie, openembedded-core, Randy.MacLeod,
	Sundeep.Kokkonda, paul, yoann.congal

[-- Attachment #1: Type: text/plain, Size: 8967 bytes --]

On Tue, Mar 10, 2026 at 9:30 AM Harish Sadineni <
Harish.Sadineni@windriver.com> wrote:

>
> On 3/10/2026 6:14 PM, Bruce Ashfield wrote:
>
> *CAUTION: This email comes from a non Wind River email account!*
> Do not click links or open attachments unless you recognize the sender and
> know the content is safe.
>
>
> On Tue, Mar 10, 2026 at 6:58 AM Harish Sadineni <
> Harish.Sadineni@windriver.com> wrote:
>
>>
>> On 3/10/2026 12:50 AM, Richard Purdie wrote:
>> > CAUTION: This email comes from a non Wind River email account!
>> > Do not click links or open attachments unless you recognize the sender
>> and know the content is safe.
>> >
>> > On Mon, 2026-03-09 at 14:01 -0400, Bruce Ashfield wrote:
>> >>
>> >>
>> >> On Mon, Mar 9, 2026 at 12:54 PM Harish Sadineni
>> >> <Harish.Sadineni@windriver.com> wrote:
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On 3/9/2026 9:59 PM, Bruce Ashfield wrote:
>> >>>
>> >>>
>> >>>> CAUTION: This email comes from a non Wind River email account!
>> >>>>   Do not click links or open attachments unless you recognize the
>> >>>> sender and know the content is safe.
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni
>> >>>> <Harish.Sadineni@windriver.com> wrote:
>> >>>>
>> >>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On 3/9/2026 4:56 PM, Richard Purdie wrote:
>> >>>>>
>> >>>>>
>> >>>>>> CAUTION: This email comes from a non Wind River email
>> >>>>>> account!
>> >>>>>> Do not click links or open attachments unless you recognize
>> >>>>>> the sender and know the content is safe.
>> >>>>>>
>> >>>>>> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via
>> >>>>>> lists.openembedded.org
>> <https://urldefense.com/v3/__http://lists.openembedded.org__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8am36JgQ$>
>> wrote:
>> >>>>>>
>> >>>>>>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>> >>>>>>>
>> >>>>>>> Conditionally add 'clang-native', 'rust-native' and
>> >>>>>>> 'bindgen-cli-native' to 'DEPENDS'
>> >>>>>>> when Kernel Rust Support is enabled.
>> >>>>>>>
>> >>>>>>> These tools are required for building Rust-enabled kernels
>> >>>>>>> and for
>> >>>>>>> generating Rust FFI bindings via bindgen during the kernel
>> >>>>>>> build.
>> >>>>>>>
>> >>>>>>> This ensures the additional dependencies are only pulled in
>> >>>>>>> when
>> >>>>>>> Rust support is explicitly enabled, avoiding unnecessary
>> >>>>>>> native
>> >>>>>>> dependencies for non-Rust kernel builds.
>> >>>>>>>
>> >>>>>>> Signed-off-by: Harish Sadineni
>> >>>>>>> <Harish.Sadineni@windriver.com>
>> >>>>>>> ---
>> >>>>>>>   meta/recipes-kernel/linux/linux-yocto.inc
>> <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>> | 3 +++
>> >>>>>>>   1 file changed, 3 insertions(+)
>> >>>>>>>
>> >>>>>>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
>> <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>> >>>>>>> b/meta/recipes-kernel/linux/linux-yocto.inc
>> <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>> >>>>>>> index 4d0a726bb6..b7961bbcdf 100644
>> >>>>>>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>> <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>> >>>>>>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>> <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8KLPsVX0$>
>> >>>>>>> @@ -76,11 +76,14 @@ do_install:append(){
>> >>>>>>>   KERNEL_FEATURES:append:qemuall = " features/kernel-
>> >>>>>>> sample/kernel-sample.scc"
>> >>>>>>>
>> >>>>>>>   KERNEL_DEBUG ?= ""
>> >>>>>>> +KERNEL_RUST_SUPPORT ?= ""
>> >>>>>>>   # These used to be version specific, but are now common
>> >>>>>>> dependencies.  New
>> >>>>>>>   # tools / dependencies will continue to be added in
>> >>>>>>> version specific recipes.
>> >>>>>>>   DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86",
>> >>>>>>> "arm64", "powerpc" ], "elfutils-native", "", d)}'
>> >>>>>>>   DEPENDS += "openssl-native util-linux-native"
>> >>>>>>>   DEPENDS += "gmp-native libmpc-native"
>> >>>>>>> +RUST_KERNEL_DEPENDS ?=
>> >>>>>>> "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True',
>> >>>>>>> 'clang-native rust-native bindgen-cli-native', '', d)}"
>> >>>>>>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>> >>>>>>>
>> >>>>>>>   # Some options depend on CONFIG_PAHOLE_VERSION, so need to
>> >>>>>>> make pahole-native available before do_kernel_configme
>> >>>>>>>   do_kernel_configme[depends] +=
>> >>>>>>> '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-
>> >>>>>>> native:do_populate_sysroot", "", d)}'
>> >>>>>>>
>> >>>>>> I thought we were going to try and use KERNEL_FEATURES for
>> >>>>>> this?
>> >>>>>>
>> >>>>>   Hi Richard,
>> >>>>>
>> >>>>>   I have tried this but i got circular dependency error with
>> >>>>> KERNEL_FEATURES. So, I opted using variable
>> >>>>> KERNEL_RUST_SUPPORT.
>> >>>>>
>> >>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> I'm curious about that. Can you share the details ? (diff and the
>> >>>> bitbake error)
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>   As discussed previously, I attempted to use the following in
>> >>> meta/recipes-kernel/linux/linux-yocto_6.18.bb
>> <https://urldefense.com/v3/__http://linux-yocto_6.18.bb__;!!AjveYdw8EvQ!ekkiIdFR1oUUFgkUmXVgRrlc4N10osQLVSoHUP7tqKnyuU2FDh5UdcpyUkPIW6qIyPNmuAqUaeJv3wtCoY4XeJd8cBMffSY$>
>> :
>> >>>
>> >>>   KERNEL_FEATURES:append = " ${@bb.utils.contains('KERNEL_FEATURES',
>> >>> 'rust-kernel', ' features/kernel-rust/kernel-rust.scc', '', d)}"
>> >>>
>> >>>   This resulted in a BitBake variable dependency chain failure. The
>> >>> issue occurs because the expression is trying to read
>> >>> KERNEL_FEATURES
>> >>>   while simultaneously modifying KERNEL_FEATURES, which creates a
>> >>> circular dependency.
>> >>>
>> >>
>> >> Yes, that's clearly not going to work, but that wouldn't have been
>> >> the suggestion.
>> >>
>> >> Wasn't Richard asking about setting the RUST_KERNEL_DEPENDS based on
>> >> the KERNEL_FEATURES containing rust.scc ?
>> We understood like Richard suggestion is to use KERNEL_FEATURES
>> everywhere instead of KERNEL_RUST_SUPPORT variable.
>>
>> We can use the KERNEL_RUST_SUPPORT variable to append rust.scc to
>> KERNEL_FEATURES and then we could make other checks depends on
>> KERNEL_FEATURES.
>> But as the other recipes (make-mod-scripts, kernel-devsrc,
>> module-rust.bbclass) do not know about KERNEL_FEATURES, so again we've
>> to depend on KERNEL_RUST_SUPPORT Variable.
>>
>
> I'm curious as to what you think is different about KERNEL_RUST_SUPPORT
> and KERNEL_FEATURES as variables ?
>
> There is no difference i guess.
>
>
> They are both defined in the kernel recipe namespace, so any limitations
> about
> the visibility of one, is true about the other.
>
>
> We will set KERNEL_RUST_SUPPORT = "true" in local.conf, so it is globally
> visible.
>

And of course a feature can't count on something being set in local.conf,
it must be a variable that users need to set in their distro or other
similarly
global configuration.

Bruce



>
> In contrast, KERNEL_FEATURES is conditionally set based on
> KERNEL_RUST_SUPPORT inside the kernel recipe,
> meaning its value is only determined at the recipe level and not
> accessible elsewhere.
>
> Thanks,
> Harish
>
>
> or am I missing something ?
>
> Bruce
>
>
>>
>> So, for consistency we used everywhere KERNEL_RUST_SUPPORT.
>>
>> Is this implementation ok or we should switch to use -
>> KERNEL_FEATURES in kernel recipes and
>> KERNEL_RUST_SUPPORT in other recipes.
>>
>> Thanks,
>> Harish
>> > Yes, along with maybe with a tweak to the KERNEL_FEATURES code which
>> > could expand " rust " or maybe " kernel-rust "in KERNEL_FEATURES into
>> > "features/kernel-rust/kernel-rust.scc" too just so there was a nice
>> > short cut for it?
>> >
>> > Cheers,
>> >
>> > Richard
>> >
>> >
>> >
>>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await thee
> at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
>

-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 19198 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
  2026-03-09 11:26   ` [OE-core] " Richard Purdie
@ 2026-03-12 13:34   ` Richard Purdie
  2026-03-12 22:21     ` Yoann Congal
  1 sibling, 1 reply; 27+ messages in thread
From: Richard Purdie @ 2026-03-12 13:34 UTC (permalink / raw)
  To: Harish.Sadineni, openembedded-core, Bruce Ashfield
  Cc: Randy.MacLeod, Sundeep.Kokkonda, paul, yoann.congal

On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
> 
> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
> when Kernel Rust Support is enabled.
> 
> These tools are required for building Rust-enabled kernels and for
> generating Rust FFI bindings via bindgen during the kernel build.
> 
> This ensures the additional dependencies are only pulled in when
> Rust support is explicitly enabled, avoiding unnecessary native
> dependencies for non-Rust kernel builds.
> 
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
> index 4d0a726bb6..b7961bbcdf 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -76,11 +76,14 @@ do_install:append(){
>  KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>  
>  KERNEL_DEBUG ?= ""
> +KERNEL_RUST_SUPPORT ?= ""
>  # These used to be version specific, but are now common dependencies.  New
>  # tools / dependencies will continue to be added in version specific recipes.
>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>  DEPENDS += "openssl-native util-linux-native"
>  DEPENDS += "gmp-native libmpc-native"
> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}"
> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>  
>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'

I get the feeling we're still not quite agreeing on how to make the
enabling of the feature work. I'm suggesting we do something like this:

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e53bf151941..9cc7568ab09 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -269,6 +269,9 @@ do_kernel_metadata() {
        KERNEL_FEATURES_FINAL=""
        if [ -n "${KERNEL_FEATURES}" ]; then
                for feature in ${KERNEL_FEATURES}; do
+                        if [ "$feature" = "rust" ]; then
+                                feature="features/kernel-rust/kernel-rust.scc"
+                        fi
                        feature_as_specified="$feature"
                        feature="$(echo $feature_as_specified | cut -d: -f1)"
                        feature_specifier="$(echo $feature_as_specified | cut -d: -f2)"

which means you can then simply add to your config:

KERNEL_FEATURES += "rust"

and things should be enabled. This patch would then become:

RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_FEATURES', 'rust', 'clang-native rust-native bindgen-cli-native', '', d)}"

Is there some reason we can't do something like this?

Cheers,

Richard




^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
  2026-03-12 13:34   ` Richard Purdie
@ 2026-03-12 22:21     ` Yoann Congal
  0 siblings, 0 replies; 27+ messages in thread
From: Yoann Congal @ 2026-03-12 22:21 UTC (permalink / raw)
  To: Richard Purdie, Harish.Sadineni, openembedded-core,
	Bruce Ashfield
  Cc: Randy.MacLeod, Sundeep.Kokkonda, paul

On Thu Mar 12, 2026 at 2:34 PM CET, Richard Purdie wrote:
> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>> 
>> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
>> when Kernel Rust Support is enabled.
>> 
>> These tools are required for building Rust-enabled kernels and for
>> generating Rust FFI bindings via bindgen during the kernel build.
>> 
>> This ensures the additional dependencies are only pulled in when
>> Rust support is explicitly enabled, avoiding unnecessary native
>> dependencies for non-Rust kernel builds.
>> 
>> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
>> ---
>>  meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
>> index 4d0a726bb6..b7961bbcdf 100644
>> --- a/meta/recipes-kernel/linux/linux-yocto.inc
>> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>> @@ -76,11 +76,14 @@ do_install:append(){
>>  KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>>  
>>  KERNEL_DEBUG ?= ""
>> +KERNEL_RUST_SUPPORT ?= ""
>>  # These used to be version specific, but are now common dependencies.  New
>>  # tools / dependencies will continue to be added in version specific recipes.
>>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
>>  DEPENDS += "openssl-native util-linux-native"
>>  DEPENDS += "gmp-native libmpc-native"
>> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}"
>> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>>  
>>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
>>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'
>
> I get the feeling we're still not quite agreeing on how to make the
> enabling of the feature work. I'm suggesting we do something like this:
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
> index e53bf151941..9cc7568ab09 100644
> --- a/meta/classes-recipe/kernel-yocto.bbclass
> +++ b/meta/classes-recipe/kernel-yocto.bbclass
> @@ -269,6 +269,9 @@ do_kernel_metadata() {
>         KERNEL_FEATURES_FINAL=""
>         if [ -n "${KERNEL_FEATURES}" ]; then
>                 for feature in ${KERNEL_FEATURES}; do
> +                        if [ "$feature" = "rust" ]; then
> +                                feature="features/kernel-rust/kernel-rust.scc"
> +                        fi
>                         feature_as_specified="$feature"
>                         feature="$(echo $feature_as_specified | cut -d: -f1)"
>                         feature_specifier="$(echo $feature_as_specified | cut -d: -f2)"
>
> which means you can then simply add to your config:
>
> KERNEL_FEATURES += "rust"
>
> and things should be enabled. This patch would then become:
>
> RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_FEATURES', 'rust', 'clang-native rust-native bindgen-cli-native', '', d)}"
>
> Is there some reason we can't do something like this?

I did try and it worked: See "TO SQUASH: switch linux-yocto rust enabling to KERNEL_FEATURES"
https://git.openembedded.org/openembedded-core-contrib/commit/?h=ycongal/master/kernel-rust&id=17d4d7979e9bcf3a1c56c37357940a802a0ff570

Harish, while you rebase over the recently merged rust upgrade. Can you
look at this suggestion and see if that work for you? If you like it
(and I hope you do), please squash it in the right commits of your
series.

Regards,

>
> Cheers,
>
> Richard


-- 
Yoann Congal
Smile ECS



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2026-03-12 22:21 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
2026-03-09 11:26   ` [OE-core] " Richard Purdie
2026-03-09 16:09     ` Harish Sadineni
2026-03-09 16:29       ` Bruce Ashfield
2026-03-09 16:53         ` Harish Sadineni
2026-03-09 18:01           ` Bruce Ashfield
2026-03-09 19:20             ` Richard Purdie
2026-03-10 10:57               ` Harish Sadineni
2026-03-10 12:44                 ` Bruce Ashfield
2026-03-10 13:30                   ` Harish Sadineni
2026-03-10 13:40                     ` Bruce Ashfield
2026-03-12 13:34   ` Richard Purdie
2026-03-12 22:21     ` Yoann Congal
2026-03-04 17:43 ` [PATCH v7 02/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 03/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 04/14] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox