| Message ID | 20260129163910.2612040-1-Harish.Sadineni@windriver.com |
|---|---|
| Headers | show |
| Series | Enable rust support for linux kernel | expand |
This patch series was tested on Autobuilder: https://autobuilder.yoctoproject.org/valkyrie/?#/builders/35/builds/3115 ( https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3115%20https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3238%20https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/3121 ) https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3238 https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/3121 Thanks, Harish
On Thu, 2026-01-29 at 08:38 -0800, Sadineni, Harish via lists.openembedded.org wrote: > From: Harish Sadineni <Harish.Sadineni@windriver.com> > > v5: > - Regression in autobuilder with v4 series is due to applying v4 series together with following patch > "llvm: enable LLVMgold.so build by adding binutils dependency"(https://lists.openembedded.org/g/openembedded-core/message/229387) > is fixed by droping Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091). > - Updated patch "rust: install Rust library sources for 'make rustavailable' support" to install > rust standard library sources for rust-native. > > v4: > - Resolved patchtest failures. > > v3: > - Removed the DISTRO_FEATURES dependency for installing Rust library sources in the Rust recipe, > - Extended support for on target rust kernel module developmet by installing Rust library sources and > introduced packaging of the Rust standard library sources in a dedicated ${PN}-src-lib package. > - Integrated Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091) > that uses the Rust bootstrap tool to install Rust library sources for rust-native. > - Dropped the patch that added rust-kernel to native/nativesdk feature filters in bitbake.conf. > - Updated flags in the make-mod-scripts recipe to fix build failures when building Rust out-of-tree > module recipes. > - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include > nativesdk, as it has been merged into oe-core. > > v2: > - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. > - Updated commit message and added in code comments for patch "[PATCH 09/15] kernel-devsrc: copying > rust-kernel source to $kerneldir/build" > > [0] https://lists.openembedded.org/g/openembedded-core/message/228559 > [1] https://lists.openembedded.org/g/openembedded-core/message/228560 > > v1: > The previous series was RFC v4, "Enable Rust support for Linux kernel" > (https://lists.openembedded.org/g/openembedded-core/message/226623). > > In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module support" > (https://lists.openembedded.org/g/openembedded-core/message/227281), which builds on top of RFC v4. > > The current patch series is a unified version that combines both efforts. > Compared to the earlier series, the main changes are: > > -Kernel configuration fragments have been moved to yocto-kernel-cache. > -The kernel fragments have been removed from SRC_URI and from the files > directory previously stored underrecipes-kernel/linux/files. > -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for Linux Rust sample" > by appending KERNEL_EXTRA_FEATURES:append = 'features/kernel-sample/kernel-rust-sample.scc' > instead of adding this directly in the linux-yocto recipe. > > > This patch series introduces Rust support into the linux-yocto kernel recipe and > related build infrastructure in the Yocto Project. The goal is to enable building > the Linux kernel with Rust components and provide support for building kernel module > which is written in rust and also provide support to build rust kernel modules in sdk. > > And this series adds test for Linux Rust sample and also added support > for out-of-tree kernel module written in Rust as well as associated test. > > Summary of patches: > > - Patch 01: Add required dependencies ('clang-native', 'rust-native','bindgen-cli-native') to the kernel to support Rust binding generation. > - Patch 02: Install the Rust standard library source ('library/') for native,target and sdk. > - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness. > - Patch 04: Add kernel configuration support for Rust (via 'kernel-rust.scc'), enabling the Rust build options in kernel config. > - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by appending --remap-path-prefix to RUST_DEBUG_REMAP > - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix build issue with make-mod-scripts recipe. > - Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto. > - Patch 08: Copy Rust kernel sources into kernel-devsrc build directory which will be required while running 'make prepare' in sdk. > - Patch 09: Added oe-selftest case for the Linux Rust sample. > - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR > - patch 11: Export artifacts needed for out-of-tree Rust compilation > - patch 12: Prepare out-of-tree rust module compilation > - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer > - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe by appending --remap-path-prefix to RUST_DEBUG_REMAP > - patch 15: Added rust-out-of-tree selftest > > Patches have been build-tested successfully on: > - qemuarm64 > - qemux86-64 > > Benchmark test-result for x86-64: > +-------------------------------+------------+-----------+-----------+-----------+ > > DISTRO_FEATURES | real | user | sys | FS usage | > +-------------------------------+------------+-----------+-----------+-----------+ > > rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s | 58 GB | > > rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s | 33 GB | > +-------------------------------+------------+-----------+-----------+-----------+ We discussed these patches on Monday and have some feedback on the design. Things are nearly correct, we do want to ensure that the user experience is good before merging this though as people will quickly start to depend on it. We think it would be better if Rust support was controlled by KERNEL_FEATURES instead of DISTRO_FEATURES. This option now only impacts the kernel and any kernel module recipes. It also may need to change depending on MACHINE which makes it not a good fit for DISTRO_FEATURES - e.g. one BSP may use an older LTS kernel with no required Rust code and a different BSP may use a newer kernel and need a driver written in Rust for the board to function. We should add a new module-rust.bbclass instead of extending module.bbclass with conditional logic. This can be included by any modules which use Rust and handle any common setup. It can also check for the presence of required files (scripts/target.json & rust/*) in the kernel's shared workdir, and perhaps the kernel config so that we can give a sensible error message if they are missing. This means that module-rust.bbclass doesn't need to check KERNEL_FEATURES for rust-kernel, it can just look at the shared workdir (probably in do_configure) to make sure that we're ready to build a Rust module. If we can't use KERNEL_FEATURES, then perhaps a new KERNEL_RUST_SUPPORT variable would work. In either case, this should only be checked in the kernel recipe itself. Bruce - what do you think about KERNEL_FEATURES being used in this way? Best regards,
On Wed, 2026-02-04 at 12:00 +0000, Paul Barker wrote: > On Thu, 2026-01-29 at 08:38 -0800, Sadineni, Harish via > lists.openembedded.org wrote: > > From: Harish Sadineni <Harish.Sadineni@windriver.com> > > > > v5: > > - Regression in autobuilder with v4 series is due to applying v4 series together with following patch > > "llvm: enable LLVMgold.so build by adding binutils dependency"(https://lists.openembedded.org/g/openembedded-core/message/229387) > > is fixed by droping Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091). > > - Updated patch "rust: install Rust library sources for 'make rustavailable' support" to install > > rust standard library sources for rust-native. > > > > v4: > > - Resolved patchtest failures. > > > > v3: > > - Removed the DISTRO_FEATURES dependency for installing Rust library sources in the Rust recipe, > > - Extended support for on target rust kernel module developmet by installing Rust library sources and > > introduced packaging of the Rust standard library sources in a dedicated ${PN}-src-lib package. > > - Integrated Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091) > > that uses the Rust bootstrap tool to install Rust library sources for rust-native. > > - Dropped the patch that added rust-kernel to native/nativesdk feature filters in bitbake.conf. > > - Updated flags in the make-mod-scripts recipe to fix build failures when building Rust out-of-tree > > module recipes. > > - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include > > nativesdk, as it has been merged into oe-core. > > > > v2: > > - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. > > - Updated commit message and added in code comments for patch "[PATCH 09/15] kernel-devsrc: copying > > rust-kernel source to $kerneldir/build" > > > > [0] https://lists.openembedded.org/g/openembedded-core/message/228559 > > [1] https://lists.openembedded.org/g/openembedded-core/message/228560 > > > > v1: > > The previous series was RFC v4, "Enable Rust support for Linux kernel" > > (https://lists.openembedded.org/g/openembedded-core/message/226623). > > > > In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module support" > > (https://lists.openembedded.org/g/openembedded-core/message/227281), which builds on top of RFC v4. > > > > The current patch series is a unified version that combines both efforts. > > Compared to the earlier series, the main changes are: > > > > -Kernel configuration fragments have been moved to yocto-kernel-cache. > > -The kernel fragments have been removed from SRC_URI and from the files > > directory previously stored underrecipes-kernel/linux/files. > > -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for Linux Rust sample" > > by appending KERNEL_EXTRA_FEATURES:append = 'features/kernel-sample/kernel-rust-sample.scc' > > instead of adding this directly in the linux-yocto recipe. > > > > > > This patch series introduces Rust support into the linux-yocto kernel recipe and > > related build infrastructure in the Yocto Project. The goal is to enable building > > the Linux kernel with Rust components and provide support for building kernel module > > which is written in rust and also provide support to build rust kernel modules in sdk. > > > > And this series adds test for Linux Rust sample and also added support > > for out-of-tree kernel module written in Rust as well as associated test. > > > > Summary of patches: > > > > - Patch 01: Add required dependencies ('clang-native', 'rust-native','bindgen-cli-native') to the kernel to support Rust binding generation. > > - Patch 02: Install the Rust standard library source ('library/') for native,target and sdk. > > - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness. > > - Patch 04: Add kernel configuration support for Rust (via 'kernel-rust.scc'), enabling the Rust build options in kernel config. > > - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by appending --remap-path-prefix to RUST_DEBUG_REMAP > > - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix build issue with make-mod-scripts recipe. > > - Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto. > > - Patch 08: Copy Rust kernel sources into kernel-devsrc build directory which will be required while running 'make prepare' in sdk. > > - Patch 09: Added oe-selftest case for the Linux Rust sample. > > - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR > > - patch 11: Export artifacts needed for out-of-tree Rust compilation > > - patch 12: Prepare out-of-tree rust module compilation > > - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer > > - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe by appending --remap-path-prefix to RUST_DEBUG_REMAP > > - patch 15: Added rust-out-of-tree selftest > > > > Patches have been build-tested successfully on: > > - qemuarm64 > > - qemux86-64 > > > > Benchmark test-result for x86-64: > > +-------------------------------+------------+-----------+-----------+-----------+ > > > DISTRO_FEATURES | real | user | sys | FS usage | > > +-------------------------------+------------+-----------+-----------+-----------+ > > > rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s | 58 GB | > > > rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s | 33 GB | > > +-------------------------------+------------+-----------+-----------+-----------+ > > We discussed these patches on Monday and have some feedback on the > design. Things are nearly correct, we do want to ensure that the user > experience is good before merging this though as people will quickly > start to depend on it. > > We think it would be better if Rust support was controlled by > KERNEL_FEATURES instead of DISTRO_FEATURES. This option now only impacts > the kernel and any kernel module recipes. It also may need to change > depending on MACHINE which makes it not a good fit for DISTRO_FEATURES - > e.g. one BSP may use an older LTS kernel with no required Rust code and > a different BSP may use a newer kernel and need a driver written in Rust > for the board to function. > > We should add a new module-rust.bbclass instead of extending > module.bbclass with conditional logic. This can be included by any > modules which use Rust and handle any common setup. It can also check > for the presence of required files (scripts/target.json & rust/*) in the > kernel's shared workdir, and perhaps the kernel config so that we can > give a sensible error message if they are missing. This means that > module-rust.bbclass doesn't need to check KERNEL_FEATURES for > rust-kernel, it can just look at the shared workdir (probably in > do_configure) to make sure that we're ready to build a Rust module. After I sent this, I spotted a patch for module.bbclass to check that CONFIG_MODULES is enabled [1]. Doing the same thing in a new module-rust.bbclass to check for CONFIG_RUST may be exactly what we need. [1]: https://lore.kernel.org/openembedded-core/20260204020908.864912-1-kai.kang@windriver.com/T/#u > > If we can't use KERNEL_FEATURES, then perhaps a new KERNEL_RUST_SUPPORT > variable would work. In either case, this should only be checked in the > kernel recipe itself. > > Bruce - what do you think about KERNEL_FEATURES being used in this way? > > Best regards, >
On Wed, Feb 4, 2026 at 7:24 AM Paul Barker <paul@pbarker.dev> wrote: > On Wed, 2026-02-04 at 12:00 +0000, Paul Barker wrote: > > On Thu, 2026-01-29 at 08:38 -0800, Sadineni, Harish via > > lists.openembedded.org wrote: > > > From: Harish Sadineni <Harish.Sadineni@windriver.com> > > > > > > v5: > > > - Regression in autobuilder with v4 series is due to applying v4 > series together with following patch > > > "llvm: enable LLVMgold.so build by adding binutils dependency"( > https://lists.openembedded.org/g/openembedded-core/message/229387) > > > is fixed by droping Alistair Francis's patch( > https://lists.openembedded.org/g/openembedded-core/message/229091). > > > - Updated patch "rust: install Rust library sources for 'make > rustavailable' support" to install > > > rust standard library sources for rust-native. > > > > > > v4: > > > - Resolved patchtest failures. > > > > > > v3: > > > - Removed the DISTRO_FEATURES dependency for installing Rust library > sources in the Rust recipe, > > > - Extended support for on target rust kernel module developmet by > installing Rust library sources and > > > introduced packaging of the Rust standard library sources in a > dedicated ${PN}-src-lib package. > > > - Integrated Alistair Francis's patch( > https://lists.openembedded.org/g/openembedded-core/message/229091) > > > that uses the Rust bootstrap tool to install Rust library sources > for rust-native. > > > - Dropped the patch that added rust-kernel to native/nativesdk feature > filters in bitbake.conf. > > > - Updated flags in the make-mod-scripts recipe to fix build failures > when building Rust out-of-tree > > > module recipes. > > > - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include > > > nativesdk, as it has been merged into oe-core. > > > > > > v2: > > > - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. > > > - Updated commit message and added in code comments for patch "[PATCH > 09/15] kernel-devsrc: copying > > > rust-kernel source to $kerneldir/build" > > > > > > [0] https://lists.openembedded.org/g/openembedded-core/message/228559 > > > [1] https://lists.openembedded.org/g/openembedded-core/message/228560 > > > > > > v1: > > > The previous series was RFC v4, "Enable Rust support for Linux kernel" > > > (https://lists.openembedded.org/g/openembedded-core/message/226623). > > > > > > In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree > module support" > > > (https://lists.openembedded.org/g/openembedded-core/message/227281), > which builds on top of RFC v4. > > > > > > The current patch series is a unified version that combines both > efforts. > > > Compared to the earlier series, the main changes are: > > > > > > -Kernel configuration fragments have been moved to yocto-kernel-cache. > > > -The kernel fragments have been removed from SRC_URI and from the files > > > directory previously stored underrecipes-kernel/linux/files. > > > -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for > Linux Rust sample" > > > by appending KERNEL_EXTRA_FEATURES:append = > 'features/kernel-sample/kernel-rust-sample.scc' > > > instead of adding this directly in the linux-yocto recipe. > > > > > > > > > This patch series introduces Rust support into the linux-yocto kernel > recipe and > > > related build infrastructure in the Yocto Project. The goal is to > enable building > > > the Linux kernel with Rust components and provide support for building > kernel module > > > which is written in rust and also provide support to build rust kernel > modules in sdk. > > > > > > And this series adds test for Linux Rust sample and also added support > > > for out-of-tree kernel module written in Rust as well as associated > test. > > > > > > Summary of patches: > > > > > > - Patch 01: Add required dependencies ('clang-native', > 'rust-native','bindgen-cli-native') to the kernel to support Rust binding > generation. > > > - Patch 02: Install the Rust standard library source ('library/') for > native,target and sdk. > > > - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make > rustavailable` during 'do_kernel_configme', ensuring Rust readiness. > > > - Patch 04: Add kernel configuration support for Rust (via > 'kernel-rust.scc'), enabling the Rust build options in kernel config. > > > - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by > appending --remap-path-prefix to RUST_DEBUG_REMAP > > > - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix > build issue with make-mod-scripts recipe. > > > - Patch 07: Disabling ccache when rust-kernel is enabled for > linux-yocto. > > > - Patch 08: Copy Rust kernel sources into kernel-devsrc build > directory which will be required while running 'make prepare' in sdk. > > > - Patch 09: Added oe-selftest case for the Linux Rust sample. > > > - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR > > > - patch 11: Export artifacts needed for out-of-tree Rust compilation > > > - patch 12: Prepare out-of-tree rust module compilation > > > - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer > > > - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe > by appending --remap-path-prefix to RUST_DEBUG_REMAP > > > - patch 15: Added rust-out-of-tree selftest > > > > > > Patches have been build-tested successfully on: > > > - qemuarm64 > > > - qemux86-64 > > > > > > Benchmark test-result for x86-64: > > > > +-------------------------------+------------+-----------+-----------+-----------+ > > > > DISTRO_FEATURES | real | user | sys > | FS usage | > > > > +-------------------------------+------------+-----------+-----------+-----------+ > > > > rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s > | 58 GB | > > > > rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s > | 33 GB | > > > > +-------------------------------+------------+-----------+-----------+-----------+ > > > > We discussed these patches on Monday and have some feedback on the > > design. Things are nearly correct, we do want to ensure that the user > > experience is good before merging this though as people will quickly > > start to depend on it. > > > > We think it would be better if Rust support was controlled by > > KERNEL_FEATURES instead of DISTRO_FEATURES. This option now only impacts > > the kernel and any kernel module recipes. It also may need to change > > depending on MACHINE which makes it not a good fit for DISTRO_FEATURES - > > e.g. one BSP may use an older LTS kernel with no required Rust code and > > a different BSP may use a newer kernel and need a driver written in Rust > > for the board to function. > > > > We should add a new module-rust.bbclass instead of extending > > module.bbclass with conditional logic. This can be included by any > > modules which use Rust and handle any common setup. It can also check > > for the presence of required files (scripts/target.json & rust/*) in the > > kernel's shared workdir, and perhaps the kernel config so that we can > > give a sensible error message if they are missing. This means that > > module-rust.bbclass doesn't need to check KERNEL_FEATURES for > > rust-kernel, it can just look at the shared workdir (probably in > > do_configure) to make sure that we're ready to build a Rust module. > > After I sent this, I spotted a patch for module.bbclass to check that > CONFIG_MODULES is enabled [1]. Doing the same thing in a new > module-rust.bbclass to check for CONFIG_RUST may be exactly what we > need. > Except that I don't particularly like that check as it is in that patch, so I wouldn't recommend copying it. Make the invocation of the task conditional, not conditional checks in the tasks. Bruce > > [1]: > https://lore.kernel.org/openembedded-core/20260204020908.864912-1-kai.kang@windriver.com/T/#u > > > > > If we can't use KERNEL_FEATURES, then perhaps a new KERNEL_RUST_SUPPORT > > variable would work. In either case, this should only be checked in the > > kernel recipe itself. > > > > Bruce - what do you think about KERNEL_FEATURES being used in this way? > > > > Best regards, > > > > -- > Paul Barker > >
On Wed, Feb 4, 2026 at 7:00 AM Paul Barker via lists.openembedded.org <paul= pbarker.dev@lists.openembedded.org> wrote: > On Thu, 2026-01-29 at 08:38 -0800, Sadineni, Harish via > lists.openembedded.org wrote: > > From: Harish Sadineni <Harish.Sadineni@windriver.com> > > > > v5: > > - Regression in autobuilder with v4 series is due to applying v4 series > together with following patch > > "llvm: enable LLVMgold.so build by adding binutils dependency"( > https://lists.openembedded.org/g/openembedded-core/message/229387) > > is fixed by droping Alistair Francis's patch( > https://lists.openembedded.org/g/openembedded-core/message/229091). > > - Updated patch "rust: install Rust library sources for 'make > rustavailable' support" to install > > rust standard library sources for rust-native. > > > > v4: > > - Resolved patchtest failures. > > > > v3: > > - Removed the DISTRO_FEATURES dependency for installing Rust library > sources in the Rust recipe, > > - Extended support for on target rust kernel module developmet by > installing Rust library sources and > > introduced packaging of the Rust standard library sources in a > dedicated ${PN}-src-lib package. > > - Integrated Alistair Francis's patch( > https://lists.openembedded.org/g/openembedded-core/message/229091) > > that uses the Rust bootstrap tool to install Rust library sources for > rust-native. > > - Dropped the patch that added rust-kernel to native/nativesdk feature > filters in bitbake.conf. > > - Updated flags in the make-mod-scripts recipe to fix build failures > when building Rust out-of-tree > > module recipes. > > - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include > > nativesdk, as it has been merged into oe-core. > > > > v2: > > - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. > > - Updated commit message and added in code comments for patch "[PATCH > 09/15] kernel-devsrc: copying > > rust-kernel source to $kerneldir/build" > > > > [0] https://lists.openembedded.org/g/openembedded-core/message/228559 > > [1] https://lists.openembedded.org/g/openembedded-core/message/228560 > > > > v1: > > The previous series was RFC v4, "Enable Rust support for Linux kernel" > > (https://lists.openembedded.org/g/openembedded-core/message/226623). > > > > In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module > support" > > (https://lists.openembedded.org/g/openembedded-core/message/227281), > which builds on top of RFC v4. > > > > The current patch series is a unified version that combines both efforts. > > Compared to the earlier series, the main changes are: > > > > -Kernel configuration fragments have been moved to yocto-kernel-cache. > > -The kernel fragments have been removed from SRC_URI and from the files > > directory previously stored underrecipes-kernel/linux/files. > > -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for > Linux Rust sample" > > by appending KERNEL_EXTRA_FEATURES:append = > 'features/kernel-sample/kernel-rust-sample.scc' > > instead of adding this directly in the linux-yocto recipe. > > > > > > This patch series introduces Rust support into the linux-yocto kernel > recipe and > > related build infrastructure in the Yocto Project. The goal is to enable > building > > the Linux kernel with Rust components and provide support for building > kernel module > > which is written in rust and also provide support to build rust kernel > modules in sdk. > > > > And this series adds test for Linux Rust sample and also added support > > for out-of-tree kernel module written in Rust as well as associated test. > > > > Summary of patches: > > > > - Patch 01: Add required dependencies ('clang-native', > 'rust-native','bindgen-cli-native') to the kernel to support Rust binding > generation. > > - Patch 02: Install the Rust standard library source ('library/') for > native,target and sdk. > > - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make > rustavailable` during 'do_kernel_configme', ensuring Rust readiness. > > - Patch 04: Add kernel configuration support for Rust (via > 'kernel-rust.scc'), enabling the Rust build options in kernel config. > > - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by > appending --remap-path-prefix to RUST_DEBUG_REMAP > > - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix > build issue with make-mod-scripts recipe. > > - Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto. > > - Patch 08: Copy Rust kernel sources into kernel-devsrc build directory > which will be required while running 'make prepare' in sdk. > > - Patch 09: Added oe-selftest case for the Linux Rust sample. > > - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR > > - patch 11: Export artifacts needed for out-of-tree Rust compilation > > - patch 12: Prepare out-of-tree rust module compilation > > - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer > > - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe > by appending --remap-path-prefix to RUST_DEBUG_REMAP > > - patch 15: Added rust-out-of-tree selftest > > > > Patches have been build-tested successfully on: > > - qemuarm64 > > - qemux86-64 > > > > Benchmark test-result for x86-64: > > > +-------------------------------+------------+-----------+-----------+-----------+ > > > DISTRO_FEATURES | real | user | sys | > FS usage | > > > +-------------------------------+------------+-----------+-----------+-----------+ > > > rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s | > 58 GB | > > > rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s | > 33 GB | > > > +-------------------------------+------------+-----------+-----------+-----------+ > > We discussed these patches on Monday and have some feedback on the > design. Things are nearly correct, we do want to ensure that the user > experience is good before merging this though as people will quickly > start to depend on it. > > We think it would be better if Rust support was controlled by > KERNEL_FEATURES instead of DISTRO_FEATURES. This option now only impacts > the kernel and any kernel module recipes. It also may need to change > depending on MACHINE which makes it not a good fit for DISTRO_FEATURES - > e.g. one BSP may use an older LTS kernel with no required Rust code and > a different BSP may use a newer kernel and need a driver written in Rust > for the board to function. > > We should add a new module-rust.bbclass instead of extending > module.bbclass with conditional logic. This can be included by any > modules which use Rust and handle any common setup. It can also check > for the presence of required files (scripts/target.json & rust/*) in the > kernel's shared workdir, and perhaps the kernel config so that we can > give a sensible error message if they are missing. This means that > module-rust.bbclass doesn't need to check KERNEL_FEATURES for > rust-kernel, it can just look at the shared workdir (probably in > do_configure) to make sure that we're ready to build a Rust module. > > If we can't use KERNEL_FEATURES, then perhaps a new KERNEL_RUST_SUPPORT > variable would work. In either case, this should only be checked in the > kernel recipe itself. > > Bruce - what do you think about KERNEL_FEATURES being used in this way? > It's a reasonable idea. KERNEL_FEATURES are supposed to abstract the individual CONFIG_ items from spreading throughout the code base so checking KERNEL_FEATURES is acceptable for coordinating different parts of kernel infrastructure. I'll just repeat my feedback that I sent earlier (and also to your other reply in this email), that I prefer to make the tasks in the bbclasses conditional, not have them checking for conditionals within the tasks. Bruce > > Best regards, > > -- > Paul Barker > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#230511): > https://lists.openembedded.org/g/openembedded-core/message/230511 > Mute This Topic: https://lists.openembedded.org/mt/117528967/1050810 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > bruce.ashfield@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
On 1/29/2026 10:09 PM, Sadineni, Harish via lists.openembedded.org wrote: > From: Yoann Congal <yoann.congal@smile.fr> > > Publish artifacts from kernel compilation to allow out-of-tree Rust > compilation: > * scripts/target.json: target definition: architecture, ABI, compiler > options, ... > * rust/: the crates compiled by the kernel available to > out-of-tree-modules Hi Yoann, I am dropping this patch “kernel.bbclass: Export artifacts needed for out-of-tree Rust compilation” from my v6 patch series. Without this patch, target.json and the rust/ directory were already getting published for x86_64. On arm64, target.json will not be created, yet the module is still generated and works fine. When building rust-out-f-tree-module for arm64 with this patch applied, it emits a warning that Out-of-tree rust modules build will fail due to a missing target.json in kernel. However, in practice, the build completes successfully. I have tested without this patch on both arm64 and x86_64, both tests were successful. So, this patch does not appear to be necessary. Are you OK with dropping this patch? I have pushed the updated changes to the below oe-contrib branch: https://git.openembedded.org/openembedded-core-contrib/log/?h=deepesh/rust-in-kernel-v6 Additionally, I have extended the ccache disabling to make-mod-scripts (as part of "kernel: Disable ccache when kernel rust support is enabled" patch) and updated "meta-skeleton: Add rust-out-of-tree-module recipe" to align with the new changes. Thanks, Harish > Signed-off-by: Yoann Congal <yoann.congal@smile.fr> > Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> > --- > meta/classes-recipe/kernel.bbclass | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass > index 30a10b0801..dfb8604a68 100644 > --- a/meta/classes-recipe/kernel.bbclass > +++ b/meta/classes-recipe/kernel.bbclass > @@ -632,6 +632,24 @@ do_shared_workdir () { > cp -r scripts/gcc-plugins ${kerneldir}/scripts > fi > > + if ${@bb.utils.contains("DISTRO_FEATURES", "rust-kernel", "true", "false", d)}; then > + # Copy target.json file needed for out-of-tree rust modules > + if [ -e scripts/target.json ]; then > + bbnote "Copying scripts/target.json" > + mkdir -p ${kerneldir}/scripts > + cp scripts/target.json ${kerneldir}/scripts > + else > + bbwarn "scripts/target.json not found in compiled kernel. Out-of-tree rust modules will fail to build." > + fi > + > + # Copy rust/ needed by out-of-tree module (firstly for the core rust crate) > + if [ -e rust/ ]; then > + bbnote "Copying rust/" > + cp -r rust ${kerneldir}/ > + else > + bbwarn "rust/ not found in compiled kernel. Out-of-tree rust modules will fail to build." > + fi > + fi > } > > # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#230151): https://lists.openembedded.org/g/openembedded-core/message/230151 > Mute This Topic: https://lists.openembedded.org/mt/117528980/8054390 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Harish.Sadineni@windriver.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Wed Feb 11, 2026 at 5:19 PM CET, Harish Sadineni wrote: > > On 1/29/2026 10:09 PM, Sadineni, Harish via lists.openembedded.org wrote: >> From: Yoann Congal <yoann.congal@smile.fr> >> >> Publish artifacts from kernel compilation to allow out-of-tree Rust >> compilation: >> * scripts/target.json: target definition: architecture, ABI, compiler >> options, ... >> * rust/: the crates compiled by the kernel available to >> out-of-tree-modules > Hi Yoann, > > I am dropping this patch “kernel.bbclass: Export artifacts needed for > out-of-tree Rust compilation” from my v6 patch series. > > Without this patch, target.json and the rust/ directory were already > getting published for x86_64. On arm64, target.json will not be created, > yet the module is still generated and works fine. > > When building rust-out-f-tree-module for arm64 with this patch applied, > it emits a warning that Out-of-tree rust modules build will fail due to > a missing target.json in kernel. However, in practice, the build > completes successfully. > > I have tested without this patch on both arm64 and x86_64, both tests > were successful. > > So, this patch does not appear to be necessary. Are you OK with dropping > this patch? Yes, as long as it builds without warnings and test succesfully, I'm fine with it. > I have pushed the updated changes to the below oe-contrib branch: > https://git.openembedded.org/openembedded-core-contrib/log/?h=deepesh/rust-in-kernel-v6 > > Additionally, I have extended the ccache disabling to make-mod-scripts > (as part of "kernel: Disable ccache when kernel rust support is enabled" > patch) and updated "meta-skeleton: Add rust-out-of-tree-module recipe" > to align with the new changes. Shouldn't the KERNEL_RUST_SUPPORT check in rust-out-of-tree-module_git.bb be moved to the module-rust class? Generally, If you think that you rewrote some patches, I'm OK with you taking authorship (leaving me as Co-developed-by). That should allow you to edit patches more freely. Regards, > Thanks, > Harish >> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> >> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> >> --- >> meta/classes-recipe/kernel.bbclass | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass >> index 30a10b0801..dfb8604a68 100644 >> --- a/meta/classes-recipe/kernel.bbclass >> +++ b/meta/classes-recipe/kernel.bbclass >> @@ -632,6 +632,24 @@ do_shared_workdir () { >> cp -r scripts/gcc-plugins ${kerneldir}/scripts >> fi >> >> + if ${@bb.utils.contains("DISTRO_FEATURES", "rust-kernel", "true", "false", d)}; then >> + # Copy target.json file needed for out-of-tree rust modules >> + if [ -e scripts/target.json ]; then >> + bbnote "Copying scripts/target.json" >> + mkdir -p ${kerneldir}/scripts >> + cp scripts/target.json ${kerneldir}/scripts >> + else >> + bbwarn "scripts/target.json not found in compiled kernel. Out-of-tree rust modules will fail to build." >> + fi >> + >> + # Copy rust/ needed by out-of-tree module (firstly for the core rust crate) >> + if [ -e rust/ ]; then >> + bbnote "Copying rust/" >> + cp -r rust ${kerneldir}/ >> + else >> + bbwarn "rust/ not found in compiled kernel. Out-of-tree rust modules will fail to build." >> + fi >> + fi >> } >> >> # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#230151): https://lists.openembedded.org/g/openembedded-core/message/230151 >> Mute This Topic: https://lists.openembedded.org/mt/117528980/8054390 >> Group Owner: openembedded-core+owner@lists.openembedded.org >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Harish.Sadineni@windriver.com] >> -=-=-=-=-=-=-=-=-=-=-=- >>
On 2/12/2026 4:55 PM, Yoann Congal wrote: > CAUTION: This email comes from a non Wind River email account! > Do not click links or open attachments unless you recognize the sender and know the content is safe. > > On Wed Feb 11, 2026 at 5:19 PM CET, Harish Sadineni wrote: >> On 1/29/2026 10:09 PM, Sadineni, Harish via lists.openembedded.org wrote: >>> From: Yoann Congal <yoann.congal@smile.fr> >>> >>> Publish artifacts from kernel compilation to allow out-of-tree Rust >>> compilation: >>> * scripts/target.json: target definition: architecture, ABI, compiler >>> options, ... >>> * rust/: the crates compiled by the kernel available to >>> out-of-tree-modules >> Hi Yoann, >> >> I am dropping this patch “kernel.bbclass: Export artifacts needed for >> out-of-tree Rust compilation” from my v6 patch series. >> >> Without this patch, target.json and the rust/ directory were already >> getting published for x86_64. On arm64, target.json will not be created, >> yet the module is still generated and works fine. >> >> When building rust-out-f-tree-module for arm64 with this patch applied, >> it emits a warning that Out-of-tree rust modules build will fail due to >> a missing target.json in kernel. However, in practice, the build >> completes successfully. >> >> I have tested without this patch on both arm64 and x86_64, both tests >> were successful. >> >> So, this patch does not appear to be necessary. Are you OK with dropping >> this patch? > Yes, as long as it builds without warnings and test succesfully, I'm fine with it. > >> I have pushed the updated changes to the below oe-contrib branch: >> https://git.openembedded.org/openembedded-core-contrib/log/?h=deepesh/rust-in-kernel-v6 >> >> Additionally, I have extended the ccache disabling to make-mod-scripts >> (as part of "kernel: Disable ccache when kernel rust support is enabled" >> patch) and updated "meta-skeleton: Add rust-out-of-tree-module recipe" >> to align with the new changes. > Shouldn't the KERNEL_RUST_SUPPORT check in > rust-out-of-tree-module_git.bb be moved to the module-rust class? Yes, that should be doable. Moving the 'KERNEL_RUST_SUPPORT' check to the 'module-rust' class makes sense to centralize the logic. I'll update that change. > > Generally, If you think that you rewrote some patches, I'm OK with you > taking authorship (leaving me as Co-developed-by). That should allow you > to edit patches more freely. Thanks. I’ll take authorship for the rewritten patches and add you as Co-developed-by. Thanks, Harish > > Regards, > >> Thanks, >> Harish >>> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> >>> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> >>> --- >>> meta/classes-recipe/kernel.bbclass | 18 ++++++++++++++++++ >>> 1 file changed, 18 insertions(+) >>> >>> diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass >>> index 30a10b0801..dfb8604a68 100644 >>> --- a/meta/classes-recipe/kernel.bbclass >>> +++ b/meta/classes-recipe/kernel.bbclass >>> @@ -632,6 +632,24 @@ do_shared_workdir () { >>> cp -r scripts/gcc-plugins ${kerneldir}/scripts >>> fi >>> >>> + if ${@bb.utils.contains("DISTRO_FEATURES", "rust-kernel", "true", "false", d)}; then >>> + # Copy target.json file needed for out-of-tree rust modules >>> + if [ -e scripts/target.json ]; then >>> + bbnote "Copying scripts/target.json" >>> + mkdir -p ${kerneldir}/scripts >>> + cp scripts/target.json ${kerneldir}/scripts >>> + else >>> + bbwarn "scripts/target.json not found in compiled kernel. Out-of-tree rust modules will fail to build." >>> + fi >>> + >>> + # Copy rust/ needed by out-of-tree module (firstly for the core rust crate) >>> + if [ -e rust/ ]; then >>> + bbnote "Copying rust/" >>> + cp -r rust ${kerneldir}/ >>> + else >>> + bbwarn "rust/ not found in compiled kernel. Out-of-tree rust modules will fail to build." >>> + fi >>> + fi >>> } >>> >>> # We don't need to stage anything, not the modules/firmware since those would clash with linux-firmware >>> >>> -=-=-=-=-=-=-=-=-=-=-=- >>> Links: You receive all messages sent to this group. >>> View/Reply Online (#230151): https://lists.openembedded.org/g/openembedded-core/message/230151 >>> Mute This Topic: https://lists.openembedded.org/mt/117528980/8054390 >>> Group Owner: openembedded-core+owner@lists.openembedded.org >>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Harish.Sadineni@windriver.com] >>> -=-=-=-=-=-=-=-=-=-=-=- >>> > > -- > Yoann Congal > Smile ECS >
On 2/4/2026 5:54 PM, Paul Barker wrote: > On Wed, 2026-02-04 at 12:00 +0000, Paul Barker wrote: >> On Thu, 2026-01-29 at 08:38 -0800, Sadineni, Harish via >> lists.openembedded.org wrote: >>> From: Harish Sadineni <Harish.Sadineni@windriver.com> >>> >>> v5: >>> - Regression in autobuilder with v4 series is due to applying v4 series together with following patch >>> "llvm: enable LLVMgold.so build by adding binutils dependency"(https://lists.openembedded.org/g/openembedded-core/message/229387) >>> is fixed by droping Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091). >>> - Updated patch "rust: install Rust library sources for 'make rustavailable' support" to install >>> rust standard library sources for rust-native. >>> >>> v4: >>> - Resolved patchtest failures. >>> >>> v3: >>> - Removed the DISTRO_FEATURES dependency for installing Rust library sources in the Rust recipe, >>> - Extended support for on target rust kernel module developmet by installing Rust library sources and >>> introduced packaging of the Rust standard library sources in a dedicated ${PN}-src-lib package. >>> - Integrated Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091) >>> that uses the Rust bootstrap tool to install Rust library sources for rust-native. >>> - Dropped the patch that added rust-kernel to native/nativesdk feature filters in bitbake.conf. >>> - Updated flags in the make-mod-scripts recipe to fix build failures when building Rust out-of-tree >>> module recipes. >>> - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include >>> nativesdk, as it has been merged into oe-core. >>> >>> v2: >>> - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. >>> - Updated commit message and added in code comments for patch "[PATCH 09/15] kernel-devsrc: copying >>> rust-kernel source to $kerneldir/build" >>> >>> [0] https://lists.openembedded.org/g/openembedded-core/message/228559 >>> [1] https://lists.openembedded.org/g/openembedded-core/message/228560 >>> >>> v1: >>> The previous series was RFC v4, "Enable Rust support for Linux kernel" >>> (https://lists.openembedded.org/g/openembedded-core/message/226623). >>> >>> In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module support" >>> (https://lists.openembedded.org/g/openembedded-core/message/227281), which builds on top of RFC v4. >>> >>> The current patch series is a unified version that combines both efforts. >>> Compared to the earlier series, the main changes are: >>> >>> -Kernel configuration fragments have been moved to yocto-kernel-cache. >>> -The kernel fragments have been removed from SRC_URI and from the files >>> directory previously stored underrecipes-kernel/linux/files. >>> -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for Linux Rust sample" >>> by appending KERNEL_EXTRA_FEATURES:append = 'features/kernel-sample/kernel-rust-sample.scc' >>> instead of adding this directly in the linux-yocto recipe. >>> >>> >>> This patch series introduces Rust support into the linux-yocto kernel recipe and >>> related build infrastructure in the Yocto Project. The goal is to enable building >>> the Linux kernel with Rust components and provide support for building kernel module >>> which is written in rust and also provide support to build rust kernel modules in sdk. >>> >>> And this series adds test for Linux Rust sample and also added support >>> for out-of-tree kernel module written in Rust as well as associated test. >>> >>> Summary of patches: >>> >>> - Patch 01: Add required dependencies ('clang-native', 'rust-native','bindgen-cli-native') to the kernel to support Rust binding generation. >>> - Patch 02: Install the Rust standard library source ('library/') for native,target and sdk. >>> - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness. >>> - Patch 04: Add kernel configuration support for Rust (via 'kernel-rust.scc'), enabling the Rust build options in kernel config. >>> - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by appending --remap-path-prefix to RUST_DEBUG_REMAP >>> - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix build issue with make-mod-scripts recipe. >>> - Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto. >>> - Patch 08: Copy Rust kernel sources into kernel-devsrc build directory which will be required while running 'make prepare' in sdk. >>> - Patch 09: Added oe-selftest case for the Linux Rust sample. >>> - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR >>> - patch 11: Export artifacts needed for out-of-tree Rust compilation >>> - patch 12: Prepare out-of-tree rust module compilation >>> - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer >>> - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe by appending --remap-path-prefix to RUST_DEBUG_REMAP >>> - patch 15: Added rust-out-of-tree selftest >>> >>> Patches have been build-tested successfully on: >>> - qemuarm64 >>> - qemux86-64 >>> >>> Benchmark test-result for x86-64: >>> +-------------------------------+------------+-----------+-----------+-----------+ >>>> DISTRO_FEATURES | real | user | sys | FS usage | >>> +-------------------------------+------------+-----------+-----------+-----------+ >>>> rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s | 58 GB | >>>> rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s | 33 GB | >>> +-------------------------------+------------+-----------+-----------+-----------+ >> We discussed these patches on Monday and have some feedback on the >> design. Things are nearly correct, we do want to ensure that the user >> experience is good before merging this though as people will quickly >> start to depend on it. >> >> We think it would be better if Rust support was controlled by >> KERNEL_FEATURES instead of DISTRO_FEATURES. This option now only impacts >> the kernel and any kernel module recipes. It also may need to change >> depending on MACHINE which makes it not a good fit for DISTRO_FEATURES - >> e.g. one BSP may use an older LTS kernel with no required Rust code and >> a different BSP may use a newer kernel and need a driver written in Rust >> for the board to function. >> >> We should add a new module-rust.bbclass instead of extending >> module.bbclass with conditional logic. This can be included by any >> modules which use Rust and handle any common setup. It can also check >> for the presence of required files (scripts/target.json & rust/*) in the >> kernel's shared workdir, and perhaps the kernel config so that we can >> give a sensible error message if they are missing. This means that >> module-rust.bbclass doesn't need to check KERNEL_FEATURES for >> rust-kernel, it can just look at the shared workdir (probably in >> do_configure) to make sure that we're ready to build a Rust module. > After I sent this, I spotted a patch for module.bbclass to check that > CONFIG_MODULES is enabled [1]. Doing the same thing in a new > module-rust.bbclass to check for CONFIG_RUST may be exactly what we > need. > > [1]: https://lore.kernel.org/openembedded-core/20260204020908.864912-1-kai.kang@windriver.com/T/#u Hi Paul, I have incorporated the suggested changes and sent v6 of the series. Thanks, Harish >> If we can't use KERNEL_FEATURES, then perhaps a new KERNEL_RUST_SUPPORT >> variable would work. In either case, this should only be checked in the >> kernel recipe itself. >> >> Bruce - what do you think about KERNEL_FEATURES being used in this way? >> >> Best regards, >>
From: Harish Sadineni <Harish.Sadineni@windriver.com> v5: - Regression in autobuilder with v4 series is due to applying v4 series together with following patch "llvm: enable LLVMgold.so build by adding binutils dependency"(https://lists.openembedded.org/g/openembedded-core/message/229387) is fixed by droping Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091). - Updated patch "rust: install Rust library sources for 'make rustavailable' support" to install rust standard library sources for rust-native. v4: - Resolved patchtest failures. v3: - Removed the DISTRO_FEATURES dependency for installing Rust library sources in the Rust recipe, - Extended support for on target rust kernel module developmet by installing Rust library sources and introduced packaging of the Rust standard library sources in a dedicated ${PN}-src-lib package. - Integrated Alistair Francis's patch(https://lists.openembedded.org/g/openembedded-core/message/229091) that uses the Rust bootstrap tool to install Rust library sources for rust-native. - Dropped the patch that added rust-kernel to native/nativesdk feature filters in bitbake.conf. - Updated flags in the make-mod-scripts recipe to fix build failures when building Rust out-of-tree module recipes. - Dropped the bindgen-cli patch extending BBCLASSEXTEND to include nativesdk, as it has been merged into oe-core. v2: - Combined [PATCH 05/16][0] & [PATCH 06/16][1] from v1. - Updated commit message and added in code comments for patch "[PATCH 09/15] kernel-devsrc: copying rust-kernel source to $kerneldir/build" [0] https://lists.openembedded.org/g/openembedded-core/message/228559 [1] https://lists.openembedded.org/g/openembedded-core/message/228560 v1: The previous series was RFC v4, "Enable Rust support for Linux kernel" (https://lists.openembedded.org/g/openembedded-core/message/226623). In addition, Yoann Congal posted RFC v2, "Kernel Rust out-of-tree module support" (https://lists.openembedded.org/g/openembedded-core/message/227281), which builds on top of RFC v4. The current patch series is a unified version that combines both efforts. Compared to the earlier series, the main changes are: -Kernel configuration fragments have been moved to yocto-kernel-cache. -The kernel fragments have been removed from SRC_URI and from the files directory previously stored underrecipes-kernel/linux/files. -Updated the "[PATCH 11/16] selftest/cases/runtime_test: Add test for Linux Rust sample" by appending KERNEL_EXTRA_FEATURES:append = 'features/kernel-sample/kernel-rust-sample.scc' instead of adding this directly in the linux-yocto recipe. This patch series introduces Rust support into the linux-yocto kernel recipe and related build infrastructure in the Yocto Project. The goal is to enable building the Linux kernel with Rust components and provide support for building kernel module which is written in rust and also provide support to build rust kernel modules in sdk. And this series adds test for Linux Rust sample and also added support for out-of-tree kernel module written in Rust as well as associated test. Summary of patches: - Patch 01: Add required dependencies ('clang-native', 'rust-native','bindgen-cli-native') to the kernel to support Rust binding generation. - Patch 02: Install the Rust standard library source ('library/') for native,target and sdk. - Patch 03: Updated `kernel-yocto.bbclass` to invoke `make rustavailable` during 'do_kernel_configme', ensuring Rust readiness. - Patch 04: Add kernel configuration support for Rust (via 'kernel-rust.scc'), enabling the Rust build options in kernel config. - Patch 05: Fixed buildpaths errors when rust is enabled for kernel by appending --remap-path-prefix to RUST_DEBUG_REMAP - Patch 06: split `HOSTCC` flag to align with to linux-yocto and fix build issue with make-mod-scripts recipe. - Patch 07: Disabling ccache when rust-kernel is enabled for linux-yocto. - Patch 08: Copy Rust kernel sources into kernel-devsrc build directory which will be required while running 'make prepare' in sdk. - Patch 09: Added oe-selftest case for the Linux Rust sample. - patch 10: Copying include/config/auto.conf in STAGING_KERNEL_BUILDDIR - patch 11: Export artifacts needed for out-of-tree Rust compilation - patch 12: Prepare out-of-tree rust module compilation - patch 13: Added rust-out-of-tree-module recipe in meta-skeleton layer - Patch 14: Fixed buildpaths errors for rust-out-of-tree-module recipe by appending --remap-path-prefix to RUST_DEBUG_REMAP - patch 15: Added rust-out-of-tree selftest Patches have been build-tested successfully on: - qemuarm64 - qemux86-64 Benchmark test-result for x86-64: +-------------------------------+------------+-----------+-----------+-----------+ | DISTRO_FEATURES | real | user | sys | FS usage | +-------------------------------+------------+-----------+-----------+-----------+ | rust-kernel (enabled) | 46m1.720s | 0m28.864s | 0m3.696s | 58 GB | | rust-kernel (disabled) | 30m1.053s | 0m20.091s | 0m2.748s | 33 GB | +-------------------------------+------------+-----------+-----------+-----------+ The increased in time & fs is due to kernel rust dependencies in linux-yocto. Harish Sadineni (8): linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS rust: install Rust library sources for 'make rustavailable' support kernel-yocto: enable Rust kernel support via 'make rustavailable'. linux-yocto: enable Rust support in kernel configuration kernel-yocto: Fix for buildpaths errors when rust is enabled for kernel make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto kernel-devsrc: copying rust-kernel source to $kerneldir/build make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Yoann Congal (7): kernel-yocto.bbclass: Disable ccache when rust-kernel is enabled selftest/cases/runtime_test: Add test for Linux Rust sample kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR kernel.bbclass: Export artifacts needed for out-of-tree Rust compilation module.bbclass: Prepare out-of-tree rust module compilation meta-skeleton: Add rust-out-of-tree-module recipe runtime_test: Add rust-out-of-tree selftest .../rust-out-of-tree-module_git.bb | 18 ++++++++++ meta/classes-recipe/kernel-yocto.bbclass | 22 ++++++++++++ meta/classes-recipe/kernel.bbclass | 19 ++++++++++ meta/classes-recipe/module.bbclass | 8 +++++ meta/lib/oeqa/selftest/cases/runtime_test.py | 35 +++++++++++++++++++ meta/recipes-devtools/rust/rust_1.92.0.bb | 19 +++++++++- meta/recipes-kernel/linux/kernel-devsrc.bb | 9 +++++ meta/recipes-kernel/linux/linux-yocto.inc | 2 ++ meta/recipes-kernel/linux/linux-yocto_6.16.bb | 1 + meta/recipes-kernel/linux/linux-yocto_6.18.bb | 1 + .../make-mod-scripts/make-mod-scripts_1.0.bb | 10 +++++- 11 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 meta-skeleton/recipes-kernel/rust-out-of-tree-module/rust-out-of-tree-module_git.bb