freebsd-kernel-module-rust
freebsd-kernel-module-rust copied to clipboard
FreeBSD kernel module in Rust
This repo is mostly an updated version of https://github.com/johalun/echo
It has been updated to Rust 2021 with new bindings to the kernel headers and
tested with Rust version 1.64.0-nightly (b1dd22e66 2022-07-09)
For more information, see the accompanying blog post.
Setup
- Install Rust via Rustup
rustup component add rust-src- Generate the kernel bindings:
cargo build -p kernel-sys --target x86_64-unknown-freebsd
Run
./build.sh
sudo make load
echo "hi rust" > /dev/rustmodule
cat /dev/rustmodule
sudo make unload
Licence
This source code is provided under the terms of the BSD 2-Clause licence and is based on public-domain work by Johannes Lundberg.