Documentation/translations/zh_CN/rust/quick-start.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/rust/quick-start.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/rust/quick-start.rst- Extension
.rst- Size
- 10489 bytes
- Lines
- 336
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../disclaimer-zh_CN.rst
:Original: Documentation/rust/quick-start.rst
:翻译:
司延腾 Yanteng Si <siyanteng@loongson.cn>
快速入门
========
本文介绍了如何开始使用Rust进行内核开发。
安装内核开发所需的 Rust 工具链有几种方式。一种简单的方式是使用 Linux 发行版的软件包
(如果它们合适的话)——下面的第一节解释了这种方法。这种方法的一个优势是,通常发行版会
匹配 Rust 和 Clang 所使用的 LLVM。
另一种方式是使用 `kernel.org <https://kernel.org/pub/tools/llvm/rust/>`_ 上提
供的预构建稳定版本的 LLVM+Rust。这些与 :ref:`获取 LLVM <zh_cn_getting_llvm>` 中的精
简快速 LLVM 工具链相同,并添加了 Rust for Linux 支持的 Rust 版本。提供了两套工具
链:"最新 LLVM" 和 "匹配 LLVM"(请参阅链接了解更多信息)。
或者,接下来的两个 "依赖" 章节将解释每个组件以及如何通过 ``rustup``、Rust 的独立
安装程序或从源码构建来安装它们。
本文档的其余部分解释了有关如何入门的其他方面。
发行版
------
Arch Linux
**********
Arch Linux 提供较新的 Rust 版本,因此通常开箱即用,例如::
pacman -S rust rust-src rust-bindgen
Debian
******
Debian 13(Trixie)以及 Testing 和 Debian Unstable(Sid)提供较新的 Rust 版
本,因此通常开箱即用,例如::
apt install rustc rust-src bindgen rustfmt rust-clippy
Fedora Linux
************
Fedora Linux 提供较新的 Rust 版本,因此通常开箱即用,例如::
dnf install rust rust-src bindgen-cli rustfmt clippy
Gentoo Linux
************
Gentoo Linux(尤其是 testing 分支)提供较新的 Rust 版本,因此通常开箱即用,
例如::
USE='rust-src rustfmt clippy' emerge dev-lang/rust dev-util/bindgen
可能需要设置 ``LIBCLANG_PATH``。
Nix
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.