mbox series

[RFC,0/4] Add rust-for-linux option for linux-yocto

Message ID 20251104171611.2227798-1-elmehdi.younes@smile.fr
Headers show
Series Add rust-for-linux option for linux-yocto | expand

Message

El Mehdi YOUNES Nov. 4, 2025, 5:16 p.m. UTC
Hi all,

This patch series introduces support for Rust for Linux in the 'linux-yocto'
kernel. The main approach is to make all changes conditional on a new
'DISTRO_FEATURE' flag: 'rust-kernel'.

When this feature is enabled, the patches will:

* Patch 1/4 (kernel-yocto.bbclass): Adds the core build logic,
    adding 'DEPENDS' and 'EXTRA_OEMAKE' to pass QA.

* Patch 2/4 (linux-yocto.inc): Conditionally adds the 'rust.scc'
    kernel feature to 'KERNEL_FEATURES'. It also adds a conditional
    'CCACHE_DISABLE' as a workaround for a build error found during
    testing. This needs further debugging to understand the root
    cause of the 'ccache' failure.

* Patch 3/4 : Conditionally installs the necessary Rust
    stdlib sources (the 'library/' dir) into the 'rust-native'
    toolchain.

* Patch 4/4 : Adds the actual 'rust.scc' and 'rust.cfg' files.
    These files ideally belong in the 'yocto-kernel-cache' repository.
    They are included here only to make this RFC series testable.
    If the approach is approved, this patch will be removed and submitted
    to 'yocto-kernel-cache' separately.

**Important Note on Testing :**

The 'rust-native' build context does not inherit
the target's 'DISTRO_FEATURES'. For the conditional logic in Patch 3/4
to work, testers MUST add the following to their
'local.conf':

DISTRO_FEATURES_FILTER_NATIVE:append = " rust-kernel"

This is a necessary step for this RFC. We should discuss if this approach
should be added to 'bitbake.conf' permanently.

I have been working on this for some time. Another series on this
topic was posted recently . https://lists.openembedded.org/g/openembedded-core/message/225236
We started this work before that was posted and believe our 'opt-in'
conditional approach is worth sharing with the community.
Our two series may be complementary.

Thank you for your feedback.

Best regards,
El Mehdi YOUNES

El Mehdi YOUNES (4):
  kernel-yocto.bbclass: Add integrated support for Rust-for-Linux
  linux-yocto.inc: Conditionally add rust.scc kernel feature
  rust-native: Conditionally install sources for kernel builds
  linux-yocto-dev: Add temporary Rust kernel feature

 meta/classes-recipe/kernel-yocto.bbclass     | 19 +++++++++++++++++++
 meta/recipes-devtools/rust/rust_1.90.0.bb    |  8 ++++++++
 meta/recipes-kernel/linux/files/rust.cfg     |  6 ++++++
 meta/recipes-kernel/linux/files/rust.scc     |  2 ++
 meta/recipes-kernel/linux/linux-yocto-dev.bb |  2 ++
 meta/recipes-kernel/linux/linux-yocto.inc    |  4 ++++
 6 files changed, 41 insertions(+)
 create mode 100644 meta/recipes-kernel/linux/files/rust.cfg
 create mode 100644 meta/recipes-kernel/linux/files/rust.scc