diff mbox series

[05/16] kernel-yocto: stage rustlib sources for linux-yocto 'make rustavailable' support

Message ID 20251227113251.773795-6-Harish.Sadineni@windriver.com
State New
Headers show
Series Enable rust support for linux kernel | expand

Commit Message

Harish Sadineni Dec. 27, 2025, 11:32 a.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

When building the Linux kernel with Rust support enabled (e.g., via `make rustavailable`),
the build system expects the Rust standard library sources to be available under:
${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/classes-recipe/kernel-yocto.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Bruce Ashfield Dec. 27, 2025, 3:03 p.m. UTC | #1
On Sat, Dec 27, 2025 at 7:33 AM <Harish.Sadineni@windriver.com> wrote:
>
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> When building the Linux kernel with Rust support enabled (e.g., via `make rustavailable`),
> the build system expects the Rust standard library sources to be available under:
> ${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/classes-recipe/kernel-yocto.bbclass | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
> index e53bf15194..2584cadf0d 100644
> --- a/meta/classes-recipe/kernel-yocto.bbclass
> +++ b/meta/classes-recipe/kernel-yocto.bbclass
> @@ -465,6 +465,13 @@ do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_po
>  do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
>  do_kernel_configme[dirs] += "${S} ${B}"
>  do_kernel_configme() {
> +       if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
> +               if [ ! -d ${STAGING_LIBDIR_NATIVE}/rustlib/src/rust ]; then
> +                       mkdir -p ${STAGING_LIBDIR_NATIVE}/rustlib/src/
> +                       cp -r ${TMPDIR}/work-shared/rust ${STAGING_LIBDIR_NATIVE}/rustlib/src/.
> +               fi
> +       fi

There should be a comment both here, and in the commit message
about why this is done in the configme task.  i.e. is it related to
configuration ?

Bruce

> +
>         do_kernel_metadata config
>
>         # translate the kconfig_mode into something that merge_config.sh
> --
> 2.49.0
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e53bf15194..2584cadf0d 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -465,6 +465,13 @@  do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_po
 do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
 do_kernel_configme[dirs] += "${S} ${B}"
 do_kernel_configme() {
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
+		if [ ! -d ${STAGING_LIBDIR_NATIVE}/rustlib/src/rust ]; then
+			mkdir -p ${STAGING_LIBDIR_NATIVE}/rustlib/src/
+			cp -r ${TMPDIR}/work-shared/rust ${STAGING_LIBDIR_NATIVE}/rustlib/src/.
+		fi
+	fi
+
 	do_kernel_metadata config
 
 	# translate the kconfig_mode into something that merge_config.sh