Documentation/rust/quick-start.rst

Source file repositories/reference/linux-study-clean/Documentation/rust/quick-start.rst

File Facts

System
Linux kernel
Corpus path
Documentation/rust/quick-start.rst
Extension
.rst
Size
10649 bytes
Lines
355
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

Quick Start
===========

This document describes how to get started with kernel development in Rust.

There are a few ways to install a Rust toolchain needed for kernel development.
A simple way is to use the packages from your Linux distribution if they are
suitable -- the first section below explains this approach. An advantage of this
approach is that, typically, the distribution will match the LLVM used by Rust
and Clang.

Another way is using the prebuilt stable versions of LLVM+Rust provided on
`kernel.org <https://kernel.org/pub/tools/llvm/rust/>`_. These are the same slim
and fast LLVM toolchains from :ref:`Getting LLVM <getting_llvm>` with versions
of Rust added to them that Rust for Linux supports. Two sets are provided: the
"latest LLVM" and "matching LLVM" (please see the link for more information).

Alternatively, the next two "Requirements" sections explain each component and
how to install them through ``rustup``, the standalone installers from Rust
and/or building them.

The rest of the document explains other aspects on how to get started.


Distributions
-------------

Arch Linux
**********

Arch Linux provides recent Rust releases and thus it should generally work out
of the box, e.g.::

	pacman -S rust rust-src rust-bindgen


Debian
******

Debian 13 (Trixie), as well as Testing and Debian Unstable (Sid) provide recent
Rust releases and thus they should generally work out of the box, e.g.::

	apt install rustc rust-src bindgen rustfmt rust-clippy


Fedora Linux
************

Fedora Linux provides recent Rust releases and thus it should generally work out
of the box, e.g.::

	dnf install rust rust-src bindgen-cli rustfmt clippy


Gentoo Linux
************

Gentoo Linux provides recent Rust releases and thus it should generally work out
of the box, e.g.::

	USE='rust-src rustfmt clippy' emerge dev-lang/rust dev-util/bindgen

``LIBCLANG_PATH`` may need to be set.


Nix
***

Annotation

Implementation Notes