Compiling a Rust Kernel Module

As part of an undergraduate project at the Georgia Institute of Technology I am attempting to compile a basic kernel module in Rust. I found this GitHub repository: https://github.com/johalun/echo, but the code is three years old, and I ran into an error I don't know how to fix.

Since then, I've written the C kernel module example at https://medium.com/rossdotpink/writing-a-simple-freebsd-kernel-module-9302bd4cfae1. I've also experimented with linking a Rust static library into a C binary and perused the FreeBSD kernel module Makefiles.

I'm not familiar enough with make(1) to understand the kernel module Makefiles, but my guess is that it's possible to link a compiled Rust object into a C kernel module wrapper.

Does anyone have some suggestions as to what steps I should take going forward?
 
Poor documentation is a pita. There are books for old kernels.
You could try to find the exact kernel version for which you have found code , install that kernel and the code should run.
For the current kernel 12.1 I have totally no idea where to start except read the code, which seems to be a very steep learning curve.
 
Error loading target specification: Field target-c-int-width in target specification is required

There is x86_64-kernel-freebsd.json in the project root and another one in the crates/freebsd_kernel_std directory.
 
Back
Top