Ubuntu12.04 驱动makefile

来源:互联网 发布:seo群发外链免费软件 编辑:程序博客网 时间:2024/06/13 10:27

直接在linux下学习驱动的写法还是比较方便的,笔者构建一个linux环境下的驱动编写makefile

#include <linux/module.h>#include <linux/init.h>MODULE_LICENSE("GPL");static int __init hello_init(void){printk("<0>""Hello midule init\n");return 0;}static void __exit hello_exit(void){printk("Hello module exit\n");}module_init(hello_init);module_exit(hello_exit);

# This file is write for the first drivers# sxbgifneq ($(KERNELRELEASE),)obj-m := hello.oelseKDIR := /lib/modules/3.2.0-23-generic-pae/buildall:make -C $(KDIR) M=$(PWD) modulesclean:rm -f *.koendif


0 0