public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Harish.Sadineni@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: Randy.MacLeod@windriver.com, Sundeep.Kokkonda@windriver.com,
	paul@pbarker.dev, yoann.congal@smile.fr
Subject: [PATCH v7 08/14] kernel-devsrc: copying rust-kernel source to $kerneldir/build
Date: Wed,  4 Mar 2026 09:43:18 -0800	[thread overview]
Message-ID: <20260304174324.1186644-9-Harish.Sadineni@windriver.com> (raw)
In-Reply-To: <20260304174324.1186644-1-Harish.Sadineni@windriver.com>

From: Harish Sadineni <Harish.Sadineni@windriver.com>

When CONFIG_RUST is enabled, running 'make prepare' in the  target & SDK
fails because the Rust kernel infrastructure is incomplete in the staged
kernel sources.

The Rust build system requires a wider set of interdependent sources
during make prepare, including bindgen inputs, C helper sources,
generated headers, and other support files. These are all located under
the kernel rust/ directory.

To ensure make prepare succeeds and to support building Rust-based
kernel modules from the  target & SDK, copy the full rust/ directory
(of size 2.5MB) into $kerneldir/build when the rust-kernel distro feature
is enabled.

Additionally, when Rust support is enabled, 'make prepare' generates
.rmeta files (crate metadata in a custom binary format) and shared
objects (.so) that are required for compiling Rust kernel modules.

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 23a9093ede..d9b09a3d9a 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -140,6 +140,15 @@ do_install() {
 
         cp -a scripts $kerneldir/build
 
+        # In sdk, when CONFIG_RUST is enabled, `make prepare` requires the full Rust
+        # kernel infrastructure. The Rust build system pulls in bindgen inputs, C helpers,
+        # generated headers, and generate crate metadata (.rmeta), and shared objects
+        # needed for building Rust kernel modules. Copy the entire rust/ directory (of size 2.5MB)
+        # to avoid failures with 'make prepare'.
+        if ${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', '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



  parent reply	other threads:[~2026-03-04 17:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 17:43 [PATCH v7 00/14] Enable rust support for linux kernel Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
2026-03-09 11:26   ` [OE-core] " Richard Purdie
2026-03-09 16:09     ` Harish Sadineni
2026-03-09 16:29       ` Bruce Ashfield
2026-03-09 16:53         ` Harish Sadineni
2026-03-09 18:01           ` Bruce Ashfield
2026-03-09 19:20             ` Richard Purdie
2026-03-10 10:57               ` Harish Sadineni
2026-03-10 12:44                 ` Bruce Ashfield
2026-03-10 13:30                   ` Harish Sadineni
2026-03-10 13:40                     ` Bruce Ashfield
2026-03-12 13:34   ` Richard Purdie
2026-03-12 22:21     ` Yoann Congal
2026-03-04 17:43 ` [PATCH v7 02/14] rust: install Rust library sources for 'make rustavailable' support Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 03/14] kernel-yocto-rust: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 04/14] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 05/14] kernel-yocto-rust: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 06/14] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 07/14] kernel: Disable ccache when kernel rust support is enabled Harish.Sadineni
2026-03-04 17:43 ` Harish.Sadineni [this message]
2026-03-04 17:43 ` [PATCH v7 09/14] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 10/14] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 11/14] module-rust.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 12/14] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 13/14] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
2026-03-04 17:43 ` [PATCH v7 14/14] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260304174324.1186644-9-Harish.Sadineni@windriver.com \
    --to=harish.sadineni@windriver.com \
    --cc=Randy.MacLeod@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul@pbarker.dev \
    --cc=yoann.congal@smile.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox