1. The printk function
2. insmod rmmod command
modprobe
lsmod works by reading the /proc/modules virtual file.
Information on currently loaded modules can also be found in the sysfs virtual filesystem under /sys/module.
3. klogd tools
4. /var/log/messages
5. The Current Process
printk(KERN_INFO "The process is \"%s\" (pid %i)\n",current->comm, current->pid);
6.Compiling and Loading
The kernel build system is a complex beast, and we just look at a tiny piece of it. The files
found in the Documentation/kbuild directory in the kernel source are required reading
for anybody wanting to understand all that is really going on beneath the surface.
The first is to ensure that you have sufficiently current versions of the
compiler, module utilities, and other necessary tools. The file Documentation/Changes
in the kernel documentation directory always lists the required tool versions;
7.The Kernel Symbol Table
EXPORT_SYMBOL(name);
EXPORT_SYMBOL_GPL(name);
When a module is loaded, any symbol exported by the module becomes part of the kernel symbol table.
In the usual case, a module implements its own functionality without the need to
export any symbols at all. You need to export symbols, however, whenever other
modules may benefit from using them.
8. The various MODULE_ declarations
Other descriptive definitions that can be contained within a module include
MODULE_AUTHOR (stating who wrote the module), MODULE_DESCRIPTION (a human-readable
statement of what the module does), MODULE_VERSION (for a code revision number;
see the comments in <linux/module.h> for the conventions to use in creating
version strings), MODULE_ALIAS (another name by which this module can be known),
and MODULE_DEVICE_TABLE (to tell user space about which devices the module supports).
9.Error Handling During Initialization