An open API service indexing awesome lists of open source software.

https://github.com/pzaino/rust-reference-linux-kernel-driver

Just my reference design for Linux Kernel Drivers in Rust
https://github.com/pzaino/rust-reference-linux-kernel-driver

driver kernel-driver kernel-module linux linux-kernel rust rust-lang

Last synced: 29 days ago
JSON representation

Just my reference design for Linux Kernel Drivers in Rust

Awesome Lists containing this project

README

          

# RKM (Rust Kernel Module)

This is just my own Rust Kernel Module template.
I use it to create my own modules and drivers for the Linux Kernel.

Should work on most distros, but I'm using mostly OpenSUSE Tumbleweed these days.

**Please Note**: Writing kernel modules and drivers in Rust may or may not be
supported by your Distro or Kernel release. Please check the documentation
and the kernel version you are using before messaging me or opening an issue.
Also, writing kernel modules and drivers in Rust is not the same as writing
user-space applications. You need to be aware of the risks and the consequences
of writing kernel code and you must know what you're doing.

## How to use

1. Clone this repository
2. Change the name of the module in the `Cargo.toml` file
3. Change the name of the module in the `src/lib.rs` file
4. Link the kernel sources to the project with `ln -s /usr/src/$(uname -m)/build ./rust_module/kernel_path`
7. Run `make` to build the module

## How to load the module

1. Run `sudo insmod target/debug/lib.ko`
2. Check the kernel logs with `dmesg` to see if the module was loaded correctly