您的位置:首页 > Web前端

Error: could not insert module dnw_usb.ko: Invalid module format

2013-10-27 23:02 513 查看


在fedora17下安装usb下载驱动dnw_usb.ko时出错了:

???????????????????????????????????????????????????????????????????

我是在加载设备驱动程序的时候遇到的问题。
[plain] view plaincopy$ sudo insmod Dev_hello.ko  

然后出现了问题: [plain] view plaincopy  
[plain] view plaincopyError: could not insert module Dev_hello.ko: Invalid module format  
[plain] view plaincopy  

通过查 *.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
 
lgw@localhost shareArm]$ uname -r 3.5.0-2.fc17.i686.PAE

然后在网上还查到执行命令cat /var/log/message | tail 命令去查看日志文件错误信息
相关部分:[plain] view plaincopyAug 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.PAE

Makefile中相关的几句是:

[plain] view plaincopyKERNEL_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比较强大,各种英文的论坛看啊)
==========================================================================================================解决办法================================================================================================================
[plain] view plaincopy<span style="font-size:24px;color:#009900;"><strong>sudo yum isntall kernel-PAE-devel</strong></span>  


然后/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
smr54 OnlineRegistered
User
 Join
Date: Jan 2010Posts: 4,055



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 -r

If it has the letters PAE in it, then do 

yum install kernel-PAE-devel

Actually, 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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  内核 fedora insmod
相关文章推荐