LDD3学习指南(一)第一个驱动程序
2010-09-17 18:08
169 查看
搞了几年的Net应用开发,觉得也没啥意思,工作需要就转而搞Linux的驱动开发了。说实在的干这个自己的确是个菜鸟,常犯些低级的“常识性”(Linux老人语)错误,呵呵
下面把第一个驱动的例子(Linux设备驱动程序(第三版))的注意点写出来,供自学者参考。
开发环境
内核版本: 2.6.27
gcc : gcc (GCC) 4.1.2
hello.c 程序可以参考
http://dev.yesky.com/154/2621154.shtml
Makefile
2.6下正确的 Makefie 如下:
# Makefile2.6
ifneq ($(KERNELRELEASE),)
#kbuild syntax. dependency relationshsip of files and target modules are listed here.
mymodule-objs := hello.o
obj-m := hello.o
else
PWD := $(shell pwd)
KVER ?= $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif
第一个module 程序终于正常执行了。
下面把第一个驱动的例子(Linux设备驱动程序(第三版))的注意点写出来,供自学者参考。
开发环境
内核版本: 2.6.27
gcc : gcc (GCC) 4.1.2
hello.c 程序可以参考
http://dev.yesky.com/154/2621154.shtml
Makefile
2.6下正确的 Makefie 如下:
# Makefile2.6
ifneq ($(KERNELRELEASE),)
#kbuild syntax. dependency relationshsip of files and target modules are listed here.
mymodule-objs := hello.o
obj-m := hello.o
else
PWD := $(shell pwd)
KVER ?= $(shell uname -r)
KDIR := /lib/modules/$(KVER)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD)
clean:
rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions
endif
第一个module 程序终于正常执行了。
相关文章推荐
- ldd3学习之十二(3):高级字符驱动程序操作--poll/select、异步通知
- Linux设备驱动程序,个人学习,第一个模块hello world
- LDD3 linux设备驱动程序学习之lddbus
- ldd3学习笔记---网络驱动程序snull
- linux驱动学习(2)-第一个驱动程序hello world
- LDD3 linux设备驱动程序学习之lddbus
- Linux驱动开发学习 第一个驱动程序 hello world
- 郁金香驱动编程学习>第一课:第一个驱动程序
- 第一个内核驱动程序(学习资料)
- ldd3驱动程序学习1---理解scull设备
- Yii学习指南(改编)2--创建第一个 Yii 应用
- ldd3驱动程序学习2---理解和认识udev
- LDD3 linux设备驱动程序学习之lddbus
- 嵌入式Linux驱动学习笔记(一)------第一个LED驱动程序
- <ARM嵌入式开发学习>我的第一个驱动程序-hello world
- linux设备驱动程序学习笔记--第一个有用的驱动
- ES权威指南[官方文档学习笔记]-30 Indexing a document
- 标准模板库(STL)学习指南之List链表
- python学习(2)安装与第一个实例
- 【Scikit-Learn 中文文档】聚类 - 无监督学习 - 用户指南 | ApacheCN