一个最简单的linux hello world模块

#include<linux/init.h>
#include<linux/module.h>
//MODULE_LICNESE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT " hello fish!\n");
return 0;
}

static void hello_exit(void)
{
printk(KERN_ALERT " bye fish!\n");
}
module_init(hello_init);
module_exit(hello_exit);

 

makefile:

path= /lib/modules/$(shell uname -r)/build
PWD= $(shell pwd)
obj-m:=hello.o
default:
        make -C $(path) M=$(PWD) modules

posted @ 2012-09-16 12:48  爱喝可乐  阅读(385)  评论(0编辑  收藏  举报