The driver was implemented as a part of my Diploma Thesis in Computer Engineering.
The aim was to perform a basic evaluation of the advantages and drawbacks of using Rust in Linux kernel modules.
-
Linux tree from Rust-for-Linux team[1] along with its dependencies.
-
This Pull Request: rust: platform: add ioremap_resource and get_resource methods
-
If you don't intend to use the configuration file[2] provided inside
modified_linux_filesyou must make sure that the following options are enabled in your custom.config:CONFIG_RUSTCONFIG_COMMON_CLKCONFIG_RESET_CONTROLLERCONFIG_HW_RANDOMCONFIG_RANDOM_TRUST_CPU
[1] Tested on commit 459035ab65.
[2] It is suited to (and tested in a) Raspberry Pi 3B with a 64bit OS. Because it's pretty minimal some basic -but unneeded- features are disabled e.g. sound support. Graphics and network are enabled.
Assuming that you are compiling in a x86_64 computer.
-
Copy the contents of
modified_linux_filestolinux.If you won't use a custom configuration file:
1.a. Rename
configto.config. -
cdtolinuxand compile the kernel:$ make LLVM=1 ARCH=arm64It is also recommended to use the
-joption. -
Assuming that the directory tree is as follows:
- working_directory
- linux
- driver
cdtodriverand compile the driver:$ makeif the linux tree is in a different location then you must supply
makewith the tree's path.$ make KDIR=<path_to_linux_tree> - working_directory
The aforementioned steps will only produce a working out-of-tree kernel module. If you want a working kernel you must also compile and install the in-tree kernel modules and if necessary, the dtb that corresponds to your platform.