| Message ID | 20251105130942.833204-6-Harish.Sadineni@windriver.com |
|---|---|
| State | New |
| Headers | show |
| Series | Enable rust support for linux kernel | expand |
On Wed, Nov 5, 2025 at 8:10 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. > > The `make rustavailable` target requires the Rust standard library sources > to be > present under `${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust`, which is > handled > in the `rust` recipe via shared staging. > > 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 e53bf15194..7a115bdffd 100644 > --- a/meta/classes-recipe/kernel-yocto.bbclass > +++ b/meta/classes-recipe/kernel-yocto.bbclass > @@ -463,6 +463,10 @@ 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" > +do_kernel_configme[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)}" > for consistency (with the other rust changes), these could be assigned to a variable first (?=) and then assigned. That allows them to be tweaked more easily while the support is being developed. Bruce > do_kernel_configme[dirs] += "${S} ${B}" > do_kernel_configme() { > do_kernel_metadata config > @@ -507,6 +511,11 @@ do_kernel_configme() { > echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" > >> ${B}/.config > fi > } > +do_kernel_configme:append() { > + 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 > addtask config_analysis > -- > 2.49.0 > >
Le 05/11/2025 à 14:09, Sadineni, Harish via lists.openembedded.org a écrit : > 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. > > The `make rustavailable` target requires the Rust standard library sources to be > present under `${STAGING_DIR_NATIVE}/usr/lib/rustlib/src/rust`, which is handled > in the `rust` recipe via shared staging. > > 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 e53bf15194..7a115bdffd 100644 > --- a/meta/classes-recipe/kernel-yocto.bbclass > +++ b/meta/classes-recipe/kernel-yocto.bbclass > @@ -463,6 +463,10 @@ 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" > +do_kernel_configme[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[dirs] += "${S} ${B}" > do_kernel_configme() { > do_kernel_metadata config > @@ -507,6 +511,11 @@ do_kernel_configme() { > echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config > fi > } > +do_kernel_configme:append() { > + if ${@bb.utils.contains('DISTRO_FEATURES', 'rust-kernel', 'true', 'false', d)}; then > + oe_runmake -C ${S} O=${B} rustavailable > + fi (same question as in a previous patch) Why not adding this code to do_kernel_configme() defined just above? > +} > > addtask kernel_configme before do_configure after do_patch > addtask config_analysis > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#225762): https://lists.openembedded.org/g/openembedded-core/message/225762 > Mute This Topic: https://lists.openembedded.org/mt/116133831/4316185 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [yoann.congal@smile.fr] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass index e53bf15194..7a115bdffd 100644 --- a/meta/classes-recipe/kernel-yocto.bbclass +++ b/meta/classes-recipe/kernel-yocto.bbclass @@ -463,6 +463,10 @@ 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" +do_kernel_configme[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[dirs] += "${S} ${B}" do_kernel_configme() { do_kernel_metadata config @@ -507,6 +511,11 @@ do_kernel_configme() { echo "CONFIG_LOCALVERSION="\"${LINUX_VERSION_EXTENSION}\" >> ${B}/.config fi } +do_kernel_configme:append() { + 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 addtask config_analysis