Free tools Windows power users keep installed
One-click scans. No signup required.
To write a Rust Linux kernel module, use the requirements for the exact kernel source tree you plan to build, install its compatible Rust and LLVM-related tools, and verify them with make LLVM=1 rustavailable. Then enable CONFIG_RUST, turn on an in-tree Rust sample, and build with make LLVM=1. The kernel’s official Rust Quick Start is the authority for version requirements and installation options for your checkout.
What you need before configuring the kernel
Rust support is tied to the kernel source tree: a toolchain that works for one release may not satisfy another. Start with the official Linux Kernel Documentation Rust Quick Start for the checkout you intend to build, rather than choosing versions from an unrelated tutorial.
As an Amazon Associate I earn from qualifying purchases.
The core prerequisites are:
rustc, the Rust compiler;rust-src, the Rust standard library source component;bindgen, which generates bindings to kernel C declarations during the build; and- LLVM tooling, including
libclang, which bindgen uses to understand C declarations.
The Quick Start documents both distribution-package installation and prebuilt LLVM+Rust toolchains from kernel.org. Packages are convenient when their versions satisfy the checkout. If they do not, use a documented compatible toolchain route instead. Package names, available versions, and any environment configuration vary by distribution and release, so follow the Quick Start’s instructions for your system.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsCheck whether the source tree accepts your toolchain
From the root of the kernel source tree, run:
make LLVM=1 rustavailable
This target uses the kernel build’s Rust-availability checks and can report why a prerequisite is missing or unsuitable. Treat its result as the gate before spending time configuring a Rust build. If it fails, compare the reported requirement with the Quick Start and the version-checking scripts in that same checkout; do not assume that installing the newest compiler will fix a version mismatch.
#1 Best Overall
Enable Rust and choose a starter module
Once the prerequisites are available, configure the kernel from its source-tree root. In the configuration interface, enable Rust support under General setup, then select a Rust sample under Kernel hacking → Sample kernel code → Rust samples. Depending on the sample and configuration, it can be selected as built-in or loadable.
- Open the kernel configuration interface used by your workflow, such as
make menuconfig. - Enable
CONFIG_RUSTunder General setup. - Enable a sample under Kernel hacking → Sample kernel code → Rust samples, choosing the built-in or loadable option presented for that sample.
- Save the configuration, then build from the source-tree root with
make LLVM=1.
The in-tree samples/rust/ and rust/ directories are the natural places to inspect for examples and Rust kernel code. Start with a sample that matches your goal, and use the selected kernel tree as the reference for its configuration and build behavior.
Rank #2
Use LLVM for the supported build path
The Rust Quick Start identifies a complete LLVM configuration, invoked with make LLVM=1, as the best-supported build setup. Although GCC may work in some configurations, the documentation characterizes that route as experimental. For a first build, LLVM reduces uncertainty by following the documented path.
Keep the same LLVM choice for the availability check and the build so that the checks reflect the toolchain configuration you intend to use. If your distribution packages require extra environment settings, use the instructions for that distribution in the Quick Start rather than assuming LLVM=1 alone resolves every tool path.
Confirm that your target architecture is supported
Rust support is not available for every architecture or compiler combination. The current official architecture table lists ARMv7 little-endian, ARM64 little-endian, LoongArch, RISC-V 64-bit with LLVM/Clang, s390 with CONFIG_EXPOLINE disabled, UML, and x86-64. Compiler and LLVM/Clang support also constrain which targets are available. Check the official support table for your intended target and configuration before debugging a build as though every architecture had identical support.
Optional tools for editing and documentation
These tools improve the development workflow but are distinct from the core build prerequisites:
Rank #4
rustfmtformats Rust code.- Clippy can provide lint warnings.
rustdocgenerates documentation and supports doctests.rust-analyzerprovides editor language-server features. The kernel Quick Start explains that it needs a generatedrust-project.json; create it withmake LLVM=1 rust-analyzer.
When a Rust build is unavailable
- The availability target reports missing tools: install the named prerequisite, then rerun
make LLVM=1 rustavailable. - The installed version is rejected: check the minimum-version scripts and Rust Quick Start in the exact checkout, then select compatible versions.
- The target architecture is absent or constrained: consult the official architecture support table and check the listed compiler or configuration conditions.
- The build works only with GCC: note that the documented GCC path is experimental; use the complete LLVM path when practical.
The kernel documentation describes its Quick Start as a guide to getting started with kernel development in Rust. For this setup, its version guidance, the source tree’s availability check, and the architecture table together provide the practical way to establish whether a proposed environment is suitable.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




