日期:2014-05-16  浏览次数:21021 次

Fedora17 内核版本和 uname -r查到的不一致,怎么办?
我是在加载设备驱动程序的时候遇到的问题。
$ sudo insmod Dev_hello.ko
然后出现了问题:
Perl code
Error: could not insert module Dev_hello.ko: Invalid module format



通过查vermagic和内核版本号
Perl code
[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 


Perl code
[lgw@localhost shareArm]$ uname -r
3.5.0-2.fc17.i686.PAE



然后在网上还查到执行命令cat /var/log/message | tail 命令去查看日志文件错误信息
相关部分:
Perl code
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,而且在kernels下只有3.5.0-2.fc17.i686
而在之前Makefile中用到的 /lib/modules下却有三个文件夹:3.3.4-5.fc17.i686 3.5.0-2.fc17.i686 3.5.0-2.fc17.i686.PAE

Makefile中相关的几句是:
Perl code
KERNEL_DIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
    make -C $(KERNEL_DIR) M=$(PWD) modules


现在因为两者不一致,我不知道怎么改,怎么办了,初涉linux学习ARM,还请各位大神赐教啊~~小妹感激不尽!






------解决方案--------------------
rpm -qa | grep kernel* 
参照结果安装
yum install kernel-PAE-develxxxxxx
yum install kernel-PAExxxx
安装好后,/usr/src/kernels目录下会有相应版本的源代码。


------解决方案--------------------
解决办法:yum install kernel-PAE-devel