/usr/src/kernels/ 下没有当前内核文件夹 及 insmod错误Invalid module format
2012-08-11 00:47
363 查看
我是在加载设备驱动程序的时候遇到的问题。
然后出现了问题:$ sudo insmod Dev_hello.ko[code]
Error: could not insert module Dev_hello.ko: Invalid module format通过查 *.ko 文件vermagic和内核版本号:[lgw@localhost shareArm]$ sudo modinfo Dev_hello.ko [sudo] password for lgw: filename: /home/lgw/shareArm/Dev_hello.ko depends: vermagic: 3.5.0-2.fc17.i686 SMP mod_unload 686[/code]
lgw@localhost shareArm]$ uname -r 3.5.0-2.fc17.i686.PAE然后在网上还查到执行命令cat /var/log/message | tail 命令去查看日志文件错误信息相关部分:
Aug 10 14:24:29 localhost kernel: [14410.773882] Dev_hello: version magic '3.5.0-2.fc17.i686 SMP mod_unload 686 ' should be '3.5.0-2.fc17.i686.PAE SMP mod_unload 686 '=========================================内核问题============================== 然后我查看我的内核根目录是/usr/src/kernels/里面只有3.5.0-2.fc17.i686 文件夹,而我的内核版本是PAE版的,却没有这个选项。而在之前Makefile中用到的 /lib/modules下却有三个文件夹:3.3.4-5.fc17.i686 3.5.0-2.fc17.i686 3.5.0-2.fc17.i686.PAEMakefile中相关的几句是:
KERNEL_DIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) all: make -C $(KERNEL_DIR) M=$(PWD) modules结果是这样一条命令:make -C /lib/modules/3.5.0-2.fc17.i686.PAE/build M=/home/lgw/shareArm modules这个build的软链接是链接到 /usr/src/kernels/3.5.0-2.fc17.i686.PAE,但是这个链接是不存在的,于是我将这个链接改到没有PAE的那个文件夹上去了,结果Makefile可以make成功了,但是,insmod却一直报错。(我好废话啊~~~毕竟辛苦试了一天,各种找方法,各种试,至少最后找到办法了!还是google比较强大,各种英文的论坛看啊)==========================================================================================================解决办法================================================================================================================
sudo yum isntall kernel-PAE-devel然后/usr/src/kernels/文件夹下就出现了3.5.0-2.fc17.i686.PAE文件夹。谢谢回复我http://topic.csdn.net/u/20120810/14/a350bd84-ff57-4a44-bb88-1960fe5f21c3.html?seed=1160754062&r=79376733#r_79376733这篇帖子的两位朋友!下面晒一晒我加载好的驱动!(图中可以看出进入的文件夹路径是带PAE的~)(加载后,$ dmesg)(卸载后,$ dmesg)参考: fedoraforum.org论坛该帖子的5楼
17th April 2010, 10:44 PM | |||
| |||
Re: No kernel source files in /usr/src/kernels/ directoryHrrm, looking at the Fedora link CSchwangler provided, it seems to me that they're making a very simple thing more complex than it is, as well as not even giving the necessary information. If you have the i686 kernel, chances are that it runs the PAE kernel by default. Rather than using the vanilla kernel, you're usually better off, when using Fedora, to use its own kernel packages. Do uname -rIf it has the letters PAE in it, then do yum install kernel-PAE-develActually, probably better off doing yum update linux-kernel, and if a later kernel is available, reboot into it, then do yum isntall kernel-PAE-devel, to make sure that there are no version mismatches. (I'd also remove the links you've already created to avoid conflicts.)Then you're done, almost no muss, fuss, or bother. |
相关文章推荐
- linux rhel /usr/src/kernels 目录下没有系统内核源码--解决方法
- linux配置ipvsadm, /usr/src/kernels中无内核文件
- eclipse创建maven工程没有src/main/resources文件夹和web.xml使用3.1的dtd时工程有错误的问题
- eclipse创建maven工程没有src/main/resources文件夹和web.xml使用3.1的dtd时工程有错误的问题
- UEK(Unbreakable Enterprise Kernel)相关问题(11G RAC for RHEL6.2)"/usr/src/kernels"下面无文件夹
- 驱动模块加载错误:insmod: can't insert 'xx.ko': invalid module format
- insmod: error inserting 'hello.ko': -1 Invalid module format
- Linux 2.6.x 内核模块加载错误 “Invalid module format” 解决办法
- insmod时“invalid module format”及“unknown symbol”
- 解决“当前扩展缓存策略没有进行注册”的错误
- 关于MAC系统没有修改/usr/bin和/usr/sbin文件夹权限问题
- insmod: cannot insert '18b20.ko': invalid module format
- vs2008 调试错误:没有可用于当前位置的源代码
- 新建android项目src和layout文件夹中没有内容的问题
- 使用 Cocoapods 集成框架 Operation not permitted - /usr/bin/xcodeproj,以及项目出现 Invalid bitcode signature 编译错误
- 编译内核时出现没有ncurses的错误提示
- insmod: error inserting 'simp-blkdev.ko': -1 Invalid module format
- Linux 2.6.x 内核模块加载错误 “Invalid module format” 解决办法
- 当前没有活动的视觉样式,因此与视觉样式相关的操作导致错误。Visual Styles-related operation resulted in an error because no visual style is currently active.
- 解决insmod: error inserting 'helloworld.ko': -1 Invalid module format