This repository contains code of Linux kernel modules, for the purpose of learning Linux kernel module programming while studying reference resources.
All modules were compiled and tested on VM Ubuntu server 22.04.3 LTS, using UTM.
jimmy@ubuntu:~$ uname -a
Linux ubuntu 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:29:11 UTC 2023 aarch64 aarch64 aarch64 GNU/LinuxI use VS Code, GNU Global and the VS Code extension. First, have these three set up.
Modified the C/C++ GNU Global's setting in VSCode(settings.json):
"gnuGlobal.autoUpdate": "Disabled",
"gnuGlobal.encoding": "Big5",
"gnuGlobal.globalExecutable": "/usr/bin/global",
"gnuGlobal.gtagsExecutable": "/usr/bin/gtags",One can find the executable path via which global and which gtags.
Then, download the linux kernel source into the root of the project and decompress it.
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.7.tar.xz
tar -xvf linux-6.7.tar.xz linux-6.7Remember to edit your .gitignore so that git will not track the kernel source and the tags generated by
# .gitignore
linux-6.7/
GPATH
GRTAGS
GTAGS
Finally, in VSCode, use the command palette to let C/C++ GNU Global do the work (Global: Rebuild Gtags Database).
We're done! Now press the mouse's left key and choose go to definition or simply press F12.
- synchronization mechanism
- pthread_barrier()
- misuse of locks/semaphores and busy-loops