* [PATCH v9 01/14] kernel-yocto: Enable rust in kernel
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 16:07 ` Bruce Ashfield
2026-03-13 15:59 ` [PATCH v9 02/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
` (12 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
From: Harish Sadineni <Harish.Sadineni@windriver.com>
Allow enabling Rust support in the kernel by simply adding "rust" to
KERNEL_FEATURES in local.conf or a global configuration file. This maps the
feature name to the appropriate kernel configuration fragment located
at features/kernel-rust/kernel-rust.scc
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/classes-recipe/kernel-yocto.bbclass | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e53bf15194..a77f2214c2 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)"
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v9 01/14] kernel-yocto: Enable rust in kernel
2026-03-13 15:59 ` [PATCH v9 01/14] kernel-yocto: Enable rust in kernel Harish.Sadineni
@ 2026-03-13 16:07 ` Bruce Ashfield
0 siblings, 0 replies; 18+ messages in thread
From: Bruce Ashfield @ 2026-03-13 16:07 UTC (permalink / raw)
To: Harish.Sadineni
Cc: openembedded-core, Randy.MacLeod, Sundeep.Kokkonda, yoann.congal,
richard.purdie
[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]
On Fri, Mar 13, 2026 at 11:59 AM <Harish.Sadineni@windriver.com> wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> Allow enabling Rust support in the kernel by simply adding "rust" to
> KERNEL_FEATURES in local.conf or a global configuration file. This maps the
> feature name to the appropriate kernel configuration fragment located
> at features/kernel-rust/kernel-rust.scc
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
> meta/classes-recipe/kernel-yocto.bbclass | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass
> b/meta/classes-recipe/kernel-yocto.bbclass
> index e53bf15194..a77f2214c2 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
>
I'll factor this out to a dedicated routine that expands shorthand to the
fragments to take into account some additional considerations, but this
is good for now.
Bruce
> feature_as_specified="$feature"
> feature="$(echo $feature_as_specified | cut -d:
> -f1)"
> feature_specifier="$(echo $feature_as_specified |
> cut -d: -f2)"
> --
> 2.49.0
>
>
--
- 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: 3133 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v9 02/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 01/14] kernel-yocto: Enable rust in kernel Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-16 16:58 ` Varatharajan, Deepesh
2026-03-13 15:59 ` [PATCH v9 03/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
` (11 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 4e230d405a..f47873348a 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -81,6 +81,8 @@ KERNEL_DEBUG ?= ""
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_FEATURES', 'rust', '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] 18+ messages in thread* Re: [PATCH v9 02/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS
2026-03-13 15:59 ` [PATCH v9 02/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
@ 2026-03-16 16:58 ` Varatharajan, Deepesh
0 siblings, 0 replies; 18+ messages in thread
From: Varatharajan, Deepesh @ 2026-03-16 16:58 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
On Fri, Mar 13, 2026 at 09:29 PM, Sadineni, Harish wrote:
>
> RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_FEATURES', 'rust',
> 'clang-native rust-native bindgen-cli-native', '', d)}"
Hi All,
As discussed in review call, *RUST_KERNEL_DEPENDS* will be moved to *"kernel-yocto-rust.bbclass"* as a follow-up patch
once this series got merged.
Regards,
Deepesh
[-- Attachment #2: Type: text/html, Size: 493 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v9 03/14] rust: install Rust library sources for 'make rustavailable' support
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 01/14] kernel-yocto: Enable rust in kernel Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 02/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 04/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
` (10 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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.94.0.bb | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/rust/rust_1.94.0.bb b/meta/recipes-devtools/rust/rust_1.94.0.bb
index 2be0bd8d89..faafc63c96 100644
--- a/meta/recipes-devtools/rust/rust_1.94.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.94.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] 18+ messages in thread* [PATCH v9 04/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable'.
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (2 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 03/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
` (9 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 a77f2214c2..e7fdeb5d4b 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_FEATURES', 'rust', '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] 18+ messages in thread* [PATCH v9 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (3 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 04/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
` (8 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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] 18+ messages in thread* [PATCH v9 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (4 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
` (7 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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] 18+ messages in thread* [PATCH v9 07/14] kernel: Disable ccache when kernel rust support is enabled
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (5 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-14 9:38 ` Richard Purdie
2026-03-13 15:59 ` [PATCH v9 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
` (6 subsequent siblings)
13 siblings, 1 reply; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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..5fbc5c2154 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_FEATURES', 'rust', "1", "0", d)}"
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v9 07/14] kernel: Disable ccache when kernel rust support is enabled
2026-03-13 15:59 ` [PATCH v9 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
@ 2026-03-14 9:38 ` Richard Purdie
0 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2026-03-14 9:38 UTC (permalink / raw)
To: Harish.Sadineni, openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, bruce.ashfield
On Fri, 2026-03-13 at 08:59 -0700, Harish.Sadineni@windriver.com wrote:
> 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..5fbc5c2154 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_FEATURES', 'rust', "1", "0", d)}"
This fails to run, it is missing a '$'. No need to resend, I've fixed
in what I'm testing on master-next.
Cheers,
Richard
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v9 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (6 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
` (5 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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..62f5df7a01 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_FEATURES', 'rust', "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] 18+ messages in thread* [PATCH v9 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (7 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
` (4 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 22b1048838..46d4e99207 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -489,3 +489,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_FEATURES += "rust"
+ 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] 18+ messages in thread* [PATCH v9 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (8 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
` (3 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 d61cc82a4e..094c1148b6 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -550,6 +550,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] 18+ messages in thread* [PATCH v9 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (9 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
` (2 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 | 18 ++++++++++++++++++
1 file changed, 18 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..a043361f10
--- /dev/null
+++ b/meta/classes-recipe/module-rust.bbclass
@@ -0,0 +1,18 @@
+#
+# 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() {
+ if not bb.utils.contains('KERNEL_FEATURES', 'rust', True, False, d):
+ raise bb.parse.SkipRecipe("Skipping rust-out-of-tree-module: 'rust' is not enabled in KERNEL_FEATURES")
+}
--
2.49.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v9 12/14] meta-skeleton: Add rust-out-of-tree-module recipe
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (10 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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] 18+ messages in thread* [PATCH v9 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (11 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
2026-03-13 15:59 ` [PATCH v9 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 5fbc5c2154..656d6e8f5f 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_FEATURES', 'rust', "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] 18+ messages in thread* [PATCH v9 14/14] runtime_test: Add rust-out-of-tree selftest
2026-03-13 15:59 [PATCH v9 00/14] Enable rust support for linux kernel Harish.Sadineni
` (12 preceding siblings ...)
2026-03-13 15:59 ` [PATCH v9 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
@ 2026-03-13 15:59 ` Harish.Sadineni
13 siblings, 0 replies; 18+ messages in thread
From: Harish.Sadineni @ 2026-03-13 15:59 UTC (permalink / raw)
To: openembedded-core
Cc: Randy.MacLeod, Sundeep.Kokkonda, yoann.congal, richard.purdie,
bruce.ashfield
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 46d4e99207..a337194f9b 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -501,8 +501,11 @@ class RustKernel(OESelftestTestCase):
self.write_config(textwrap.dedent("""
KERNEL_FEATURES += "rust"
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:
@@ -516,3 +519,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] 18+ messages in thread