免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: dreamice
打印 上一主题 下一主题

转:Linux设备驱动程序学习 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2009-08-14 17:06 |只看该作者
学习

论坛徽章:
0
12 [报告]
发表于 2009-08-17 11:55 |只看该作者
感谢楼主

论坛徽章:
0
13 [报告]
发表于 2010-11-29 19:29 |只看该作者
XIEXIE LE HEH

论坛徽章:
1
水瓶座
日期:2014-10-18 20:17:41
14 [报告]
发表于 2012-03-26 08:53 |只看该作者
不错!

论坛徽章:
0
15 [报告]
发表于 2012-03-28 23:19 |只看该作者
有几种方法:
1.在drivers/char/Makefie中增加一行
obj-m        +=helloworld.o
然后在重新编译内核,但是只需要编译make modules,只编译内核模块,然后就产生.ko文件,加载运行即可

2.在网上找个Makefile编译一下,也可产生模块文件.ko,再加载

3.在drivers/char/Makefie中增加一行
obj-y        +=helloworld.o
重新编译内核,则helloworld就是直接编译入内核。。。。。。。。。。。。。。。。。

论坛徽章:
0
16 [报告]
发表于 2012-03-28 23:22 |只看该作者
补充,前两种方法,吧helloworld.c放在文件linux/driver/char目录下

论坛徽章:
0
17 [报告]
发表于 2012-05-25 14:34 |只看该作者
你好,你搞过usb驱动吗?我有问题向你请教?你QQ多少?谢谢了
   

论坛徽章:
0
18 [报告]
发表于 2012-07-03 19:37 |只看该作者
写个Makefile啊!
-----------------------------
2 # To build modules outside of the kernel tree, we run "make"
  3 # in the kernel source tree; the Makefile these then includes this
  4 # Makefile once again.
  5 # This conditional selects whether we are being included from the
  6 # kernel Makefile or not.
  7 ifeq ($(KERNELRELEASE),)
  8
  9     # Assume the source tree is where the running kernel was built
10     # You should set KERNELDIR in the environment if it's elsewhere
11     KERNELDIR ?= /lib/modules/$(shell uname -r)/build
12     # The current directory is passed to sub-makes as argument
13     PWD := $(shell pwd)
14
15 modules:
16     $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
17
18 modules_install:
19     $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
20
21 clean:
22     rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
23
24 .PHONY: modules modules_install clean
25
26 else
27     # called from kernel build system: just declare what our modules are
28     obj-m := helloworld.o
29
30 endif
------------------------------------------------------

论坛徽章:
0
19 [报告]
发表于 2012-11-17 11:11 |只看该作者
这是真的吗?太好了,谢谢您啊

论坛徽章:
0
20 [报告]
发表于 2013-04-10 19:20 |只看该作者
很好的指导建议,很好的方针路线!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP