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, alistair.francis@wdc.com,
	Sundeep.Kokkonda@windriver.com, bruce.ashfield@gmail.com,
	richard.purdie@linuxfoundation.org, yoann.congal@smile.fr,
	elmehdi.younes@smile.fr
Subject: [PATCH v3 03/16] rust: install Rust library sources for target & sdk
Date: Tue, 20 Jan 2026 09:52:33 -0800	[thread overview]
Message-ID: <20260120175246.2052341-4-Harish.Sadineni@windriver.com> (raw)
In-Reply-To: <20260120175246.2052341-1-Harish.Sadineni@windriver.com>

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

The `make rustavailable` process (1) 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:
- Installing the `library/` directory (of size ~50MB) into `${D}${libdir}/rustlib/src/rust` for `target` class,
  making them available in them available on target.
- Installing the `library/` directory (of size ~50MB) into `${SDKPATHNATIVE}/usr/lib/rustlib/src/rust` for the
  `nativesdk` class, making them available in them available in sdk.
- packaging `${libdir}/rustlib/src/rust` sepearately with `${PN}-src-lib`.

1) See the kernel tree for Documentation/rust/quick-start.rst in the section: Requirements: Building

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/rust/quick-start.rst#n145

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-devtools/rust/rust_1.92.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb b/meta/recipes-devtools/rust/rust_1.92.0.bb
index af739df88a..eaab6a1c16 100644
--- a/meta/recipes-devtools/rust/rust_1.92.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.92.0.bb
@@ -265,10 +265,11 @@ do_test_compile () {
 
 ALLOW_EMPTY:${PN} = "1"
 
-PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt"
+PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt ${PN}-src-lib"
 FILES:${PN}-rustdoc = "${bindir}/rustdoc"
 FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver"
 FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt"
+FILES:${PN}-src-lib = "${libdir}/rustlib/src/rust"
 
 RDEPENDS:${PN}-rustdoc = "${PN}"
 RDEPENDS:${PN}-tools-clippy = "${PN}"
@@ -316,6 +317,11 @@ rust_do_install:class-nativesdk() {
 	export CARGO_TARGET_${RUST_HOST_TRIPLE}_RUNNER="\$OECORE_NATIVE_SYSROOT/lib/${SDKLOADER}"
 	export CC_$RUST_HOST_CC="${CCACHE}${HOST_PREFIX}gcc"
 	EOF
+
+    install -d ${D}${SDKPATHNATIVE}/usr/lib/rustlib/src/rust
+    cp -r ${S}/library ${D}${SDKPATHNATIVE}/usr/lib/rustlib/src/rust
+    find ${D}${libdir}/rustlib/src/rust/ -name "*.sh" -type f -delete
+
 }
 
 FILES:${PN} += "${base_prefix}/environment-setup.d"
@@ -336,6 +342,11 @@ rust_do_install:class-target() {
 
     install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS}
     install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json
+    install -d ${D}${libdir}/rustlib/src/rust
+    cp -r ${S}/library/ ${D}${libdir}/rustlib/src/rust/
+    find ${D}${libdir}/rustlib/src/rust/ -name "*.sh" -type f -delete
+    install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/${RUST_HOST_SYS}.json
+
 
     chown root:root ${D}/ -R
     rm ${D}${libdir}/rustlib/uninstall.sh
-- 
2.49.0



  parent reply	other threads:[~2026-01-20 17:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 17:52 [PATCH v3 00/16] Enable rust support for linux kernel Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 01/16] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 02/16] rust: Install the Rust source Harish.Sadineni
2026-01-20 18:01   ` Patchtest results for " patchtest
2026-01-20 17:52 ` Harish.Sadineni [this message]
2026-01-20 17:52 ` [PATCH v3 04/16] kernel-yocto: enable Rust kernel support via 'make rustavailable' Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 05/16] linux-yocto: enable Rust support in kernel configuration Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 06/16] kernel-yocto: Fix for buildpaths errors when rust is enabled for kernel Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 07/16] make-mod-scripts: split `HOSTCC` flag to align with to linux-yocto Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 08/16] kernel-yocto.bbclass: Disable ccache when rust-kernel is enabled Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 09/16] kernel-devsrc: copying rust-kernel source to $kerneldir/build Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 10/16] selftest/cases/runtime_test: Add test for Linux Rust sample Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 11/16] kernel.bbclass: Copy include/config/auto.conf in STAGING_KERNEL_BUILDDIR Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 12/16] kernel.bbclass: Export artifacts needed for out-of-tree Rust compilation Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 13/16] module.bbclass: Prepare out-of-tree rust module compilation Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 14/16] meta-skeleton: Add rust-out-of-tree-module recipe Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 15/16] make-mod-scripts: fix for buildpath issues with rust-out-of-tree compilation Harish.Sadineni
2026-01-20 17:52 ` [PATCH v3 16/16] runtime_test: Add rust-out-of-tree selftest Harish.Sadineni
2026-01-20 18:00 ` [PATCH v3 00/16] Enable rust support for linux kernel Sadineni, Harish

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=20260120175246.2052341-4-Harish.Sadineni@windriver.com \
    --to=harish.sadineni@windriver.com \
    --cc=Randy.MacLeod@windriver.com \
    --cc=Sundeep.Kokkonda@windriver.com \
    --cc=alistair.francis@wdc.com \
    --cc=bruce.ashfield@gmail.com \
    --cc=elmehdi.younes@smile.fr \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    --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