How to use Rust-for-Linux?

I am wanting to develop some out-of-tree LKM's in Rust and have just finished enabling Rust Support in my kernel (enabling CONFIG_RUST) and I've also cloned rust-for-linux, though I don't understand how this directory enables the kernel and am unsure of what needs to be done with it.

Can anyone clarify how I am suppose to use rust-for-linux while writing an out-of-tree kernel module? I'm just not seeing this info on the website.

there's a template, it's very similar to a out of tree module in C, just with .rs files instead of .c files to be compiled:

the build is actually driven by the master Makefile in the kernel source tree (with r4l enabled), you just specifies the M variable to point to the directory of the module.

you can check out the provided Kbuild and Makefile for reference.

Yeah, I should have mentioned I've got a skeletal kernel mod written w/ Makefile and KBuild. But that's not the rust-for-linux source that I cloned (and which all the build instructions claim I need for ... some reason). AFAIK, rust-for-linux is for reference, but not really used in the actual running kernel that was enabled with Rust in anyway.

what do you mean? you don't need a separate r4l tree, rust support has already been merged into the upstream kernel.

if you want to use the specific source, just change the KDIR variable in the template Makefile.

general documentation for rust in the kernel: Rust — The Linux Kernel documentation

api for a specific kernel version: The Linux Kernel v7.2 Rust code documentation

replace 7.2 in the example url with the version you use, or with next to browse the development snapshot.

you can also build a local copy of rustdoc from source with the make LLVM=1 rustdoc command.

Ok, I follow. Thanks for the reply.