diff mbox series

[RFC,v2,2/8] linux-yocto: add clang-native,rust-native and bindgen-cli-native to DEPENDS

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

Commit Message

Harish Sadineni Nov. 5, 2025, 1:09 p.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

Add `clang-native`, `rust-native'  and `bindgen-cli-native` to `DEPENDS` to support
Rust-based kernel modules or features that require generating Rust FFI bindings using
bindgen during the kernel build process

Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
---
 meta/recipes-kernel/linux/linux-yocto.inc | 1 +
 1 file changed, 1 insertion(+)

Comments

Bruce Ashfield Nov. 5, 2025, 1:30 p.m. UTC | #1
I'm reviewing both series that have come out for rust in the kernel.

I'll leave it up to the submitters to figure out if there are differences
between
the two series that need to be consolidated.

On Wed, Nov 5, 2025 at 8:10 AM <Harish.Sadineni@windriver.com> wrote:

> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> Add `clang-native`, `rust-native'  and `bindgen-cli-native` to `DEPENDS`
> to support
> Rust-based kernel modules or features that require generating Rust FFI
> bindings using
> bindgen during the kernel build process
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/recipes-kernel/linux/linux-yocto.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
> b/meta/recipes-kernel/linux/linux-yocto.inc
> index 4d0a726bb6..e2ffd96b59 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -81,6 +81,7 @@ KERNEL_DEBUG ?= ""
>  DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc"
> ], "elfutils-native", "", d)}'
>  DEPENDS += "openssl-native util-linux-native"
>  DEPENDS += "gmp-native libmpc-native"
> +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel',
> 'clang-native rust-native bindgen-cli-native', '', d)}"
>

I'd suggest that those dependencies should be in a variable, assigned with
?= and then use the
variable in the DEPENDS line. That makes it easier to adjust from
bbappends, etc.

Bruce




>
>  # Some options depend on CONFIG_PAHOLE_VERSION, so need to make
> pahole-native available before do_kernel_configme
>  do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG",
> "True", "pahole-native:do_populate_sysroot", "", d)}'
> --
> 2.49.0
>
>
Randy MacLeod Nov. 5, 2025, 4:25 p.m. UTC | #2
On 2025-11-05 8:30 a.m., Bruce Ashfield wrote:
> I'm reviewing both series that have come out for rust in the kernel.
>
> I'll leave it up to the submitters to figure out if there are 
> differences between
> the two series that need to be consolidated.

Yoann and I have been talking and unfortunately, Elmedhi doesn't have 
time to
continue to work on enabling kernel Rust support.  I've suggested to Harish
that we add Elmedhi's SOB line to the patches where it make sense.
Harish will continue the work and hopefully we will be ready to merge
early in 6.0.

Thanks for the prompt reviews Bruce.

Harish,

For v3 or even v4, it would be good to benchmark:
$ bitbake linux-yocto
before and after your patch set.
You should share the approximate build times and the FS usage.


We'll try to figure out how to speed up this workflow by optionally enabling
users to provide the Rust binaries using rust-up or something like that.
I don't really know how to go about that but I'm sure we'll figure it 
out with some help
from the YP community.

../Randy


>
> On Wed, Nov 5, 2025 at 8:10 AM <Harish.Sadineni@windriver.com> wrote:
>
>     From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
>     Add `clang-native`, `rust-native'  and `bindgen-cli-native` to
>     `DEPENDS` to support
>     Rust-based kernel modules or features that require generating Rust
>     FFI bindings using
>     bindgen during the kernel build process
>
>     Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
>     ---
>      meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ZIZow7znH24hp-Bzsr1MbyP1rpVYh0VDQlXOEul6CEdsYkpvfWwn9RxbJGBwCQ_KRh-xMdj9ROY77mn_TMYmdbyxGUmCRg$>
>     | 1 +
>      1 file changed, 1 insertion(+)
>
>     diff --git a/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ZIZow7znH24hp-Bzsr1MbyP1rpVYh0VDQlXOEul6CEdsYkpvfWwn9RxbJGBwCQ_KRh-xMdj9ROY77mn_TMYmdbyxGUmCRg$>
>     b/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ZIZow7znH24hp-Bzsr1MbyP1rpVYh0VDQlXOEul6CEdsYkpvfWwn9RxbJGBwCQ_KRh-xMdj9ROY77mn_TMYmdbyxGUmCRg$>
>     index 4d0a726bb6..e2ffd96b59 100644
>     --- a/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ZIZow7znH24hp-Bzsr1MbyP1rpVYh0VDQlXOEul6CEdsYkpvfWwn9RxbJGBwCQ_KRh-xMdj9ROY77mn_TMYmdbyxGUmCRg$>
>     +++ b/meta/recipes-kernel/linux/linux-yocto.inc
>     <https://urldefense.com/v3/__http://linux-yocto.inc__;!!AjveYdw8EvQ!ZIZow7znH24hp-Bzsr1MbyP1rpVYh0VDQlXOEul6CEdsYkpvfWwn9RxbJGBwCQ_KRh-xMdj9ROY77mn_TMYmdbyxGUmCRg$>
>     @@ -81,6 +81,7 @@ KERNEL_DEBUG ?= ""
>      DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64",
>     "powerpc" ], "elfutils-native", "", d)}'
>      DEPENDS += "openssl-native util-linux-native"
>      DEPENDS += "gmp-native libmpc-native"
>     +DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES',
>     'rust-kernel', 'clang-native rust-native bindgen-cli-native', '', d)}"
>
>
> I'd suggest that those dependencies should be in a variable, assigned 
> with ?= and then use the
> variable in the DEPENDS line. That makes it easier to adjust from 
> bbappends, etc.
>
> Bruce
>
>
>
>      # Some options depend on CONFIG_PAHOLE_VERSION, so need to make
>     pahole-native available before do_kernel_configme
>      do_kernel_configme[depends] +=
>     '${@bb.utils.contains("KERNEL_DEBUG", "True",
>     "pahole-native:do_populate_sysroot", "", d)}'
>     -- 
>     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/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 4d0a726bb6..e2ffd96b59 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -81,6 +81,7 @@  KERNEL_DEBUG ?= ""
 DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
 DEPENDS += "openssl-native util-linux-native"
 DEPENDS += "gmp-native libmpc-native"
+DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'clang-native rust-native bindgen-cli-native', '', d)}"
 
 # Some options depend on CONFIG_PAHOLE_VERSION, so need to make pahole-native available before do_kernel_configme
 do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pahole-native:do_populate_sysroot", "", d)}'