All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-Core][PATCH 1/2] rust: Install the Rust source
@ 2026-01-09  4:54 alistair23
  2026-01-09  4:54 ` [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task alistair23
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: alistair23 @ 2026-01-09  4:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: alistair23, Alistair Francis

From: Alistair Francis <alistair.francis@wdc.com>

When building the Linux kernel with Rust support enabled the kernel
expects to find the Rust source as the kernel build system will cross
compile the core library.

This patch uses the Rust tooling to install the Rust source when we
install the compiller as well.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 ...-host-documentation-is-built-before-.patch | 60 +++++++++++++++++++
 meta/recipes-devtools/rust/rust-source.inc    |  1 +
 meta/recipes-devtools/rust/rust_1.92.0.bb     |  4 +-
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch

diff --git a/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
new file mode 100644
index 0000000000..e561266d70
--- /dev/null
+++ b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
@@ -0,0 +1,60 @@
+From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00 2001
+From: Alistair Francis <alistair.francis@wdc.com>
+Date: Fri, 9 Jan 2026 08:35:43 +1000
+Subject: [PATCH] bootstrap: Ensure host documentation is built before tarball
+ is created
+
+`run_default_doc_steps()` is called to ensure the documentation is built
+by `Docs::run()` and it should build the documentation if it isn't
+already built.
+
+When running the `install src` command I'm seeing failures as the
+`builder.doc_out(host)` directory does not exist. This is because
+`match_paths_to_steps_and_run()` doesn't actually build any
+documentation as the `paths.is_empty()` causes an early return. This
+results in install failures as the `*/doc` src directory doesn't exist.
+
+This patch passes the paths to `run_host_step_descriptions()` when building
+documentation to ensure it is correctly built.
+
+This fixes installing the Rust source code in OpenEmbedded.
+
+Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/150845]
+Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
+---
+ src/bootstrap/src/core/build_steps/dist.rs | 2 +-
+ src/bootstrap/src/core/builder/mod.rs      | 5 +++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
+index f47b0c0b007..2fbb068632e 100644
+--- a/src/bootstrap/src/core/build_steps/dist.rs
++++ b/src/bootstrap/src/core/build_steps/dist.rs
+@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
+         // FIXME: explicitly enumerate the steps that should be executed here, and gather their
+         // documentation, rather than running all default steps and then read their output
+         // from a shared directory.
+-        builder.run_default_doc_steps();
++        builder.run_host_default_doc_steps();
+ 
+         let dest = "share/doc/rust/html";
+ 
+diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
+index 4a04b97c549..16c1c324be0 100644
+--- a/src/bootstrap/src/core/builder/mod.rs
++++ b/src/bootstrap/src/core/builder/mod.rs
+@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) {
+         self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths);
+     }
+ 
++    /// Run all default documentation steps to build documentation.
++    pub fn run_host_default_doc_steps(&self) {
++        self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &self.paths);
++    }
++
+     /// Run all default documentation steps to build documentation.
+     pub fn run_default_doc_steps(&self) {
+         self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc), &[]);
+-- 
+2.52.0
+
diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc
index d7d44510e4..8a22d484c1 100644
--- a/meta/recipes-devtools/rust/rust-source.inc
+++ b/meta/recipes-devtools/rust/rust-source.inc
@@ -8,6 +8,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
             file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC} \
             file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC} \
             file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC} \
+            file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch \
 "
 SRC_URI[rust.sha256sum] = "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307"
 
diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb b/meta/recipes-devtools/rust/rust_1.92.0.bb
index a25f65f674..306661b6e4 100644
--- a/meta/recipes-devtools/rust/rust_1.92.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.92.0.bb
@@ -6,8 +6,9 @@ LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc"
 
 inherit rust
 inherit cargo_common
+inherit pkgconfig
 
-DEPENDS += "llvm"
+DEPENDS += "llvm openssl"
 # native rust uses cargo/rustc from binary snapshots to bootstrap
 # but everything else should use our native builds
 DEPENDS:append:class-target = " cargo-native rust-native"
@@ -282,6 +283,7 @@ do_install () {
 
 rust_do_install() {
     rust_runx install
+    rust_runx install src
 }
 
 rust_do_install:class-nativesdk() {
-- 
2.52.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task
  2026-01-09  4:54 [OE-Core][PATCH 1/2] rust: Install the Rust source alistair23
@ 2026-01-09  4:54 ` alistair23
  2026-01-09 13:56   ` Bruce Ashfield
       [not found]   ` <188914A07F2508FF.2783356@lists.openembedded.org>
  2026-01-09 10:25 ` [OE-Core][PATCH 1/2] rust: Install the Rust source Mathieu Dubois-Briand
  2026-01-09 10:46 ` Yoann Congal
  2 siblings, 2 replies; 9+ messages in thread
From: alistair23 @ 2026-01-09  4:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: alistair23, Alistair Francis

From: Alistair Francis <alistair.francis@wdc.com>

Allow the user to run the rustavailable kernel make command to determine
if Rust is avaliable for kernel builds.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 meta/classes-recipe/cml1.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes-recipe/cml1.bbclass b/meta/classes-recipe/cml1.bbclass
index 3c2b4da4af..efbdd2a795 100644
--- a/meta/classes-recipe/cml1.bbclass
+++ b/meta/classes-recipe/cml1.bbclass
@@ -107,6 +107,15 @@ do_diffconfig[nostamp] = "1"
 do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
 addtask diffconfig
 
+python do_rustavailable() {
+    oe_terminal("sh -c 'make rustavailable; if [ $? -ne 0 ]; then echo \"Command failed.\"; fi; printf \"Press any key to continue... \"; read r;'",
+                d.getVar('PN') + ' Configuration', d)
+}
+
+do_rustavailable[nostamp] = "1"
+do_rustavailable[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
+addtask rustavailable after do_configure
+
 do_showconfig() {
     bbplain "Config file written to ${KCONFIG_CONFIG_ROOTDIR}/.config"
 }
-- 
2.52.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 1/2] rust: Install the Rust source
  2026-01-09  4:54 [OE-Core][PATCH 1/2] rust: Install the Rust source alistair23
  2026-01-09  4:54 ` [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task alistair23
@ 2026-01-09 10:25 ` Mathieu Dubois-Briand
  2026-01-12  0:09   ` Alistair Francis
  2026-01-09 10:46 ` Yoann Congal
  2 siblings, 1 reply; 9+ messages in thread
From: Mathieu Dubois-Briand @ 2026-01-09 10:25 UTC (permalink / raw)
  To: alistair23, openembedded-core; +Cc: Alistair Francis

On Fri Jan 9, 2026 at 5:54 AM CET, Alistair Francis via lists.openembedded.org wrote:
> From: Alistair Francis <alistair.francis@wdc.com>
>
> When building the Linux kernel with Rust support enabled the kernel
> expects to find the Rust source as the kernel build system will cross
> compile the core library.
>
> This patch uses the Rust tooling to install the Rust source when we
> install the compiller as well.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---

Hi Alistair,

Thanks for your patch.

It looks like the cargo patch does not apply correctly. Is this working
on your side on the master branch?

ERROR: cargo-native-1.92.0-r0 do_patch: Applying patch '/srv/pokybuild/yocto-worker/genericx86-64/build/layers/openembedded-core/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch' on target directory '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-linux/cargo-native/1.92.0/sources/rustc-1.92.0-src/src/tools/cargo'
...
CmdError('quilt --quiltrc /srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/x86_64-linux/cargo-native/1.92.0/recipe-sysroot-native/etc/quiltrc push', 0, "stdout: Applying patch 0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
can't find file to patch at input line 33
Perhaps you used the wrong -p or --strip option?

https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/3012
https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/2980
...

Can you have a look at this issue?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 1/2] rust: Install the Rust source
  2026-01-09  4:54 [OE-Core][PATCH 1/2] rust: Install the Rust source alistair23
  2026-01-09  4:54 ` [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task alistair23
  2026-01-09 10:25 ` [OE-Core][PATCH 1/2] rust: Install the Rust source Mathieu Dubois-Briand
@ 2026-01-09 10:46 ` Yoann Congal
  2026-01-12  0:08   ` Alistair Francis
  2 siblings, 1 reply; 9+ messages in thread
From: Yoann Congal @ 2026-01-09 10:46 UTC (permalink / raw)
  To: alistair23; +Cc: openembedded-core, Alistair Francis

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

Le ven. 9 janv. 2026 à 05:55, Alistair Francis via lists.openembedded.org
<alistair23=gmail.com@lists.openembedded.org> a écrit :

> From: Alistair Francis <alistair.francis@wdc.com>
>
> When building the Linux kernel with Rust support enabled the kernel
> expects to find the Rust source as the kernel build system will cross
> compile the core library.
>
> This patch uses the Rust tooling to install the Rust source when we
> install the compiller as well.
>

Hello,

FYI, there is currently a whole series about enabling rust in the
linux-yocto kernel :
https://lore.kernel.org/openembedded-core/20251230141540.1974380-1-Harish.Sadineni@windriver.com/
How does your series interact with it? If both do the same thing, maybe you
can help reviewing Harish's one?

Also, the patch you add only mentions adding the *doc* why does that help
with linux-yocto searching for rust *code*?

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  ...-host-documentation-is-built-before-.patch | 60 +++++++++++++++++++
>  meta/recipes-devtools/rust/rust-source.inc    |  1 +
>  meta/recipes-devtools/rust/rust_1.92.0.bb     |  4 +-
>  3 files changed, 64 insertions(+), 1 deletion(-)
>  create mode 100644
> meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
>
> diff --git
> a/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
> b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
> new file mode 100644
> index 0000000000..e561266d70
> --- /dev/null
> +++
> b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
> @@ -0,0 +1,60 @@
> +From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00 2001
> +From: Alistair Francis <alistair.francis@wdc.com>
> +Date: Fri, 9 Jan 2026 08:35:43 +1000
> +Subject: [PATCH] bootstrap: Ensure host documentation is built before
> tarball
> + is created
> +
> +`run_default_doc_steps()` is called to ensure the documentation is built
> +by `Docs::run()` and it should build the documentation if it isn't
> +already built.
> +
> +When running the `install src` command I'm seeing failures as the
> +`builder.doc_out(host)` directory does not exist. This is because
> +`match_paths_to_steps_and_run()` doesn't actually build any
> +documentation as the `paths.is_empty()` causes an early return. This
> +results in install failures as the `*/doc` src directory doesn't exist.
> +
> +This patch passes the paths to `run_host_step_descriptions()` when
> building
> +documentation to ensure it is correctly built.
> +
> +This fixes installing the Rust source code in OpenEmbedded.
> +
> +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/150845
> ]
> +Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> +---
> + src/bootstrap/src/core/build_steps/dist.rs | 2 +-
> + src/bootstrap/src/core/builder/mod.rs      | 5 +++++
> + 2 files changed, 6 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/bootstrap/src/core/build_steps/dist.rs
> b/src/bootstrap/src/core/build_steps/dist.rs
> +index f47b0c0b007..2fbb068632e 100644
> +--- a/src/bootstrap/src/core/build_steps/dist.rs
> ++++ b/src/bootstrap/src/core/build_steps/dist.rs
> +@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) ->
> Option<GeneratedTarball> {
> +         // FIXME: explicitly enumerate the steps that should be executed
> here, and gather their
> +         // documentation, rather than running all default steps and then
> read their output
> +         // from a shared directory.
> +-        builder.run_default_doc_steps();
> ++        builder.run_host_default_doc_steps();
> +
> +         let dest = "share/doc/rust/html";
> +
> +diff --git a/src/bootstrap/src/core/builder/mod.rs
> b/src/bootstrap/src/core/builder/mod.rs
> +index 4a04b97c549..16c1c324be0 100644
> +--- a/src/bootstrap/src/core/builder/mod.rs
> ++++ b/src/bootstrap/src/core/builder/mod.rs
> +@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) {
> +
>  self.run_step_descriptions(&Builder::get_step_descriptions(self.kind),
> &self.paths);
> +     }
> +
> ++    /// Run all default documentation steps to build documentation.
> ++    pub fn run_host_default_doc_steps(&self) {
> ++
> self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc),
> &self.paths);
> ++    }
> ++
> +     /// Run all default documentation steps to build documentation.
> +     pub fn run_default_doc_steps(&self) {
> +
>  self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Doc),
> &[]);
> +--
> +2.52.0
> +
> diff --git a/meta/recipes-devtools/rust/rust-source.inc
> b/meta/recipes-devtools/rust/rust-source.inc
> index d7d44510e4..8a22d484c1 100644
> --- a/meta/recipes-devtools/rust/rust-source.inc
> +++ b/meta/recipes-devtools/rust/rust-source.inc
> @@ -8,6 +8,7 @@ SRC_URI += "
> https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
>
>  file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.patch;patchdir=${RUSTSRC}
> \
>
>  file://revert-link-std-statically-in-rustc_driver-feature.patch;patchdir=${RUSTSRC}
> \
>
>  file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.patch;patchdir=${RUSTSRC}
> \
> +
> file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch \
>  "
>  SRC_URI[rust.sha256sum] =
> "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307"
>
> diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb
> b/meta/recipes-devtools/rust/rust_1.92.0.bb
> index a25f65f674..306661b6e4 100644
> --- a/meta/recipes-devtools/rust/rust_1.92.0.bb
> +++ b/meta/recipes-devtools/rust/rust_1.92.0.bb
> @@ -6,8 +6,9 @@ LIC_FILES_CHKSUM =
> "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc"
>
>  inherit rust
>  inherit cargo_common
> +inherit pkgconfig
>
> -DEPENDS += "llvm"
> +DEPENDS += "llvm openssl"
>

This new dependency should be explained in the commit message.


>  # native rust uses cargo/rustc from binary snapshots to bootstrap
>  # but everything else should use our native builds
>  DEPENDS:append:class-target = " cargo-native rust-native"
> @@ -282,6 +283,7 @@ do_install () {
>
>  rust_do_install() {
>      rust_runx install
> +    rust_runx install src
>  }
>
>  rust_do_install:class-nativesdk() {
> --
> 2.52.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229091):
> https://lists.openembedded.org/g/openembedded-core/message/229091
> Mute This Topic: https://lists.openembedded.org/mt/117170671/4316185
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
Yoann Congal
Smile ECS

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task
  2026-01-09  4:54 ` [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task alistair23
@ 2026-01-09 13:56   ` Bruce Ashfield
       [not found]   ` <188914A07F2508FF.2783356@lists.openembedded.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Bruce Ashfield @ 2026-01-09 13:56 UTC (permalink / raw)
  To: alistair23; +Cc: openembedded-core, Alistair Francis

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

On Thu, Jan 8, 2026 at 11:55 PM Alistair Francis via lists.openembedded.org
<alistair23=gmail.com@lists.openembedded.org> wrote:

> From: Alistair Francis <alistair.francis@wdc.com>
>
> Allow the user to run the rustavailable kernel make command to determine
> if Rust is avaliable for kernel builds.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  meta/classes-recipe/cml1.bbclass | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/meta/classes-recipe/cml1.bbclass
> b/meta/classes-recipe/cml1.bbclass
> index 3c2b4da4af..efbdd2a795 100644
> --- a/meta/classes-recipe/cml1.bbclass
> +++ b/meta/classes-recipe/cml1.bbclass
> @@ -107,6 +107,15 @@ do_diffconfig[nostamp] = "1"
>  do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
>  addtask diffconfig
>
> +python do_rustavailable() {
> +    oe_terminal("sh -c 'make rustavailable; if [ $? -ne 0 ]; then echo
> \"Command failed.\"; fi; printf \"Press any key to continue... \"; read
> r;'",
> +                d.getVar('PN') + ' Configuration', d)
> +}
>

This seems a bit heavy to just determine if rust is available. Since the
task is already after do_configure .. why not just check the .config ?

Bruce



> +
> +do_rustavailable[nostamp] = "1"
> +do_rustavailable[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
> +addtask rustavailable after do_configure
> +
>  do_showconfig() {
>      bbplain "Config file written to ${KCONFIG_CONFIG_ROOTDIR}/.config"
>  }
> --
> 2.52.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229092):
> https://lists.openembedded.org/g/openembedded-core/message/229092
> Mute This Topic: https://lists.openembedded.org/mt/117170673/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
- 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: 3881 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task
       [not found]   ` <188914A07F2508FF.2783356@lists.openembedded.org>
@ 2026-01-09 13:59     ` Bruce Ashfield
  2026-01-12  1:06       ` Alistair Francis
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ashfield @ 2026-01-09 13:59 UTC (permalink / raw)
  To: bruce.ashfield; +Cc: alistair23, openembedded-core, Alistair Francis

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

On Fri, Jan 9, 2026 at 8:56 AM Bruce Ashfield via lists.openembedded.org
<bruce.ashfield=gmail.com@lists.openembedded.org> wrote:

>
>
> On Thu, Jan 8, 2026 at 11:55 PM Alistair Francis via
> lists.openembedded.org <alistair23=gmail.com@lists.openembedded.org>
> wrote:
>
>> From: Alistair Francis <alistair.francis@wdc.com>
>>
>> Allow the user to run the rustavailable kernel make command to determine
>> if Rust is avaliable for kernel builds.
>>
>> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>> ---
>>  meta/classes-recipe/cml1.bbclass | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/meta/classes-recipe/cml1.bbclass
>> b/meta/classes-recipe/cml1.bbclass
>> index 3c2b4da4af..efbdd2a795 100644
>> --- a/meta/classes-recipe/cml1.bbclass
>> +++ b/meta/classes-recipe/cml1.bbclass
>> @@ -107,6 +107,15 @@ do_diffconfig[nostamp] = "1"
>>  do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
>>  addtask diffconfig
>>
>> +python do_rustavailable() {
>> +    oe_terminal("sh -c 'make rustavailable; if [ $? -ne 0 ]; then echo
>> \"Command failed.\"; fi; printf \"Press any key to continue... \"; read
>> r;'",
>> +                d.getVar('PN') + ' Configuration', d)
>> +}
>>
>
> This seems a bit heavy to just determine if rust is available. Since the
> task is already after do_configure .. why not just check the .config ?
>
>
and of course, I remember this right after hitting send.

This class is used for more than just the kernel, so anything
done needs to be safe for other non-kernel usecases.

Bruce



> Bruce
>
>
>
>> +
>> +do_rustavailable[nostamp] = "1"
>> +do_rustavailable[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
>> +addtask rustavailable after do_configure
>> +
>>  do_showconfig() {
>>      bbplain "Config file written to ${KCONFIG_CONFIG_ROOTDIR}/.config"
>>  }
>> --
>> 2.52.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
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229117):
> https://lists.openembedded.org/g/openembedded-core/message/229117
> Mute This Topic: https://lists.openembedded.org/mt/117170673/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
- 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: 5465 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 1/2] rust: Install the Rust source
  2026-01-09 10:46 ` Yoann Congal
@ 2026-01-12  0:08   ` Alistair Francis
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2026-01-12  0:08 UTC (permalink / raw)
  To: yoann.congal@smile.fr, alistair23@gmail.com
  Cc: openembedded-core@lists.openembedded.org

On Fri, 2026-01-09 at 11:46 +0100, Yoann Congal wrote:
> Le ven. 9 janv. 2026 à 05:55, Alistair Francis via
> lists.openembedded.org <alistair23=gmail.com@lists.openembedded.org>
> a écrit :
> > From: Alistair Francis <alistair.francis@wdc.com>
> > 
> > When building the Linux kernel with Rust support enabled the kernel
> > expects to find the Rust source as the kernel build system will
> > cross
> > compile the core library.
> > 
> > This patch uses the Rust tooling to install the Rust source when we
> > install the compiller as well.
> > 
> 
> 
> Hello,
> 
> FYI, there is currently a whole series about enabling rust in the
> linux-yocto kernel
> : https://lore.kernel.org/openembedded-core/20251230141540.1974380-1
> -Harish.Sadineni@windriver.com/

Thanks for the pointer!

That link results in a 403, but I found the patches.

> How does your series interact with it? If both do the same thing,
> maybe you can help reviewing Harish's one?

They are actually pretty similar. That series includes a patch similar
to my 2, but also a range of other patches to allow building Rust for
Linux by default (I am using a kernel bbappend)

> 
> Also, the patch you add only mentions adding the *doc* why does that
> help with linux-yocto searching for rust *code*?

We want to use the Rust bootstrap tooling to install the source code.
There is a bug in the tooling which requires the docs to be built first
but they aren't being built. Hence the patch to fix the Rust tooling so
we can install the source code.

Alistair

> 
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> >  ...-host-documentation-is-built-before-.patch | 60
> > +++++++++++++++++++
> >  meta/recipes-devtools/rust/rust-source.inc    |  1 +
> >  meta/recipes-devtools/rust/rust_1.92.0.bb     |  4 +-
> >  3 files changed, 64 insertions(+), 1 deletion(-)
> >  create mode 100644 meta/recipes-devtools/rust/files/0001-
> > bootstrap-Ensure-host-documentation-is-built-before-.patch
> > 
> > diff --git a/meta/recipes-devtools/rust/files/0001-bootstrap-
> > Ensure-host-documentation-is-built-before-.patch b/meta/recipes-
> > devtools/rust/files/0001-bootstrap-Ensure-host-documentation-is-
> > built-before-.patch
> > new file mode 100644
> > index 0000000000..e561266d70
> > --- /dev/null
> > +++ b/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-
> > documentation-is-built-before-.patch
> > @@ -0,0 +1,60 @@
> > +From 2e89bf7969ac6d77b7c6a38265b1eabc8ec6df7a Mon Sep 17 00:00:00
> > 2001
> > +From: Alistair Francis <alistair.francis@wdc.com>
> > +Date: Fri, 9 Jan 2026 08:35:43 +1000
> > +Subject: [PATCH] bootstrap: Ensure host documentation is built
> > before tarball
> > + is created
> > +
> > +`run_default_doc_steps()` is called to ensure the documentation is
> > built
> > +by `Docs::run()` and it should build the documentation if it isn't
> > +already built.
> > +
> > +When running the `install src` command I'm seeing failures as the
> > +`builder.doc_out(host)` directory does not exist. This is because
> > +`match_paths_to_steps_and_run()` doesn't actually build any
> > +documentation as the `paths.is_empty()` causes an early return.
> > This
> > +results in install failures as the `*/doc` src directory doesn't
> > exist.
> > +
> > +This patch passes the paths to `run_host_step_descriptions()` when
> > building
> > +documentation to ensure it is correctly built.
> > +
> > +This fixes installing the Rust source code in OpenEmbedded.
> > +
> > +Upstream-Status: Submitted
> > [https://github.com/rust-lang/rust/pull/150845]
> > +Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > +---
> > + src/bootstrap/src/core/build_steps/dist.rs | 2 +-
> > + src/bootstrap/src/core/builder/mod.rs      | 5 +++++
> > + 2 files changed, 6 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/src/bootstrap/src/core/build_steps/dist.rs
> > b/src/bootstrap/src/core/build_steps/dist.rs
> > +index f47b0c0b007..2fbb068632e 100644
> > +--- a/src/bootstrap/src/core/build_steps/dist.rs
> > ++++ b/src/bootstrap/src/core/build_steps/dist.rs
> > +@@ -83,7 +83,7 @@ fn run(self, builder: &Builder<'_>) ->
> > Option<GeneratedTarball> {
> > +         // FIXME: explicitly enumerate the steps that should be
> > executed here, and gather their
> > +         // documentation, rather than running all default steps
> > and then read their output
> > +         // from a shared directory.
> > +-        builder.run_default_doc_steps();
> > ++        builder.run_host_default_doc_steps();
> > + 
> > +         let dest = "share/doc/rust/html";
> > + 
> > +diff --git a/src/bootstrap/src/core/builder/mod.rs
> > b/src/bootstrap/src/core/builder/mod.rs
> > +index 4a04b97c549..16c1c324be0 100644
> > +--- a/src/bootstrap/src/core/builder/mod.rs
> > ++++ b/src/bootstrap/src/core/builder/mod.rs
> > +@@ -1117,6 +1117,11 @@ pub fn execute_cli(&self) {
> > +       
> >  self.run_step_descriptions(&Builder::get_step_descriptions(self.ki
> > nd), &self.paths);
> > +     }
> > + 
> > ++    /// Run all default documentation steps to build
> > documentation.
> > ++    pub fn run_host_default_doc_steps(&self) {
> > ++       
> > self.run_step_descriptions(&Builder::get_step_descriptions(Kind::Do
> > c), &self.paths);
> > ++    }
> > ++
> > +     /// Run all default documentation steps to build
> > documentation.
> > +     pub fn run_default_doc_steps(&self) {
> > +       
> >  self.run_step_descriptions(&Builder::get_step_descriptions(Kind::D
> > oc), &[]);
> > +-- 
> > +2.52.0
> > +
> > diff --git a/meta/recipes-devtools/rust/rust-source.inc
> > b/meta/recipes-devtools/rust/rust-source.inc
> > index d7d44510e4..8a22d484c1 100644
> > --- a/meta/recipes-devtools/rust/rust-source.inc
> > +++ b/meta/recipes-devtools/rust/rust-source.inc
> > @@ -8,6 +8,7 @@ SRC_URI +=
> > "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz
> > ;n
> >            
> >  file://0001-src-core-build_steps-tool.rs-switch-off-lto-for-rust.p
> > atch;patchdir=${RUSTSRC} \
> >            
> >  file://revert-link-std-statically-in-rustc_driver-feature.patch;pa
> > tchdir=${RUSTSRC} \
> >            
> >  file://0001-riscv32-Define-plain-syscalls-as-their-time64-varian.p
> > atch;patchdir=${RUSTSRC} \
> > +           
> > file://0001-bootstrap-Ensure-host-documentation-is-built-before-.patch
> >    \
> >  "
> >  SRC_URI[rust.sha256sum] =
> > "ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307"
> > 
> > diff --git a/meta/recipes-devtools/rust/rust_1.92.0.bb
> > b/meta/recipes-devtools/rust/rust_1.92.0.bb
> > index a25f65f674..306661b6e4 100644
> > --- a/meta/recipes-devtools/rust/rust_1.92.0.bb
> > +++ b/meta/recipes-devtools/rust/rust_1.92.0.bb
> > @@ -6,8 +6,9 @@ LIC_FILES_CHKSUM =
> > "file://COPYRIGHT;md5=11a3899825f4376896e438c8c753f8dc"
> > 
> >  inherit rust
> >  inherit cargo_common
> > +inherit pkgconfig
> > 
> > -DEPENDS += "llvm"
> > +DEPENDS += "llvm openssl"
> > 
> 
> 
> This new dependency should be explained in the commit message. 
>  
> >  # native rust uses cargo/rustc from binary snapshots to bootstrap
> >  # but everything else should use our native builds
> >  DEPENDS:append:class-target = " cargo-native rust-native"
> > @@ -282,6 +283,7 @@ do_install () {
> > 
> >  rust_do_install() {
> >      rust_runx install
> > +    rust_runx install src
> >  }
> > 
> >  rust_do_install:class-nativesdk() {

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 1/2] rust: Install the Rust source
  2026-01-09 10:25 ` [OE-Core][PATCH 1/2] rust: Install the Rust source Mathieu Dubois-Briand
@ 2026-01-12  0:09   ` Alistair Francis
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2026-01-12  0:09 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org, alistair23@gmail.com,
	mathieu.dubois-briand@bootlin.com

On Fri, 2026-01-09 at 11:25 +0100, Mathieu Dubois-Briand wrote:
> On Fri Jan 9, 2026 at 5:54 AM CET, Alistair Francis via
> lists.openembedded.org wrote:
> > From: Alistair Francis <alistair.francis@wdc.com>
> > 
> > When building the Linux kernel with Rust support enabled the kernel
> > expects to find the Rust source as the kernel build system will
> > cross
> > compile the core library.
> > 
> > This patch uses the Rust tooling to install the Rust source when we
> > install the compiller as well.
> > 
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> 
> Hi Alistair,
> 
> Thanks for your patch.
> 
> It looks like the cargo patch does not apply correctly. Is this
> working
> on your side on the master branch?
> 
> ERROR: cargo-native-1.92.0-r0 do_patch: Applying patch
> '/srv/pokybuild/yocto-worker/genericx86-64/build/layers/openembedded-
> core/meta/recipes-devtools/rust/files/0001-bootstrap-Ensure-host-
> documentation-is-built-before-.patch' on target directory
> '/srv/pokybuild/yocto-worker/genericx86-
> 64/build/build/tmp/work/x86_64-linux/cargo-
> native/1.92.0/sources/rustc-1.92.0-src/src/tools/cargo'
> ...
> CmdError('quilt --quiltrc /srv/pokybuild/yocto-worker/genericx86-
> 64/build/build/tmp/work/x86_64-linux/cargo-native/1.92.0/recipe-
> sysroot-native/etc/quiltrc push', 0, "stdout: Applying patch 0001-
> bootstrap-Ensure-host-documentation-is-built-before-.patch
> can't find file to patch at input line 33
> Perhaps you used the wrong -p or --strip option?
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/3012
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/9/builds/2980

Argh, I'm missing a `;patchdir=${RUSTSRC}` I'll add that in v2 which
fixes this

Alistair

> ...
> 
> Can you have a look at this issue?
> 
> Thanks,
> Mathieu

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task
  2026-01-09 13:59     ` Bruce Ashfield
@ 2026-01-12  1:06       ` Alistair Francis
  0 siblings, 0 replies; 9+ messages in thread
From: Alistair Francis @ 2026-01-12  1:06 UTC (permalink / raw)
  To: bruce.ashfield@gmail.com
  Cc: openembedded-core@lists.openembedded.org, alistair23@gmail.com

On Fri, 2026-01-09 at 08:59 -0500, Bruce Ashfield wrote:
> 
> 
> On Fri, Jan 9, 2026 at 8:56 AM Bruce Ashfield via
> lists.openembedded.org
> <bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
> > 
> > 
> > On Thu, Jan 8, 2026 at 11:55 PM Alistair Francis via
> > lists.openembedded.org
> > <alistair23=gmail.com@lists.openembedded.org> wrote:
> > > From: Alistair Francis <alistair.francis@wdc.com>
> > > 
> > > Allow the user to run the rustavailable kernel make command to
> > > determine
> > > if Rust is avaliable for kernel builds.
> > > 
> > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > ---
> > >  meta/classes-recipe/cml1.bbclass | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/meta/classes-recipe/cml1.bbclass b/meta/classes-
> > > recipe/cml1.bbclass
> > > index 3c2b4da4af..efbdd2a795 100644
> > > --- a/meta/classes-recipe/cml1.bbclass
> > > +++ b/meta/classes-recipe/cml1.bbclass
> > > @@ -107,6 +107,15 @@ do_diffconfig[nostamp] = "1"
> > >  do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
> > >  addtask diffconfig
> > > 
> > > +python do_rustavailable() {
> > > +    oe_terminal("sh -c 'make rustavailable; if [ $? -ne 0 ];
> > > then echo \"Command failed.\"; fi; printf \"Press any key to
> > > continue... \"; read r;'",
> > > +                d.getVar('PN') + ' Configuration', d)
> > > +}
> > > 
> > 
> > 
> > This seems a bit heavy to just determine if rust is available.
> > Since the
> > task is already after do_configure .. why not just check the
> > .config ?

The .config just tells you if it is/isn't available. The script tells
you why it isn't available, which can be helpful.

> > 
> > 
> 
> 
> and of course, I remember this right after hitting send.
> 
> This class is used for more than just the kernel, so anything
> done needs to be safe for other non-kernel usecases.

Ah ok. I'll drop this then as it isn't that important and it's very
kernel specific.

Alistair

> 
> Bruce
> 
>  
> > Bruce
> > 
> >  
> > > +
> > > +do_rustavailable[nostamp] = "1"
> > > +do_rustavailable[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
> > > +addtask rustavailable after do_configure
> > > +
> > >  do_showconfig() {
> > >      bbplain "Config file written to
> > > ${KCONFIG_CONFIG_ROOTDIR}/.config"
> > >  }

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-01-12  1:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09  4:54 [OE-Core][PATCH 1/2] rust: Install the Rust source alistair23
2026-01-09  4:54 ` [OE-Core][PATCH 2/2] cml1.bbclass: Support the rustavailable task alistair23
2026-01-09 13:56   ` Bruce Ashfield
     [not found]   ` <188914A07F2508FF.2783356@lists.openembedded.org>
2026-01-09 13:59     ` Bruce Ashfield
2026-01-12  1:06       ` Alistair Francis
2026-01-09 10:25 ` [OE-Core][PATCH 1/2] rust: Install the Rust source Mathieu Dubois-Briand
2026-01-12  0:09   ` Alistair Francis
2026-01-09 10:46 ` Yoann Congal
2026-01-12  0:08   ` Alistair Francis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.