Exploring LKMs
A kernel module is a means to provide kernel-level functionality without resorting to working within the kernel source tree and the static kernel image.
Visualize a scenario where you have to add a support feature to the Linux kernel – perhaps a new device driver in order to use a certain hardware peripheral chip, a new filesystem, or a new I/O scheduler. One way to do this is obvious: update the kernel source tree with the new code, and configure, build, test, and deploy it.
Though this may seem straightforward, it’s a lot of work – every change in the code that we write, no matter how minor, will require us to rebuild the kernel image and then reboot the system in order to test it. There must be a cleaner, easier way; indeed, there is – the LKM framework!
The LKM framework
The LKM framework is a means to compile a piece of kernel code typically outside of the kernel source tree, often referred to as “out-of-tree&...