Re: [OE-core] [PATCH v7 01/14] linux-yocto: conditionally add clang/rust/bindgen-cli-native to DEPENDS

Bruce Ashfield
2026-03-09T16:29:34Z

[-- Attachment #1: Type: text/plain, Size: 3511 bytes --]

On Mon, Mar 9, 2026 at 12:10 PM Harish Sadineni <
Harish.Sadineni@windriver.com> wrote:

>
> On 3/9/2026 4:56 PM, Richard Purdie 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.
>
> On Wed, 2026-03-04 at 09:43 -0800, Sadineni, Harish via lists.openembedded.org wrote:
>
> From: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
>
> Conditionally add 'clang-native', 'rust-native' and 'bindgen-cli-native' to 'DEPENDS'
> when Kernel Rust Support is enabled.
>
> These tools are required for building Rust-enabled kernels and for
> generating Rust FFI bindings via bindgen during the kernel build.
>
> This ensures the additional dependencies are only pulled in when
> Rust support is explicitly enabled, avoiding unnecessary native
> dependencies for non-Rust kernel builds.
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com> <Harish.Sadineni@windriver.com>
> ---
> meta/recipes-kernel/linux/linux-yocto.inc | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
> index 4d0a726bb6..b7961bbcdf 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -76,11 +76,14 @@ do_install:append(){
> KERNEL_FEATURES:append:qemuall = " features/kernel-sample/kernel-sample.scc"
>
> KERNEL_DEBUG ?= ""
> +KERNEL_RUST_SUPPORT ?= ""
> # These used to be version specific, but are now common dependencies. New
> # tools / dependencies will continue to be added in version specific recipes.
> DEPENDS += '${@bb.utils.contains_any("ARCH", [ "x86", "arm64", "powerpc" ], "elfutils-native", "", d)}'
> DEPENDS += "openssl-native util-linux-native"
> DEPENDS += "gmp-native libmpc-native"
> +RUST_KERNEL_DEPENDS ?= "${@bb.utils.contains('KERNEL_RUST_SUPPORT', 'True', 'clang-native rust-native bindgen-cli-native', '', d)}" <$%7B@bb.utils.contains('KERNEL_RUST_SUPPORT','True','clang-nativerust-nativebindgen-cli-native','',d)%7D>
> +DEPENDS += "${RUST_KERNEL_DEPENDS}"
>
> # 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)}'
>
> I thought we were going to try and use KERNEL_FEATURES for this?
>
> Hi Richard,
>
> I have tried this but i got circular dependency error with
> KERNEL_FEATURES. So, I opted using variable KERNEL_RUST_SUPPORT.
>

I'm curious about that. Can you share the details ? (diff and the bitbake
error)

Bruce

> The implementation of KERNEL_RUST_SUPPORT is problematic as it only
> works for the value of "True", not "true", or "1" or 1 or any other
> thing people might dream up. "Contains" isn't really an appropriate
> mechanism for a boolean either.
>
> You can use bb.utils.to_boolean() as a way to better obtain a boolean
> value from a random variable.
>
> Understood, Earlier i took reference from the code that already present in
> that file.
> I have updated the code we will send v8.
>
> Thanks,
> Harish
>
> Cheers,
>
> Richard
>
>
>
>
>
>
>

--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: Type: text/html, Size: 5255 bytes --]