helloworld驱动程序

来源:互联网 发布:聚类算法优劣指标 编辑:程序博客网 时间:2024/06/06 04:59

=============以下为源程序============

#include <linux/init.h>

#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
     printk("Hello, world\n");
     return 0;
}
                                                                                
static void hello_exit(void)
{
  printk("Goodbye, cruel world\n");
}
module_init(hello_init);

module_exit(hello_exit);





===========以下为Makefile==============

obj-m := helloworld.o
KERNELDIR ?= /root/linux-2.6.33
PWD := $(shell pwd)
                                                                                
                                                                                
default:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
        make -C $(KERNELDIR) M=$(PWD) clean
        rm -f Module.symvers
~
~










原创粉丝点击