diff mbox series

[06/16] kernel-yocto: add rust support via "make rustavailable" in do_kernel_configme

Message ID 20251227113251.773795-7-Harish.Sadineni@windriver.com
State Under Review
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>

To enable Rust integration in the Linux kernel build, this patch:

- Adds `rust-native`, `clang-native` and `bindgen-cli-native` to `do_kernel_configme[depends]`
  to ensure required tools are available for Rust support.
- Invokes `make rustavailable` inside `do_kernel_configme()` to prepare
  the kernel for building Rust-based modules or core components.

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

Comments

Bruce Ashfield Dec. 27, 2025, 3:05 p.m. UTC | #1
And here's the answer to my previous question.

To me, this patch should be squashed with 05/16.

Bruce

On Sat, Dec 27, 2025 at 7:33 AM <Harish.Sadineni@windriver.com> wrote:
>
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> To enable Rust integration in the Linux kernel build, this patch:
>
> - Adds `rust-native`, `clang-native` and `bindgen-cli-native` to `do_kernel_configme[depends]`
>   to ensure required tools are available for Rust support.
> - Invokes `make rustavailable` inside `do_kernel_configme()` to prepare
>   the kernel for building Rust-based modules or core components.
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/classes-recipe/kernel-yocto.bbclass | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
> index 2584cadf0d..dda235d4d0 100644
> --- a/meta/classes-recipe/kernel-yocto.bbclass
> +++ b/meta/classes-recipe/kernel-yocto.bbclass
> @@ -463,6 +463,11 @@ do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
>  do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
>  do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
>  do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
> +RUST_KERNEL_TASK_DEPENDS ?=  "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' \
> +                                  rust-native:do_populate_sysroot \
> +                                  clang-native:do_populate_sysroot \
> +                                  bindgen-cli-native:do_populate_sysroot', '', d)}"
> +do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
>  do_kernel_configme[dirs] += "${S} ${B}"
>  do_kernel_configme() {
>         if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
> @@ -513,6 +518,10 @@ do_kernel_configme() {
>                 echo "# Global settings from linux recipe" >> ${B}/.config
>                 echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
>         fi
> +
> +       if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
> +               oe_runmake -C ${S} O=${B} rustavailable
> +       fi
>  }
>
>  addtask kernel_configme before do_configure after do_patch
> --
> 2.49.0
>
Harish Sadineni Dec. 29, 2025, 10:59 a.m. UTC | #2
On 12/27/2025 8:35 PM, Bruce Ashfield 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.
>
> And here's the answer to my previous question.
>
> To me, this patch should be squashed with 05/16.
OK Bruce, I’ll combine this patch with 05/16 and send it as v2.

Thanks,
Harish
>
> Bruce
>
> On Sat, Dec 27, 2025 at 7:33 AM <Harish.Sadineni@windriver.com> wrote:
>> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>>
>> To enable Rust integration in the Linux kernel build, this patch:
>>
>> - Adds `rust-native`, `clang-native` and `bindgen-cli-native` to `do_kernel_configme[depends]`
>>    to ensure required tools are available for Rust support.
>> - Invokes `make rustavailable` inside `do_kernel_configme()` to prepare
>>    the kernel for building Rust-based modules or core components.
>>
>> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
>> ---
>>   meta/classes-recipe/kernel-yocto.bbclass | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
>> index 2584cadf0d..dda235d4d0 100644
>> --- a/meta/classes-recipe/kernel-yocto.bbclass
>> +++ b/meta/classes-recipe/kernel-yocto.bbclass
>> @@ -463,6 +463,11 @@ do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
>>   do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
>>   do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
>>   do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
>> +RUST_KERNEL_TASK_DEPENDS ?=  "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' \
>> +                                  rust-native:do_populate_sysroot \
>> +                                  clang-native:do_populate_sysroot \
>> +                                  bindgen-cli-native:do_populate_sysroot', '', d)}"
>> +do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
>>   do_kernel_configme[dirs] += "${S} ${B}"
>>   do_kernel_configme() {
>>          if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
>> @@ -513,6 +518,10 @@ do_kernel_configme() {
>>                  echo "# Global settings from linux recipe" >> ${B}/.config
>>                  echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
>>          fi
>> +
>> +       if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
>> +               oe_runmake -C ${S} O=${B} rustavailable
>> +       fi
>>   }
>>
>>   addtask kernel_configme before do_configure after do_patch
>> --
>> 2.49.0
>>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index 2584cadf0d..dda235d4d0 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -463,6 +463,11 @@  do_kernel_configme[depends] += "virtual/cross-binutils:do_populate_sysroot"
 do_kernel_configme[depends] += "virtual/cross-cc:do_populate_sysroot"
 do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_populate_sysroot"
 do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
+RUST_KERNEL_TASK_DEPENDS ?=  "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', ' \
+                                  rust-native:do_populate_sysroot \
+                                  clang-native:do_populate_sysroot \
+                                  bindgen-cli-native:do_populate_sysroot', '', d)}"
+do_kernel_configme[depends] += "${RUST_KERNEL_TASK_DEPENDS}"
 do_kernel_configme[dirs] += "${S} ${B}"
 do_kernel_configme() {
 	if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
@@ -513,6 +518,10 @@  do_kernel_configme() {
 		echo "# Global settings from linux recipe" >> ${B}/.config
 		echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config
 	fi
+        
+	if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then
+		oe_runmake -C ${S} O=${B} rustavailable
+	fi
 }
 
 addtask kernel_configme before do_configure after do_patch