1. Linux kernel modules are not compiled into kernel files (zimage,bzimage), but are dynamically installed and uninstalled during runtime
2, the kernel module includes a few parts: main part design, compile kernel module, install uninstall NHMK, optional use (module declaration, MK parameter, symbol output)
3, simple example:
HELLO.C:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
Module_license ("Dual BSD/GPL");
static int hello_init (void)
{
PRINTK (kern_alert "hello_init \ n");
return 0;
}
static void Hello_exit (void)
{
PRINTK (Kern_alert "goodbye,kernel!\n");
}
Module_init (Hello_init);
Module_exit (Hello_exit);
Module_author ("APOLLO"); Author
Module_description ("This was a simple example\n"); Module description
Module_alias ("A Simple Example"); Alias
Makefile:
obj-m:=hello.o
PWD: = $ (shell pwd)
kdir:=/lib/modules/3.13.0-45-generic/build/
All
Make-c $ (Kdir) m=$ (PWD) modules
Clean
RM-RF *.mod.c *.mod.o *.ko *.o *.tmp_versions *.order *symvers
"Finishing"--linux simple kernel module development