* [RFC PATCH 1/7] bindgen-cli: extend BBCLASSEXTEND to include nativesdk
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 2/7] linux-yocto: add clang-native and bindgen-cli-native to DEPENDS Harish.Sadineni
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
To support building Rust bindings in the SDK environment, bindgen needs to
be available for the `nativesdk` class as well.
This is required as part of making Rust available, where bindgen is a common
dependency for generating Rust FFI bindings from C headers during cross-compilation.
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-devtools/bindgen-cli/bindgen-cli_0.72.1.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/bindgen-cli/bindgen-cli_0.72.1.bb b/meta/recipes-devtools/bindgen-cli/bindgen-cli_0.72.1.bb
index 2f3ec04e82..72dadfe52f 100644
--- a/meta/recipes-devtools/bindgen-cli/bindgen-cli_0.72.1.bb
+++ b/meta/recipes-devtools/bindgen-cli/bindgen-cli_0.72.1.bb
@@ -15,4 +15,4 @@ do_install:append:class-native() {
create_wrapper ${D}/${bindir}/bindgen LIBCLANG_PATH="${STAGING_LIBDIR_NATIVE}"
}
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
--
2.49.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 2/7] linux-yocto: add clang-native and bindgen-cli-native to DEPENDS
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 1/7] bindgen-cli: extend BBCLASSEXTEND to include nativesdk Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 3/7] rust: install Rust standard library sources for make rustavailable support Harish.Sadineni
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
Add `clang-native` and `bindgen-cli-native` to `DEPENDS` to support Rust-based kernel
modules or features that require generating Rust FFI bindings using bindgen during
the kernel build process
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-kernel/linux/linux-yocto.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 4d0a726bb6..31adb1d9ff 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -81,6 +81,7 @@ 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"
+DEPENDS += "clang-native bindgen-cli-native"
# 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] 14+ messages in thread* [RFC PATCH 3/7] rust: install Rust standard library sources for make rustavailable support
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 1/7] bindgen-cli: extend BBCLASSEXTEND to include nativesdk Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 2/7] linux-yocto: add clang-native and bindgen-cli-native to DEPENDS Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 4/7] rust: stage rustlib sources for linux-yocto " Harish.Sadineni
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
The `make rustavailable` process 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:
- Copying the `library/` directory from the Rust source tree into `${TMPDIR}/work-shared/rust`
during the snapshot setup.
- Installing the `library/` directory into `${SDKPATHNATIVE}/usr/lib/rustlib/src/rust` for the
`nativesdk` class, making them available in the SDK.
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-devtools/rust/rust_1.90.0.bb | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/rust/rust_1.90.0.bb b/meta/recipes-devtools/rust/rust_1.90.0.bb
index 0319d73b93..4b9107b23d 100644
--- a/meta/recipes-devtools/rust/rust_1.90.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.90.0.bb
@@ -54,7 +54,11 @@ do_rust_setup_snapshot () {
# and fail without it there.
mkdir -p ${RUSTSRC}/build/${RUST_BUILD_SYS}
ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${RUST_BUILD_SYS}/stage0
-
+
+ if [ ! -d ${TMPDIR}/work-shared/rust ]; then
+ mkdir -p ${TMPDIR}/work-shared/rust
+ cp -r ${RUSTSRC}/library ${TMPDIR}/work-shared/rust/.
+ fi
# Need to use uninative's loader if enabled/present since the library paths
# are used internally by rust and result in symbol mismatches if we don't
if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then
@@ -288,6 +292,13 @@ rust_do_install() {
rust_runx install
}
+do_install:append:class-nativesdk () {
+ if [ ! -d ${D}${SDKPATHNATIVE}/usr/lib/rustlib/src/rust ]; then
+ mkdir -p ${D}${SDKPATHNATIVE}/usr/lib/rustlib/src/rust
+ cp -r --no-preserve=ownership ${S}/library ${D}${SDKPATHNATIVE}/usr/lib/rustlib/src/rust/
+ fi
+}
+
rust_do_install:class-nativesdk() {
export PSEUDO_UNLOAD=1
rust_runx install
--
2.49.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 4/7] rust: stage rustlib sources for linux-yocto make rustavailable support
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (2 preceding siblings ...)
2025-10-23 11:25 ` [RFC PATCH 3/7] rust: install Rust standard library sources for make rustavailable support Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 5/7] kernel-yocto: add rust support via make rustavailable in do_kernel_configme Harish.Sadineni
` (5 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
When building the Linux kernel with Rust support enabled (e.g., via `make rustavailable`),
the build system expects the Rust standard library sources to be available under:
${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-kernel/linux/linux-yocto.inc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 31adb1d9ff..0c94255f63 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -66,6 +66,12 @@ inherit kernel-yocto
B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build"
+do_patch:append(){
+ if [ ! -d ${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust ]; then
+ mkdir -p ${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust/
+ cp -r ${TMPDIR}/work-shared/rust ${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/.
+ fi
+}
do_install:append(){
if [ -n "${KMETA}" ]; then
rm -rf ${STAGING_KERNEL_DIR}/${KMETA}
--
2.49.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 5/7] kernel-yocto: add rust support via make rustavailable in do_kernel_configme
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (3 preceding siblings ...)
2025-10-23 11:25 ` [RFC PATCH 4/7] rust: stage rustlib sources for linux-yocto " Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 11:25 ` [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
To enable Rust integration in the Linux kernel build, this patch:
- Adds `rust-native` and `bindgen-cli-native` to `do_kernel_configme[depends]`
to ensure required tools are available for Rust support.
- Invokes `make rustavailable` inside `do_kernel_configme()` to prepare
the kernel for building Rust-based modules or core components.
The `make rustavailable` target requires the Rust standard library sources to be
present under `${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust`, which is handled
in the `rust` recipe via shared staging.
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/classes-recipe/kernel-yocto.bbclass | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e53bf15194..1a212b9be9 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -463,6 +463,8 @@ do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
+do_kernel_configme[depends] += "rust-native:do_populate_sysroot"
+do_kernel_configme[depends] += "bindgen-cli-native:do_populate_sysroot"
do_kernel_configme[dirs] += "${S} ${B}"
do_kernel_configme() {
do_kernel_metadata config
@@ -492,6 +494,8 @@ do_kernel_configme() {
bbfatal_log "Could not find configuration queue (${meta_dir}/config.queue)"
fi
+ oe_runmake -C ${S} O=${B} rustavailable
+
CFLAGS="${CFLAGS} ${TOOLCHAIN_OPTIONS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}" CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}" ARCH=${ARCH} merge_config.sh -O ${B} ${config_flags} ${configs} > ${meta_dir}/cfg/merge_config_build.log 2>&1
if [ $? -ne 0 -o ! -f ${B}/.config ]; then
bberror "Could not generate a .config for ${KMACHINE}-${LINUX_KERNEL_TYPE}"
--
2.49.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (4 preceding siblings ...)
2025-10-23 11:25 ` [RFC PATCH 5/7] kernel-yocto: add rust support via make rustavailable in do_kernel_configme Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 15:10 ` El Mehdi YOUNES
2025-11-04 17:43 ` [OE-core] " Randy MacLeod
2025-10-23 11:25 ` [RFC PATCH 7/7] kernel-devsrc: copying rust-kernel soucre to $kerneldir/build Harish.Sadineni
` (3 subsequent siblings)
9 siblings, 2 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
Add initial support for building the Linux kernel with Rust enabled:
- Introduce `rust.cfg` to set Rust-related kernel config options, including:
- `CONFIG_RUST`, `CONFIG_HAVE_RUST`, and `CONFIG_RUST_IS_AVAILABLE`
- Rust sample modules and developer checks (overflow/debug assertions)
- Disable BTF and module versioning for compatibility
- Add `rust.scc` to include `rust.cfg` via `kconf` in the kernel feature stack
- Update `linux-yocto_${PV}.bb` to:
- Append `rust.scc` to `SRC_URI` and `KERNEL_FEATURES`
- Suppress `buildpaths` QA warning due to Rust path inclusion during builds
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
meta/recipes-kernel/linux/files/rust.scc | 1 +
meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
3 files changed, 25 insertions(+)
create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
create mode 100644 meta/recipes-kernel/linux/files/rust.scc
diff --git a/meta/recipes-kernel/linux/files/rust.cfg b/meta/recipes-kernel/linux/files/rust.cfg
new file mode 100644
index 0000000000..293438e8e0
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust.cfg
@@ -0,0 +1,20 @@
+CONFIG_RUST=y
+CONFIG_SAMPLES_RUST=y
+CONFIG_SAMPLE_RUST_MINIMAL=y
+CONFIG_SAMPLE_RUST_PRINT=y
+CONFIG_SAMPLE_RUST_HOSTPROGS=y
+CONFIG_RUST_DEBUG_ASSERTIONS=y
+CONFIG_RUST_OVERFLOW_CHECKS=y
+CONFIG_RUST_BUILD_ASSERT_ALLOW=y
+# Disable module versioning
+CONFIG_MODVERSIONS=n
+
+# Disable BTF debug info
+CONFIG_DEBUG_INFO_BTF=n
+
+# Rust availability
+CONFIG_RUST_IS_AVAILABLE=y
+
+# Indicate Rust support present
+CONFIG_HAVE_RUST=y
+
diff --git a/meta/recipes-kernel/linux/files/rust.scc b/meta/recipes-kernel/linux/files/rust.scc
new file mode 100644
index 0000000000..4686d9ce5e
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/rust.scc
@@ -0,0 +1 @@
+kconf hardware rust.cfg
diff --git a/meta/recipes-kernel/linux/linux-yocto_6.16.bb b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
index 2188c7fed2..fda964e78d 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.16.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
@@ -77,3 +77,7 @@ 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"
+INSANE_SKIP:kernel-vmlinux = "buildpaths"
+INSANE_SKIP:kernel-dbg = "buildpaths"
+SRC_URI += "file://rust.scc"
+KERNEL_FEATURES += "rust.scc"
--
2.49.0
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration
2025-10-23 11:25 ` [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
@ 2025-10-23 15:10 ` El Mehdi YOUNES
2025-11-04 17:43 ` [OE-core] " Randy MacLeod
1 sibling, 0 replies; 14+ messages in thread
From: El Mehdi YOUNES @ 2025-10-23 15:10 UTC (permalink / raw)
To: Harish.Sadineni, openembedded-core; +Cc: Sundeep.Kokkonda
Hi Harish,
Le 23/10/2025 à 13:25, Harish.Sadineni@windriver.com a écrit :
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> Add initial support for building the Linux kernel with Rust enabled:
>
> - Introduce `rust.cfg` to set Rust-related kernel config options, including:
> - `CONFIG_RUST`, `CONFIG_HAVE_RUST`, and `CONFIG_RUST_IS_AVAILABLE`
> - Rust sample modules and developer checks (overflow/debug assertions)
> - Disable BTF and module versioning for compatibility
>
> - Add `rust.scc` to include `rust.cfg` via `kconf` in the kernel feature stack
>
> - Update `linux-yocto_${PV}.bb` to:
> - Append `rust.scc` to `SRC_URI` and `KERNEL_FEATURES`
> - Suppress `buildpaths` QA warning due to Rust path inclusion during builds
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
> meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> meta/recipes-kernel/linux/files/rust.scc | 1 +
> meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> 3 files changed, 25 insertions(+)
> create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> create mode 100644 meta/recipes-kernel/linux/files/rust.scc
>
> diff --git a/meta/recipes-kernel/linux/files/rust.cfg b/meta/recipes-kernel/linux/files/rust.cfg
> new file mode 100644
> index 0000000000..293438e8e0
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/files/rust.cfg
> @@ -0,0 +1,20 @@
> +CONFIG_RUST=y
> +CONFIG_SAMPLES_RUST=y
> +CONFIG_SAMPLE_RUST_MINIMAL=y
> +CONFIG_SAMPLE_RUST_PRINT=y
> +CONFIG_SAMPLE_RUST_HOSTPROGS=y
> +CONFIG_RUST_DEBUG_ASSERTIONS=y
> +CONFIG_RUST_OVERFLOW_CHECKS=y
> +CONFIG_RUST_BUILD_ASSERT_ALLOW=y
> +# Disable module versioning
> +CONFIG_MODVERSIONS=n
> +
> +# Disable BTF debug info
> +CONFIG_DEBUG_INFO_BTF=n
> +
> +# Rust availability
> +CONFIG_RUST_IS_AVAILABLE=y
> +
> +# Indicate Rust support present
> +CONFIG_HAVE_RUST=y
Since Patch 5 correctly adds the 'make rustavailable' check
during 'do_kernel_configme', shouldn't we let the kernel's build system
determine these values automatically based on the actual toolchain
readiness?
> +
> diff --git a/meta/recipes-kernel/linux/files/rust.scc b/meta/recipes-kernel/linux/files/rust.scc
> new file mode 100644
> index 0000000000..4686d9ce5e
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/files/rust.scc
> @@ -0,0 +1 @@
> +kconf hardware rust.cfg
> diff --git a/meta/recipes-kernel/linux/linux-yocto_6.16.bb b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> index 2188c7fed2..fda964e78d 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> +++ b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> @@ -77,3 +77,7 @@ 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"
> +INSANE_SKIP:kernel-vmlinux = "buildpaths"
> +INSANE_SKIP:kernel-dbg = "buildpaths"
> +SRC_URI += "file://rust.scc"
> +KERNEL_FEATURES += "rust.scc"
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration
2025-10-23 11:25 ` [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
2025-10-23 15:10 ` El Mehdi YOUNES
@ 2025-11-04 17:43 ` Randy MacLeod
1 sibling, 0 replies; 14+ messages in thread
From: Randy MacLeod @ 2025-11-04 17:43 UTC (permalink / raw)
To: Harish.Sadineni, openembedded-core, Bruce Ashfield
Cc: Sundeep.Kokkonda, elmehdi.younes
[-- Attachment #1: Type: text/plain, Size: 4594 bytes --]
On 2025-10-23 7:25 a.m., Sadineni, Harish via lists.openembedded.org wrote:
> From: Harish Sadineni<Harish.Sadineni@windriver.com>
>
> Add initial support for building the Linux kernel with Rust enabled:
>
> - Introduce `rust.cfg` to set Rust-related kernel config options, including:
> - `CONFIG_RUST`, `CONFIG_HAVE_RUST`, and `CONFIG_RUST_IS_AVAILABLE`
> - Rust sample modules and developer checks (overflow/debug assertions)
> - Disable BTF and module versioning for compatibility
>
> - Add `rust.scc` to include `rust.cfg` via `kconf` in the kernel feature stack
>
> - Update `linux-yocto_${PV}.bb` to:
> - Append `rust.scc` to `SRC_URI` and `KERNEL_FEATURES`
> - Suppress `buildpaths` QA warning due to Rust path inclusion during builds
>
> Signed-off-by: Harish Sadineni<Harish.Sadineni@windriver.com>
> ---
> meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> meta/recipes-kernel/linux/files/rust.scc | 1 +
This is fine for an RFC but at some point, when Bruce asks for an
non-RFC version,
I expect that you will need to move this to the yocto-kenrel-cache,
perhaps under:
https://git.yoctoproject.org/yocto-kernel-cache/tree/cfg
Take a look at the yocto-kernel-cache repo and docs:
https://docs.yoctoproject.org/kernel-dev/advanced.html
if you haven't already.
> meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> 3 files changed, 25 insertions(+)
> create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> create mode 100644 meta/recipes-kernel/linux/files/rust.scc
>
> diff --git a/meta/recipes-kernel/linux/files/rust.cfg b/meta/recipes-kernel/linux/files/rust.cfg
> new file mode 100644
> index 0000000000..293438e8e0
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/files/rust.cfg
> @@ -0,0 +1,20 @@
> +CONFIG_RUST=y
> +CONFIG_SAMPLES_RUST=y
> +CONFIG_SAMPLE_RUST_MINIMAL=y
> +CONFIG_SAMPLE_RUST_PRINT=y
> +CONFIG_SAMPLE_RUST_HOSTPROGS=y
> +CONFIG_RUST_DEBUG_ASSERTIONS=y
> +CONFIG_RUST_OVERFLOW_CHECKS=y
> +CONFIG_RUST_BUILD_ASSERT_ALLOW=y
> +# Disable module versioning
> +CONFIG_MODVERSIONS=n
> +
> +# Disable BTF debug info
> +CONFIG_DEBUG_INFO_BTF=n
> +
> +# Rust availability
> +CONFIG_RUST_IS_AVAILABLE=y
> +
> +# Indicate Rust support present
> +CONFIG_HAVE_RUST=y
You'll have to review this list to divide it up into:
1. a minimal rust.cfg and perhaps
2. a rust-samples.cfg
3. a rust-debug.cfg if that's really what
CONFIG_RUST_DEBUG_ASSERTIONS and friends are doing:
https://cateee.net/lkddb/web-lkddb/RUST_DEBUG_ASSERTIONS.html Also,
you'll need to explain and justify each option or set of options more
clearly in the commit log.
As Bruce said, the next steps are:
1. Rust being optional and off by default 2. Rust binary / prebuilt
components to minimize the overhead and dependencies of rust and related
tools on the kernel.
Anyway, this is a super start and I understand you have a v2 almost
ready that makes kenrel rust-support be optional so send that now and
we'll see what the next step after that is.
Thanks,
../Randy
> +
> diff --git a/meta/recipes-kernel/linux/files/rust.scc b/meta/recipes-kernel/linux/files/rust.scc
> new file mode 100644
> index 0000000000..4686d9ce5e
> --- /dev/null
> +++ b/meta/recipes-kernel/linux/files/rust.scc
> @@ -0,0 +1 @@
> +kconf hardware rust.cfg
> diff --git a/meta/recipes-kernel/linux/linux-yocto_6.16.bb b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> index 2188c7fed2..fda964e78d 100644
> --- a/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> +++ b/meta/recipes-kernel/linux/linux-yocto_6.16.bb
> @@ -77,3 +77,7 @@ 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"
> +INSANE_SKIP:kernel-vmlinux = "buildpaths"
> +INSANE_SKIP:kernel-dbg = "buildpaths"
> +SRC_URI +="file://rust.scc"
> +KERNEL_FEATURES += "rust.scc"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225242):https://lists.openembedded.org/g/openembedded-core/message/225242
> Mute This Topic:https://lists.openembedded.org/mt/115908712/3616765
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
# Randy MacLeod
# Wind River Linux
[-- Attachment #2: Type: text/html, Size: 6986 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC PATCH 7/7] kernel-devsrc: copying rust-kernel soucre to $kerneldir/build
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (5 preceding siblings ...)
2025-10-23 11:25 ` [RFC PATCH 6/7] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
@ 2025-10-23 11:25 ` Harish.Sadineni
2025-10-23 13:00 ` [OE-core] [RFC PATCH 0/7] Enable rust support for linux kernel Bruce Ashfield
` (2 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Harish.Sadineni @ 2025-10-23 11:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Sundeep.Kokkonda
From: Harish Sadineni <Harish.Sadineni@windriver.com>
In sdk while running make prepare in kernel-source directory after rust
enabling rust config. it will throw erros since only makefile is present
in rust kernel souces.
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
meta/recipes-kernel/linux/kernel-devsrc.bb | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 04dd683dde..d0465c3f91 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -139,6 +139,7 @@ do_install() {
cd ${S}
cp -a scripts $kerneldir/build
+ cp -a rust $kerneldir/build
# 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] 14+ messages in thread* Re: [OE-core] [RFC PATCH 0/7] Enable rust support for linux kernel
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (6 preceding siblings ...)
2025-10-23 11:25 ` [RFC PATCH 7/7] kernel-devsrc: copying rust-kernel soucre to $kerneldir/build Harish.Sadineni
@ 2025-10-23 13:00 ` Bruce Ashfield
2025-10-23 14:57 ` El Mehdi YOUNES
2025-10-27 6:03 ` [OE-core] " Mathieu Dubois-Briand
9 siblings, 0 replies; 14+ messages in thread
From: Bruce Ashfield @ 2025-10-23 13:00 UTC (permalink / raw)
To: Harish.Sadineni; +Cc: openembedded-core, Sundeep.Kokkonda
[-- Attachment #1: Type: text/plain, Size: 4743 bytes --]
On Thu, Oct 23, 2025 at 7:27 AM Sadineni, Harish via lists.openembedded.org
<Harish.Sadineni=windriver.com@lists.openembedded.org> wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> 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 inside sdk.
>
> Summary of changes:
>
> - Patch 1: Extend 'bindgen-cli' to support 'nativesdk', allowing it to be
> available in the SDK environment.
> - Patch 2: Add required dependencies ('clang-native',
> 'bindgen-cli-native') to the kernel to support Rust binding generation.
> - Patch 3: Install the Rust standard library source ('library/') into
> `work-shared` and which will be later copied to
> linux-yocto recipe-sysroot-native.
> - Patch 4: Stage the Rust sources into `recipe-sysroot-native` for kernel
> build compatibility, making them visible during native builds.
> - Patch 5: Update `kernel-yocto.bbclass` to invoke `make rustavailable`
> during 'do_kernel_configme', ensuring Rust readiness.
> - Patch 6: Add kernel configuration support for Rust (via 'rust.cfg' and
> 'rust.scc'), enabling the Rust build options in kernel config.
> - patch 7: Copy Rust kernel sources into kernel-devsrc build directory
> which will be required while runnig 'make prepare' in sdk.
>
>
On my first pass through, things look to be in reasonable shape with
respect to patch
splitting, and clarity.
But the number one item is: this cannot be default, it must be opt-in and
controlled via
a distro feature.
When we get to the point that the kernel cannot be built and functional
without rust,
then of course we'll revisit. But we aren't to that point now.
Before we inflict the overhead and dependencies of rust and related tools
on the kernel,
we have to have binary / prebuilt components available.
Cheers,
Bruce
> WIP - need inputs:
> 1. In patch-3, rust sources are copied from ${RUSTSRC} to
> ${TMPDIR}/work-shared, which is redundant and improving it in
> more optimized way by extracting rust directly into ${TMPDIR}/work-shared
> and then use it for both rust & linux-yocto recipes.
>
> 2. In patch-6, We've suppressed a few build path QA issues with
> INSANE_SKIP.
> We have tried fixing those using DEBUG_PREFIX_MAP & --remap-path-prefix
> but unable to resolve it.
> Are there any flags for kernel or any other inputs?
>
> 3. If rust.cfg & rust.scc changes are ok, we will send kernel
> configuration fragment to yocto-kernel-cache.
>
> With above considerations, We did a successful build of Enabling rust in
> linux kernel and
> Tested a rust-out-of-tree kernel module in sdk for x86-64 & arm64
> architectures.
>
> Harish Sadineni (7):
> bindgen-cli: extend BBCLASSEXTEND to include nativesdk
> linux-yocto: add clang-native and bindgen-cli-native to DEPENDS
> rust: install Rust standard library sources for make rustavailable
> support
> rust: stage rustlib sources for linux-yocto make rustavailable support
> kernel-yocto: add rust support via make rustavailable in
> do_kernel_configme
> linux-yocto: enable Rust support in kernel configuration
> kernel-devsrc: copying rust-kernel soucre to $kerneldir/build
>
> meta/classes-recipe/kernel-yocto.bbclass | 4 ++++
> .../bindgen-cli/bindgen-cli_0.72.1.bb | 2 +-
> meta/recipes-devtools/rust/rust_1.90.0.bb | 13 +++++++++++-
> meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> meta/recipes-kernel/linux/files/rust.scc | 1 +
> meta/recipes-kernel/linux/kernel-devsrc.bb | 1 +
> meta/recipes-kernel/linux/linux-yocto.inc | 7 +++++++
> meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> 8 files changed, 50 insertions(+), 2 deletions(-)
> create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> create mode 100644 meta/recipes-kernel/linux/files/rust.scc
>
> --
> 2.49.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225236):
> https://lists.openembedded.org/g/openembedded-core/message/225236
> Mute This Topic: https://lists.openembedded.org/mt/115908706/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
--
- 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: 7419 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [RFC PATCH 0/7] Enable rust support for linux kernel
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (7 preceding siblings ...)
2025-10-23 13:00 ` [OE-core] [RFC PATCH 0/7] Enable rust support for linux kernel Bruce Ashfield
@ 2025-10-23 14:57 ` El Mehdi YOUNES
2025-10-27 6:03 ` [OE-core] " Mathieu Dubois-Briand
9 siblings, 0 replies; 14+ messages in thread
From: El Mehdi YOUNES @ 2025-10-23 14:57 UTC (permalink / raw)
To: Harish.Sadineni, openembedded-core; +Cc: Sundeep.Kokkonda
[-- Attachment #1: Type: text/plain, Size: 5465 bytes --]
Hi Harish, Hi All,
Sorry this message was first sent in private by mistake.
Le 23/10/2025 à 13:25, Harish.Sadineni@windriver.com a écrit :
> From: Harish Sadineni<Harish.Sadineni@windriver.com>
>
> 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 inside sdk.
Thanks for this patch series and your work on this topic! I've also been
working
on enabling Rust in the Yocto kernel recently and have some ideas I'd
like to share.
Overall, your approach seems to be heading in the same direction as mine.
However, my main general comment is that these changes don't appear to
be optional. In my view, all these additions (dependencies, build flags,
source installation) should only take effect if the user explicitly wants
to enable Rust support in the kernel.
To achieve this, I've made all my modifications conditional using
bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ...) checks in the
relevant recipes and classes. This way, a user only needs to add
DISTRO_FEATURES:append = " rust-kernel" to their configuration, and
everything needed for Rust kernel support is automatically enabled. This
avoids adding unnecessary dependencies or build steps for users who don't
need Rust
>
> Summary of changes:
>
> - Patch 1: Extend 'bindgen-cli' to support 'nativesdk', allowing it to be available in the SDK environment.
> - Patch 2: Add required dependencies ('clang-native', 'bindgen-cli-native') to the kernel to support Rust binding generation.
> - Patch 3: Install the Rust standard library source ('library/') into `work-shared` and which will be later copied to
> linux-yocto recipe-sysroot-native.
> - Patch 4: Stage the Rust sources into `recipe-sysroot-native` for kernel build compatibility, making them visible during native builds.
> - Patch 5: Update `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness.
> - Patch 6: Add kernel configuration support for Rust (via 'rust.cfg' and 'rust.scc'), enabling the Rust build options in kernel config.
> - patch 7: Copy Rust kernel sources into kernel-devsrc build directory which will be required while runnig 'make prepare' in sdk.
>
> WIP - need inputs:
> 1. In patch-3, rust sources are copied from ${RUSTSRC} to ${TMPDIR}/work-shared, which is redundant and improving it in
> more optimized way by extracting rust directly into ${TMPDIR}/work-shared and then use it for both rust & linux-yocto recipes.
Regarding WIP point 1 about copying the Rust sources: I agree the
current mechanism
seems a bit confusing. I'll provide more detailed feedback on the
specific response after test,
but my initial thought is that we should only need to copy the sources once.
Perhaps we can ensure they are placed in the correct final location and
then point
the kernel build system to it using the RUST_LIB_SRC variable passed via
EXTRA_OEMAKE.
>
> 2. In patch-6, We've suppressed a few build path QA issues with INSANE_SKIP.
> We have tried fixing those using DEBUG_PREFIX_MAP & --remap-path-prefix but unable to resolve it.
> Are there any flags for kernel or any other inputs?
For the 'buildpaths' QA issue, I solved it without INSANE_SKIP by :
- Inherit rust-common in kernel-yocto.bbclass.
- Append --remap-path-prefix for ${S}, ${B}, and ${STAGING_DIR_NATIVE}
to RUST_DEBUG_REMAP.
- Pass ${RUST_DEBUG_REMAP} via KRUSTFLAGS in EXTRA_OEMAKE.
And of course, all these additions in the recipes/classes are conditional
on bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ...)
>
> 3. If rust.cfg & rust.scc changes are ok, we will send kernel configuration fragment to yocto-kernel-cache.
>
> With above considerations, We did a successful build of Enabling rust in linux kernel and
> Tested a rust-out-of-tree kernel module in sdk for x86-64 & arm64 architectures.
Thanks again for sharing this work! I'll provide more detailed comments
and ideas
on the individual patches, and potentially more after testing, but this
is definitely a very good start.
Best regards
El Mehdi
>
> Harish Sadineni (7):
> bindgen-cli: extend BBCLASSEXTEND to include nativesdk
> linux-yocto: add clang-native and bindgen-cli-native to DEPENDS
> rust: install Rust standard library sources for make rustavailable
> support
> rust: stage rustlib sources for linux-yocto make rustavailable support
> kernel-yocto: add rust support via make rustavailable in
> do_kernel_configme
> linux-yocto: enable Rust support in kernel configuration
> kernel-devsrc: copying rust-kernel soucre to $kerneldir/build
>
> meta/classes-recipe/kernel-yocto.bbclass | 4 ++++
> .../bindgen-cli/bindgen-cli_0.72.1.bb | 2 +-
> meta/recipes-devtools/rust/rust_1.90.0.bb | 13 +++++++++++-
> meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> meta/recipes-kernel/linux/files/rust.scc | 1 +
> meta/recipes-kernel/linux/kernel-devsrc.bb | 1 +
> meta/recipes-kernel/linux/linux-yocto.inc | 7 +++++++
> meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> 8 files changed, 50 insertions(+), 2 deletions(-)
> create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> create mode 100644 meta/recipes-kernel/linux/files/rust.scc
[-- Attachment #2: Type: text/html, Size: 7943 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [RFC PATCH 0/7] Enable rust support for linux kernel
2025-10-23 11:25 [RFC PATCH 0/7] Enable rust support for linux kernel Harish.Sadineni
` (8 preceding siblings ...)
2025-10-23 14:57 ` El Mehdi YOUNES
@ 2025-10-27 6:03 ` Mathieu Dubois-Briand
2025-11-04 19:50 ` Yoann Congal
9 siblings, 1 reply; 14+ messages in thread
From: Mathieu Dubois-Briand @ 2025-10-27 6:03 UTC (permalink / raw)
To: Harish.Sadineni, openembedded-core; +Cc: Sundeep.Kokkonda
On Thu Oct 23, 2025 at 1:25 PM CEST, Harish via lists.openembedded.org Sadineni wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> 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 inside sdk.
>
> Summary of changes:
>
> - Patch 1: Extend 'bindgen-cli' to support 'nativesdk', allowing it to be available in the SDK environment.
> - Patch 2: Add required dependencies ('clang-native', 'bindgen-cli-native') to the kernel to support Rust binding generation.
> - Patch 3: Install the Rust standard library source ('library/') into `work-shared` and which will be later copied to
> linux-yocto recipe-sysroot-native.
> - Patch 4: Stage the Rust sources into `recipe-sysroot-native` for kernel build compatibility, making them visible during native builds.
> - Patch 5: Update `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness.
> - Patch 6: Add kernel configuration support for Rust (via 'rust.cfg' and 'rust.scc'), enabling the Rust build options in kernel config.
> - patch 7: Copy Rust kernel sources into kernel-devsrc build directory which will be required while runnig 'make prepare' in sdk.
>
> WIP - need inputs:
> 1. In patch-3, rust sources are copied from ${RUSTSRC} to ${TMPDIR}/work-shared, which is redundant and improving it in
> more optimized way by extracting rust directly into ${TMPDIR}/work-shared and then use it for both rust & linux-yocto recipes.
>
> 2. In patch-6, We've suppressed a few build path QA issues with INSANE_SKIP.
> We have tried fixing those using DEBUG_PREFIX_MAP & --remap-path-prefix but unable to resolve it.
> Are there any flags for kernel or any other inputs?
>
> 3. If rust.cfg & rust.scc changes are ok, we will send kernel configuration fragment to yocto-kernel-cache.
>
> With above considerations, We did a successful build of Enabling rust in linux kernel and
> Tested a rust-out-of-tree kernel module in sdk for x86-64 & arm64 architectures.
>
> Harish Sadineni (7):
> bindgen-cli: extend BBCLASSEXTEND to include nativesdk
> linux-yocto: add clang-native and bindgen-cli-native to DEPENDS
> rust: install Rust standard library sources for make rustavailable
> support
> rust: stage rustlib sources for linux-yocto make rustavailable support
> kernel-yocto: add rust support via make rustavailable in
> do_kernel_configme
> linux-yocto: enable Rust support in kernel configuration
> kernel-devsrc: copying rust-kernel soucre to $kerneldir/build
>
> meta/classes-recipe/kernel-yocto.bbclass | 4 ++++
> .../bindgen-cli/bindgen-cli_0.72.1.bb | 2 +-
> meta/recipes-devtools/rust/rust_1.90.0.bb | 13 +++++++++++-
> meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> meta/recipes-kernel/linux/files/rust.scc | 1 +
> meta/recipes-kernel/linux/kernel-devsrc.bb | 1 +
> meta/recipes-kernel/linux/linux-yocto.inc | 7 +++++++
> meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> 8 files changed, 50 insertions(+), 2 deletions(-)
> create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> create mode 100644 meta/recipes-kernel/linux/files/rust.scc
Hi Harish,
I know this is still an RFC, but I ran it on the autobuilder to check
how it goes. We had a some error with kernel build:
ERROR: linux-yocto-6.12.52+git-r0 do_patch: Execution of '/srv/pokybuild/yocto-worker/qemux86-alt/build/build/tmp/work/qemux86-poky-linux/linux-yocto/6.12.52+git/temp/run.do_patch.410367' failed with exit code 1
...
| cp: cannot stat '/srv/pokybuild/yocto-worker/qemux86-alt/build/build/tmp/work-shared/rust': No such file or directory
This happened in almost all builds as far as I can tell:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/20/builds/2614
https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/2623
https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/2650
https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/2638
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [OE-core] [RFC PATCH 0/7] Enable rust support for linux kernel
2025-10-27 6:03 ` [OE-core] " Mathieu Dubois-Briand
@ 2025-11-04 19:50 ` Yoann Congal
0 siblings, 0 replies; 14+ messages in thread
From: Yoann Congal @ 2025-11-04 19:50 UTC (permalink / raw)
To: mathieu.dubois-briand
Cc: Harish.Sadineni, openembedded-core, Sundeep.Kokkonda
[-- Attachment #1: Type: text/plain, Size: 6241 bytes --]
Hello,
FYI, Mehdi just sent his series (also as an RFC)
[RFC PATCH 0/4] Add rust-for-linux option for linux-yocto
https://lists.openembedded.org/g/openembedded-core/topic/rfc_patch_0_4_add/116120514
[RFC PATCH 1/4] kernel-yocto.bbclass: Add integrated support for
Rust-for-Linux
https://lists.openembedded.org/g/openembedded-core/topic/rfc_patch_1_4/116120516
[RFC PATCH 2/4] linux-yocto.inc: Conditionally add rust.scc kernel feature
https://lists.openembedded.org/g/openembedded-core/topic/rfc_patch_2_4/116120517
[RFC PATCH 3/4] rust-native: Conditionally install sources for kernel
builds
https://lists.openembedded.org/g/openembedded-core/topic/rfc_patch_3_4_rust_native/116120518
[RFC PATCH 4/4] linux-yocto-dev: Add temporary Rust kernel feature
https://lists.openembedded.org/g/openembedded-core/topic/rfc_patch_4_4/116120519
He worked basically at the same time on this and also got it working, I've
asked him to send his series to help.
Le lun. 27 oct. 2025 à 07:03, Mathieu Dubois-Briand via
lists.openembedded.org <mathieu.dubois-briand=
bootlin.com@lists.openembedded.org> a écrit :
> On Thu Oct 23, 2025 at 1:25 PM CEST, Harish via lists.openembedded.org
> Sadineni wrote:
> > From: Harish Sadineni <Harish.Sadineni@windriver.com>
> >
> > 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 inside sdk.
> >
> > Summary of changes:
> >
> > - Patch 1: Extend 'bindgen-cli' to support 'nativesdk', allowing it to
> be available in the SDK environment.
> > - Patch 2: Add required dependencies ('clang-native',
> 'bindgen-cli-native') to the kernel to support Rust binding generation.
> > - Patch 3: Install the Rust standard library source ('library/') into
> `work-shared` and which will be later copied to
> > linux-yocto recipe-sysroot-native.
> > - Patch 4: Stage the Rust sources into `recipe-sysroot-native` for
> kernel build compatibility, making them visible during native builds.
> > - Patch 5: Update `kernel-yocto.bbclass` to invoke `make rustavailable`
> during 'do_kernel_configme', ensuring Rust readiness.
> > - Patch 6: Add kernel configuration support for Rust (via 'rust.cfg' and
> 'rust.scc'), enabling the Rust build options in kernel config.
> > - patch 7: Copy Rust kernel sources into kernel-devsrc build directory
> which will be required while runnig 'make prepare' in sdk.
> >
> > WIP - need inputs:
> > 1. In patch-3, rust sources are copied from ${RUSTSRC} to
> ${TMPDIR}/work-shared, which is redundant and improving it in
> > more optimized way by extracting rust directly into
> ${TMPDIR}/work-shared and then use it for both rust & linux-yocto recipes.
> >
> > 2. In patch-6, We've suppressed a few build path QA issues with
> INSANE_SKIP.
> > We have tried fixing those using DEBUG_PREFIX_MAP & --remap-path-prefix
> but unable to resolve it.
> > Are there any flags for kernel or any other inputs?
> >
> > 3. If rust.cfg & rust.scc changes are ok, we will send kernel
> configuration fragment to yocto-kernel-cache.
> >
> > With above considerations, We did a successful build of Enabling rust in
> linux kernel and
> > Tested a rust-out-of-tree kernel module in sdk for x86-64 & arm64
> architectures.
> >
> > Harish Sadineni (7):
> > bindgen-cli: extend BBCLASSEXTEND to include nativesdk
> > linux-yocto: add clang-native and bindgen-cli-native to DEPENDS
> > rust: install Rust standard library sources for make rustavailable
> > support
> > rust: stage rustlib sources for linux-yocto make rustavailable support
> > kernel-yocto: add rust support via make rustavailable in
> > do_kernel_configme
> > linux-yocto: enable Rust support in kernel configuration
> > kernel-devsrc: copying rust-kernel soucre to $kerneldir/build
> >
> > meta/classes-recipe/kernel-yocto.bbclass | 4 ++++
> > .../bindgen-cli/bindgen-cli_0.72.1.bb | 2 +-
> > meta/recipes-devtools/rust/rust_1.90.0.bb | 13 +++++++++++-
> > meta/recipes-kernel/linux/files/rust.cfg | 20 +++++++++++++++++++
> > meta/recipes-kernel/linux/files/rust.scc | 1 +
> > meta/recipes-kernel/linux/kernel-devsrc.bb | 1 +
> > meta/recipes-kernel/linux/linux-yocto.inc | 7 +++++++
> > meta/recipes-kernel/linux/linux-yocto_6.16.bb | 4 ++++
> > 8 files changed, 50 insertions(+), 2 deletions(-)
> > create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
> > create mode 100644 meta/recipes-kernel/linux/files/rust.scc
>
> Hi Harish,
>
> I know this is still an RFC, but I ran it on the autobuilder to check
> how it goes. We had a some error with kernel build:
>
> ERROR: linux-yocto-6.12.52+git-r0 do_patch: Execution of
> '/srv/pokybuild/yocto-worker/qemux86-alt/build/build/tmp/work/qemux86-poky-linux/linux-yocto/6.12.52+git/temp/run.do_patch.410367'
> failed with exit code 1
> ...
> | cp: cannot stat
> '/srv/pokybuild/yocto-worker/qemux86-alt/build/build/tmp/work-shared/rust':
> No such file or directory
>
> This happened in almost all builds as far as I can tell:
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/20/builds/2614
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/2623
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/2650
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/29/builds/2638
>
> Thanks,
> Mathieu
>
>
> --
> Mathieu Dubois-Briand, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225320):
> https://lists.openembedded.org/g/openembedded-core/message/225320
> Mute This Topic: https://lists.openembedded.org/mt/115908706/4316185
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
--
Yoann Congal
Smile ECS
[-- Attachment #2: Type: text/html, Size: 9419 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread