insmod: error inserting 'simp-blkdev.ko': -1 Invalid module format
(一)
今天写了个块设备驱动例子,在虚拟机上加载模块insmod simp_blkdev.ko的时候,出现以下错误。
insmod: error inserting 'simple-blk.ko': -1 Invalid module format
其实错误很简单,Makefile的编写失误,因为之前是想让这个驱动模块在TQ2440上运行的,所以,Makefile的编写使用了以下形式:
ifneq ($(KERNELRELEASE),)
obj-m := simp_blkdev.o
else
KDIR := /usr/src/linux-2.6.30.4
all:
make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux-
clean:
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
主要错误在于红色部分,这个内核模块版本与虚拟机的内核模块版本不一致,导致出现以上错误。
用uname -r 命令查看当前系统的版本是多少,我的查询结果是2.6.18-164.el5
故将其改为:KDIR := /lib/modules/2.6.18-164.el5/build
并且将 ARCH=arm CROSS_COMPILE=arm-linux- 去掉,因为我们要在虚拟机上加载模块,故不使用交叉编译工具。改完之后,再make,编译成功,问题解决。
————————————————————————————————
(二)
按照最开始那个Makefile编译出来的.ko文件,通过nfs下载到开发板上,在开发板上加载insmod simp-blkdev.ko 的时候却出现这个错误。
vmap allocation for size 16785408 failed: use vmalloc=<size> to increase size.
insmod: can't insert 'simp-blkdev.ko': Cannot allocate memory
出错原因也很简单,它的意思是不能分配16785408这么大的空间,所以
失败,回到simp_blkdev.c上,原来我们在这里分配的内存空间是16M,当然就出错啦,要知道嵌入式里面的内存是相当宝贵的,不是每一次分配那
么大的空间内核都会响应给你,所以我把simp_blkdev.c上的分配空间改为16k,再重新编译,错误得到解决。
PS:学驱动也有一些日子了,但是由于临近期末考试,没有更多的时间来写文章,待考完试我再一一详细介绍驱动相关的知识。最后,正如之前你看到的,LWJ祝大家学习愉快。^_^
insmod: error inserting 'simp-blkdev.ko': -1 Invalid module format的更多相关文章
- 解决insmod: error inserting 'hello.ko': -1 Invalid module format
编译自己的内核模块后,insmod出现error:error inserting 'hello.ko': -1 Invalid module format 出现这种情况的原因是因为Makefile种使 ...
- insmod: error inserting 'hello.ko': -1 Invalid module format
在学习编写linux驱动程序的时候,一般都是从写一个helloworld的模块開始. 可是在编译完毕后,进行模块载入的时候,有时会出现例如以下错误: insmod: error inserting ' ...
- insmod hello.ko -1 Invalid module format最简单的解决的方法
在下也是从网上搜索到的这样的解决的方法. 遇到这样的情况后,通过dmesg看一下内核日志. 假设发现有例如以下日志.那就好办了. hello: version magic '2.6.33.3 ' sh ...
- ubuntu12.04出现ERROR: Removing 'hello': Device or resource busy和insmod: error inserting 'hello.ko': -1 Device or resource busy解决方案
一:insmod时候错误: 1:错误信息insmod: error inserting 'hello.ko': -1 Device or resource busy 2:原因:你的代码里面的设备号和系 ...
- insmod: can't insert 'led.ko': invalid module format详细解释
insmod: can't insert 'led.ko': invalid module format 之前在Imx257学习版固件编写的驱动想直接移植imx257核心板的开发板上.以为2个板子的源 ...
- [Mongo] error inserting documents: BSONObj size is invalid (mongoimport mongorestore 数据备份恢复)
解决办法如下, ./mongoimport -port 6066 -d xxx -c xxx --batchSize=10 /root/mong_data/test/xxx 原因转自 http://b ...
- tomcat出现Error in dependencyCheck java.io.IOException: invalid manifest format
我只能说这个错误很坑爹,检查了很多地方都没问题,结果最后在MANIFEST.MF 里面把所有的空的行都删掉就好了.坑爹有木有.
- 内核模块加载错误 “Invalid module format” 解决办法
参考链接: http://blog.chinaunix.net/uid-20448327-id-172345.html
- insmod: ERROR: could not insert module dm-snapshot.ko: Unknown symbol in module
下面方法成功的前提是你的mod和你的操作系统版本是匹配的,也就是说你的mod之前成功过.说个多余的提示,mod在/lib/modules目录里面 insmod: ERROR: could not in ...
随机推荐
- 从零开始部署小型企业级虚拟桌面 -- Vmware Horizon View 6 For Linux VDI -- 结构规划
环境说明 注,本套环境所用机器全部是64位的. 管理服务器载体:安装win7操作系统,通过VMware Workstation安装4台虚拟机,用作vCenter,Connection Server,D ...
- aspx文件移动到新建的文件夹中设置路径的问题
项目中仅仅把aspx移动到想要的文件夹内是会出错的,不用想也知道是路径问题.这里我就说这个路径该如何去修改. 两个地方需要修改:1.母版路径修改方法: <link href="Styl ...
- c#编写简单计算器
刚接触c#,依照惯例,写个简单的计算器,只写了加法,乘法,其他的类似,编辑器用的vs2008 首先打开vs ,新建c#的Windows窗体应用程序,接下来的项目的名称是WindowsFormsAppl ...
- 7zip self-extracted executable: To extract file to specific directory
1) Install 7-zip (7zS.sfx will be installed to C:\Program Files\7-Zip): http://7zsfx.solta.ru/en/ 2) ...
- HDOJ 1042 N! -- 大数运算
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1042 Problem Description Given an integer N(0 ≤ N ≤ 1 ...
- 九度OJ 1408 吃豆机器人 -- 动态规划
题目地址:http://ac.jobdu.com/problem.php?pid=1408 题目描述: 淘宝公司内部有许多新鲜的小玩具,例如淘宝智能机器人.小时候,大家都玩过那个吃豆子的游戏吧,这机器 ...
- 九度OJ 1283 第一个只出现一次的字符
题目地址:http://ac.jobdu.com/problem.php?pid=1283 题目描述: 在一个字符串(1<=字符串长度<=10000,全部由大写字母组成)中找到第一个只出现 ...
- OpenJudge/Poj 1458 Common Subsequence
1.链接地址: http://poj.org/problem?id=1458 http://bailian.openjudge.cn/practice/1458/ 2.题目: Common Subse ...
- OpenJudge/Poj 1125 Stockbroker Grapevine
1.链接地址: http://poj.org/problem?id=1125 http://bailian.openjudge.cn/practice/1125 2.题目: Stockbroker G ...
- 24种设计模式--访问者模式【Visitor Pattern】
今天天气不错,绝对是晴空万里,骄阳似火呀,好,我们今天来讲访问者模式,我们在前面讲了组合模式和迭代器模式,通过组合模式我们能够把一个公司的人员组织机构树搭建起来,给管理带来非常大的便利,通过迭代器模式 ...