This is a simple Linux Kernel module. Try it inside a VM. Don't use on your install (unless you are a Gigachad).
All code is free to use. Modifications in editors besides Vim / Neovim are not allowed.
On Debian-based distros Install:
apt install linux-headers-$(uname -r) gcc make build-essential libncurses-dev exuberant-ctagsWhereas, if you are on Arch, you probably don't even need to install anything because Arch is a Gigachad-teir distro by default.
I use Arch btw.
makeTo load the the module, you must install the .ko file. You can do so with the following make command:
sudo make installTo unload the module from your kernel run:
sudo make uninstallTo test whether the module run dmesg command to check if the following message are present:
[ 3433.692029] Gigachad Kernel Module loaded!
[ 3442.597728] Gigachad Kernel Module unloaded!In case you get a similar error when running make:
Skipping BTF generation for /home/user/linux_mod/gigachad_kernel_module.ko due to unavailability of vmlinux
This is due to unavailability of vmlinux on your system. To remedy this, try installing the following package:
apt install dwarvesThen, check if the vmlinux file is located in /sys/kernel/btf by running:
ls /sys/kernel/btfIf the vmlinux file is present, copy it to the appropriate directory using the following command:
cp /sys/kernel/btf/vmlinux /usr/lib/modules/$(uname -r)/build/If after running make once again you continue getting the error:
/bin/sh: 1: ./tools/bpf/resolve_btfids/resolve_btfids: not found
See the following solution.
make clean