From: Harish Sadineni <[email protected]> When CONFIG_RUST is enabled, running 'make prepare' in the target & SDK fails because the Rust kernel infrastructure is incomplete in the staged kernel sources.
The Rust build system requires a wider set of interdependent sources during make prepare, including bindgen inputs, C helper sources, generated headers, and other support files. These are all located under the kernel rust/ directory. To ensure make prepare succeeds and to support building Rust-based kernel modules from the target & SDK, copy the full rust/ directory (of size 2.5MB) into $kerneldir/build when the rust-kernel distro feature is enabled. Additionally, when Rust support is enabled, 'make prepare' generates .rmeta files (crate metadata in a custom binary format) and shared objects (.so) that are required for compiling Rust kernel modules. Signed-off-by: Harish Sadineni <[email protected]> --- meta/recipes-kernel/linux/kernel-devsrc.bb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb index 23a9093ede..07f082132b 100644 --- a/meta/recipes-kernel/linux/kernel-devsrc.bb +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb @@ -139,6 +139,15 @@ do_install() { cd ${S} cp -a scripts $kerneldir/build + + # In sdk, when CONFIG_RUST is enabled, `make prepare` requires the full Rust + # kernel infrastructure. The Rust build system pulls in bindgen inputs, C helpers, + # generated headers, and generate crate metadata (.rmeta), and shared objects + # needed for building Rust kernel modules. Copy the entire rust/ directory (of size 2.5MB) + # to avoid failures with 'make prepare'. + if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then + cp -a rust ${kerneldir}/build + fi # for v6.1+ (otherwise we are missing multiple default targets) cp -a --parents Kbuild $kerneldir/build 2>/dev/null || : -- 2.49.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#229756): https://lists.openembedded.org/g/openembedded-core/message/229756 Mute This Topic: https://lists.openembedded.org/mt/117367359/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
