driver test

来源:互联网 发布:mac word怎么看字数 编辑:程序博客网 时间:2024/05/01 07:32

#include <linux/module.h>
#include <linux/init.h>
#include <linux/config.h>

MODULE_LICENSE("GPL");
static int __init hello_init(void)
{
        printk("Hello module init/n");
        return 0;
}


static void __exit hello_exit(void)
{
        printk("hello module exit/n");

}

module_init(hello_init);
module_exit(hello_exit);

####Makefile#####
ifneq ($(KERNELRELEASE),)
obj-m +=hello.o
else
KDIR:=/lib/modules/$(shell uname -r)/build
PWD:=$(shell pwd)
default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
endif
###the end##### 

原创粉丝点击