hello.c
//
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE ("Dual BSD/GPL");
static int hello_init (void)
{
printk (KERN_ALERT "hello to module");
return 0;
}
static void hello_exit (void)
{
printk (KERN_ALERT "goodbye hello to module");
}
module_init (hello_init);
module_exit (hello_exit);
Makefile
//
obj-m:=hello.o
make command
///
make -C /usr/src/linux-headers-2.6.28-18-generic/ M=`pwd` modules
install the module
sudo insmod ./hello.ko
trace the hello module
cat /proc/modules | grep hello
see : hello 9344 0 - Live 0xf7e01000
remove the module
sudo rmmod hello