Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 628 Bytes

File metadata and controls

34 lines (24 loc) · 628 Bytes

Linux kernel modules in safe Rust

  1. Install cargo-xbuild and the rust-src rustup component:
cargo install cargo-xbuild
rustup component add --toolchain=nightly rust-src
  1. cd to one of the examples
cd hello-world
  1. Build the static object with cargo xbuild, pointing it at our custom target
cargo xbuild --target $(pwd)/../x86_64-linux-kernel-module.json
  1. Build the kernel module using the Linux kernel build system (kbuild)
make
  1. Load and unload the module!
sudo insmod helloworld.ko
sudo rmmod helloworld
dmesg | tail