Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC PATCH 0/5] Add Rust for Linux support
@ 2025-08-08 13:31 El Mehdi YOUNES via buildroot
  2025-08-08 13:31 ` [Buildroot] [RFC PATCH 1/5] package/rust-bindgen: add host-clang dependency El Mehdi YOUNES via buildroot
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: El Mehdi YOUNES via buildroot @ 2025-08-08 13:31 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, El Mehdi YOUNES

This series is a best-effort to share our work and ideas on enabling
Rust-for-Linux from Buildroot, and to request help and further ideas from
the community.

- bindgen → clang/libclang
  From prior bindgen use in Mesa and Rust-for-Linux guidance, bindgen needs
  libclang available at build time. We therefore add a host-clang dependency
  for host bindgen and consider it mandatory in this context.

- rust std sources for the kernel
  Rust-for-Linux needs the std sources (e.g. core/lib.rs). We download
  rustc-<ver>-src.tar.xz and install only the library/ subtree to:
    $(HOST_DIR)/lib/rustlib/src/rust/
  Extra downloads are split (std vs sources) to avoid conflicts. A possible
  improvement is to install sources only when the kernel Rust option is
  enabled; this is not done yet but is feasible.

- rustfmt (clippy optional)
  The kernel requires rustfmt; we install it (component name is
  rustfmt-preview). Clippy is optional for developers and is not included
  in this round.

- Kernel Kconfig check vs build order
  Enabling Rust in the kernel depends on host tools being present due to
  the early availability check:
    https://github.com/torvalds/linux/blob/master/scripts/rust_is_available.sh
    https://github.com/torvalds/linux/blob/master/init/Kconfig#L70
  To cope with this, we add a Buildroot menu option to wire Rust tools and
  paths. In practice, it is a two-step flow: build once (tools become
  available), then enable Rust drivers/samples via linux-menuconfig.

- HOSTCC handling (rustc -Clinker)
  A change is needed in how HOSTCC is passed to the kernel build; the
  current embedding of flags into HOSTCC does not work with rustc’s
  -Clinker. The 4th patch addresses this by splitting the compiler from
  its flags and using Kbuild’s host-side variables (available since
  v4.19). Guidance is welcome on gating for older kernels (< 4.19): tie
  it to BR2_LINUX_KERNEL_RUST_SUPPORT, require headers >= 4.19, or any
  alternative the maintainers recommend.

This series does not claim that Rust-for-Linux should be a priority right
now; upstream is still evolving and kernel-side support is young. However,
we expect that enabling Rust will eventually become necessary in Buildroot.
It is better to prepare the integration and agree on gating now, so we are
ready when the ecosystem stabilizes.

Best regards,
El Mehdi YOUNES

El Mehdi YOUNES (5):
  package/rust-bindgen: add host-clang dependency
  package/rust-bin: add Rust sources
  package/rust-bin: install rustfmt
  linux: split HOSTCC from flags
  linux: Add Rust support

 linux/Config.in                      |  6 ++++++
 linux/linux.mk                       | 16 +++++++++++++++-
 package/rust-bin/rust-bin.hash       |  2 ++
 package/rust-bin/rust-bin.mk         | 20 +++++++++++++++++---
 package/rust-bindgen/rust-bindgen.mk |  2 ++
 utils/update-rust                    |  9 +++++++++
 6 files changed, 51 insertions(+), 4 deletions(-)

-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-02-13 19:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 13:31 [Buildroot] [RFC PATCH 0/5] Add Rust for Linux support El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 1/5] package/rust-bindgen: add host-clang dependency El Mehdi YOUNES via buildroot
2026-02-03 11:11   ` Thomas Petazzoni via buildroot
2026-02-13 19:37   ` Thomas Perale via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 2/5] package/rust-bin: add Rust sources El Mehdi YOUNES via buildroot
2026-02-03 13:33   ` Thomas Petazzoni via buildroot
2026-02-03 14:27     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 3/5] package/rust-bin: install rustfmt El Mehdi YOUNES via buildroot
2026-02-03 13:35   ` Thomas Petazzoni via buildroot
2026-02-03 14:27     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 4/5] linux: split HOSTCC from flags El Mehdi YOUNES via buildroot
2026-02-03 13:50   ` Thomas Petazzoni via buildroot
2026-02-03 14:29     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 5/5] linux: Add Rust support El Mehdi YOUNES via buildroot
2026-02-03 14:08   ` Thomas Petazzoni via buildroot
2026-02-03 14:34     ` El Mehdi YOUNES via buildroot
2026-02-03 15:09       ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox