diff mbox series

[v9,01/14] kernel-yocto: Enable rust in kernel

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

Commit Message

Harish Sadineni March 13, 2026, 3:59 p.m. UTC
From: Harish Sadineni <Harish.Sadineni@windriver.com>

Allow enabling Rust support in the kernel by simply adding "rust" to
KERNEL_FEATURES in local.conf or a global configuration file. This maps the
feature name to the appropriate kernel configuration fragment located
at features/kernel-rust/kernel-rust.scc

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

Comments

Bruce Ashfield March 13, 2026, 4:07 p.m. UTC | #1
On Fri, Mar 13, 2026 at 11:59 AM <Harish.Sadineni@windriver.com> wrote:

> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> Allow enabling Rust support in the kernel by simply adding "rust" to
> KERNEL_FEATURES in local.conf or a global configuration file. This maps the
> feature name to the appropriate kernel configuration fragment located
> at features/kernel-rust/kernel-rust.scc
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
>  meta/classes-recipe/kernel-yocto.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes-recipe/kernel-yocto.bbclass
> b/meta/classes-recipe/kernel-yocto.bbclass
> index e53bf15194..a77f2214c2 100644
> --- a/meta/classes-recipe/kernel-yocto.bbclass
> +++ b/meta/classes-recipe/kernel-yocto.bbclass
> @@ -269,6 +269,9 @@ do_kernel_metadata() {
>         KERNEL_FEATURES_FINAL=""
>         if [ -n "${KERNEL_FEATURES}" ]; then
>                 for feature in ${KERNEL_FEATURES}; do
> +                       if [ "$feature" = "rust" ]; then
> +
>  feature="features/kernel-rust/kernel-rust.scc"
> +                       fi
>

I'll factor this out to a dedicated routine that expands shorthand to the
fragments to take into account some additional considerations, but this
is good for now.

Bruce



>                         feature_as_specified="$feature"
>                         feature="$(echo $feature_as_specified | cut -d:
> -f1)"
>                         feature_specifier="$(echo $feature_as_specified |
> cut -d: -f2)"
> --
> 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..a77f2214c2 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -269,6 +269,9 @@  do_kernel_metadata() {
 	KERNEL_FEATURES_FINAL=""
 	if [ -n "${KERNEL_FEATURES}" ]; then
 		for feature in ${KERNEL_FEATURES}; do
+			if [ "$feature" = "rust" ]; then
+				feature="features/kernel-rust/kernel-rust.scc"
+			fi
 			feature_as_specified="$feature"
 			feature="$(echo $feature_as_specified | cut -d: -f1)"
 			feature_specifier="$(echo $feature_as_specified | cut -d: -f2)"