Simple Block Device Linux kernel module
Contains a minimum of code to create the most primitive block device.
The Linux kernel is constantly evolving. And that's fine, but it complicates the development of out-of-tree modules. I created this out-of-tree kernel module to make it easier for beginners (and myself) to study the block layer.
Features:
- Compatible with Linux kernel from 5.10 to 6.0.
- Allows to create bio-based and request-based block devices.
- Allows to create multiple block devices.
- The Linux kernel code style is followed (checked by checkpatch.pl).
How to use:
-
Install kernel headers and compiler deb:
apt install linux-haders gcc make
orapt install dkms
rpm: yum install kernel-headers -
Compile module
cd ${HOME}/sblkdev; ./mk.sh build
-
Install to current system
cd ${HOME}/sblkdev; ./mk.sh install
-
Load module
modprobe sblkdev catalog="sblkdev1,2048;sblkdev2,4096"
-
Unload
modprobe -r sblkdev
-
Uninstall module
cd ${HOME}/sblkdev; ./mk.sh uninstall
Feedback is welcome.