ish.c
#include<linux/init.h>
#include<linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "hello fish!\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "hello fish exit!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("fish 2009/7/2");
MODULE_DESCRIPTION("this is a example!");
MODULE_ALIAS("just a eaample!");
makefile:huhu=/lib/modules/$(shell uname -r)/build
pwd=$(shell pwd)
obj-m:=fish.o
default:
make -C $(huhu) M=$(pwd) modules
clean:
rm -f *.o *.ko
make命令 以后的结果: