Skip to content
프로젝트

Rust-for-Linux/rust-out-of-tree-module

GitHub에서 보기

소개

Rust로 작성하는 트리 외부 Linux 커널 모듈의 기본 템플릿입니다.

시스템 및 인프라

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Rust out-of-tree module

This is a basic template for an out-of-tree Linux kernel module written in Rust.

Please note that:

  • The kernel that the module is built against needs to be Rust-enabled (CONFIG_RUST=y).

  • The kernel tree (KDIR) requires the Rust metadata to be available. These are generated during the kernel build and may or may not be available for installed/distributed kernels: the in-tree packaging scripts do not account for Rust artifacts yet, but some popular distributions that enable Rust do provide the needed files.

  • The same Rust compiler used to build the kernel is required. For distribution kernels, that implies using the compiler that the distribution used to build the kernel, which may be packaged separately.

  • All Rust symbols are EXPORT_SYMBOL_GPL.

  • Linux kernel development is generally done against upstream (mainline), not distribution kernels. For learning purposes in particular, it is recommended to develop in-tree and to run and test your kernel within a VM.

Example:

$ make KDIR=.../linux-with-rust-support LLVM=1
make -C .../linux-with-rust-support M=$PWD
make[1]: Entering directory '.../linux-with-rust-support'
  RUSTC [M] .../rust-out-of-tree-module/rust_out_of_tree.o
  MODPOST .../rust-out-of-tree-module/Module.symvers
  CC [M]  .../rust-out-of-tree-module/rust_out_of_tree.mod.o
  LD [M]  .../rust-out-of-tree-module/rust_out_of_tree.ko
make[1]: Leaving directory '.../linux-with-rust-support'
[    1.076945] rust_out_of_tree: Rust out-of-tree sample (init)
[    1.084944] rust_out_of_tree: My numbers are [72, 108, 200]
[    1.085944] rust_out_of_tree: Rust out-of-tree sample (exit)

For details about the Rust support, see https://rust-for-linux.com.

For details about getting started with kernel development in Rust, see https://docs.kernel.org/rust/.

For details about out-of-tree modules, see https://docs.kernel.org/kbuild/modules.html.

rust-analyzer

Rust for Linux supports building a rust-project.json configuration for rust-analyzer, including for out-of-tree modules:

make -C .../linux-with-rust-support M=$PWD rust-analyzer

관련 프로젝트 살펴보기

불러오는 중…