What are kernel modules?
Kernel modules are piece of code, that can be loaded and unloaded from kernel on demand.
Kernel modules offers an easy way to extend the functionality of the base kernel without having to rebuild or recompile the kernel again. Most of the drivers are implemented as a Linux kernel modules. When those drivers are not needed, we can unload only that specific driver, which will reduce the kernel image size.
The kernel modules will have a .ko extension. On a normal linux system, the kernel modules will reside inside /lib/modules//kernel/ directory.
This tutorial explains how to write a Kernel module using a simple Hello World example. I. Utilities to Manipulate Kernel Modules
1. lsmod – List Modules that Loaded Already
lsmod command will list modules that are already loaded in the kernel as shown beblow. # lsmod
Module Size Used by
ppp_deflate 12806 0
zlib_deflate 26445 1 ppp_deflate
bsd_comp 12785 0