ubuntu12.04下helloworld驱动从失败到成功过程
最近在看linux的设备驱动程序,写一个简单的helloworld程序都花了我好久的时间,具体过程如下:
编写helloworld.c
编写Makefile
注意,makefile中的命令那里是一个tab,而不是多个空格,还有源文件的名字不要写错了,然后make,出现了下面这些错误make -C /lib/modules/3.8.0-29-generic/build M=/home/Linux/helloworld modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.0-29-generic'
CC [M] /home/Linux/helloworld/helloworld.o
In file included from include/linux/types.h:5:0,
from include/linux/init.h:5,
from /home/Linux/helloworld/helloworld.c:1:
include/uapi/linux/types.h:4:23: fatal error: asm/types.h: No such file or directory
compilation terminated.
make[2]: *** [/home/Linux/helloworld/helloworld.o] Error 1
make[1]: *** [_module_/home/Linux/helloworld] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-29-generic'
make: *** [default] Error 2
在pc机的linux下运行helloworld驱动时不需要重新编译内核的,然后上面却提示缺少文件,后面看看确实是缺少文件,于是,我在windows下装了个虚拟机,用的也是ubuntu12.04,关于安装可以看我上传的资源,将这个helloworld.c和Makefile拷贝虚拟机下的ubuntu下,运行make,出现
ls一下可以看到生成的文件如下:
可以看到什么都没有改,然而这里就make成功了。看来用wubi安装系统有一定的缺陷。
insmod ./helloworld.ko加载驱动,没有打印信息,在/var/log/syslog下可以看到打印信息,注意不是在/var/log/messages下的哦。vim /var/log/syslog后按下G,跳到后面,看下图
这样,ubuntu12.04下pc机的helloworld驱动就正常运行起来了。
ubuntu12.04下helloworld驱动从失败到成功过程的更多相关文章
- Ubuntu12.04下jamvm1.5.4+classpath-0.98成功执行 helloworld.class
经过两天的努力,总于在ubuntu以下编译好classpath-0.98与jamvm1.5.4,并能成功的运行类文件:jamvm hellowold,当屏幕上打印出"hello world! ...
- Ubuntu12.04下Qt连接MySQL数据库
本文介绍在Ubuntu12.04 (64 bit) 下使用Qt 4.8.2连接MySQL(Ver 14.14 Distrib 5.5.43)数据库. 1.安装 Qt 和 MySQL 若未安装以上软件, ...
- Linux (Ubuntu12.04) 下开发工具安装和使用
Linux (Ubuntu12.04) 下开发工具安装和使用 这里讲述的是关于在ubuntu12.04下面安装和使用各种IDE 开发环境和初步使用的知识.说一下背景:很多的开发基本都是在linux操作 ...
- 阿里云ubuntu12.04下安装使用mongodb
阿里云ubuntu12.04下安装mongodb apt-get install mongodb 阿里云ubuntu12.04下卸载mongodb,同时删除配置文件 apt-get pur ...
- 在ubuntu12.04下编译android4.1.2添加JNI层出现问题
tiny4412学习者,在ubuntu12.04下编译android4.1.2添加JNI层出现问题: (虚心请教解决方法) trouble writing output: Too many metho ...
- [置顶] ubuntu12.04下编译opencv程序
ubuntu12.04下编译opencv程序 1.在ubuntu下安装好 opencv后(建议使用apt-get install 来安装) 2.使用程序FaceExaple.c来进行测试程序 #inc ...
- Ubuntu12.04下安ns-3.29及Ubuntu换源方法
目录 1.下载ns-3.29 2.安装gcc-4.9.2 3.编译.测试ns-3.29 第一种:更新,文章开头说的 第二种,更新源 主机型号:Ubuntu12.04 仿真环境版本:NS-3.29 安装 ...
- ubuntu12.04下NFS链接开发板并测试交叉编译的第一个应用
思路:配置网络->安装NFS->配置NFS->挂载NFS服务->Down文件执行.Okay lets go! 配置网络: 在配置网络之前,首先咱得搞定与开发板的交互工作,那么这 ...
- Ubuntu12.04下删除文件夹内所有的.svn文件
前段时间在公司里遇到一个问题,从svn上下载下来的文件含有.svn文件,如何删除当前目录下的所有.svn文件呢? 一个个手动删除显然不可能,太多了.其实在Ubuntu12.04下延伸至其他所搜的Lin ...
随机推荐
- shell中的条件判断if和测试
(一)条件判断 if 中-z 到 -d 的意思 [ -a file ] 若file存在,则为真. [ -b file ] 若file存在且是一个块特殊文件,则为真. [ -c file ] 若file ...
- 【BZOJ 2298】 2298: [HAOI2011]problem a (DP)
2298: [HAOI2011]problem a Time Limit: 10 Sec Memory Limit: 256 MBSubmit: 1326 Solved: 637 Descript ...
- dalvik 基于 jvm 的改进
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 几个class 变成一个dex.constant pool 省内存 zygote ,co ...
- Miller-Rabin算法 codevs 1702 素数判定 2
转载自:http://www.dxmtb.com/blog/miller-rabbin/ 普通的素数测试我们有O(√ n)的试除算法.事实上,我们有O(slog³n)的算法. 定理一:假如p是质数,且 ...
- VK Cup 2016 - Round 1 (Div. 2 Edition) C. Bear and Forgotten Tree 3 构造
C. Bear and Forgotten Tree 3 题目连接: http://www.codeforces.com/contest/658/problem/C Description A tre ...
- Educational Codeforces Round 10 C. Foe Pairs 水题
C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permu ...
- hdu 4111 Alice and Bob 记忆化搜索 博弈论
Alice and Bob Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pi ...
- Use a microcontroller to design a boost converter
Boost converters, like other switchers, have traditionally received their control signals from a ded ...
- DLL Injection and Hooking
DLL Injection and Hooking http://securityxploded.com/dll-injection-and-hooking.php Three Ways to Inj ...
- maven,阿里云国内镜像,提高jar包下载速度
镜像 maven默认会从中央仓库下载jar包,这个仓库在国外,而且全世界的人都会从这里下载,所以下载速度肯定是非常慢的.镜像就相当于是中央仓库的一个副本,内容和中央仓库完全一样,目前有不少国内镜像,其 ...