In this chapter, we looked at the tools and techniques that can be used to create loadable modules for the kernel of the Linux operating system using Rust, instead of the typical C programming language.
In particular, we saw the sequence of commands that can be used in a Mint distribution on an x86_64 architecture to configure the appropriate environment to build and test loadable kernel modules. We also looked at the modinfo, lsmod, insmod, rmmod, dmesg, and mknod command-line tools.
We saw that to create a kernel module, it is useful to have a framework of code that implements a target framework for the Rust compiler. The Rust source code is compiled to a Linux static library using this target. Then, this library is linked with some C language glue code into a loadable kernel module.
We created four projects of increasing complexity—boilerplate, state, allocating, and dots. In particular, the dots project created a module that can be mapped to a special file using the...