/usr/src/kernels/ 下没有当前内核文件夹 及 insmod错误Invalid module format
来源:互联网 发布:婚礼相册mv制作软件 编辑:程序博客网 时间:2024/05/18 23:14
我是在加载设备驱动程序的时候遇到的问题。
$ sudo insmod Dev_hello.ko然后出现了问题:
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
lgw@localhost shareArm]$ uname -r 3.5.0-2.fc17.i686.PAE
相关部分:
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 smr54Online Registered UserJoin Date: Jan 2010Posts: 4,055Re: 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.
- /usr/src/kernels/ 下没有当前内核文件夹 及 insmod错误Invalid module format
- insmod--invalid module format错误原因
- insmod Invalid module format
- linux rhel /usr/src/kernels 目录下没有系统内核源码--解决方法
- insmod时“invalid module format”及“unknown symbol”
- insmod 时出现Invalid module format
- insmod 时出现 "Invalid module format"
- insmod时报Invalid module format的问题
- insmod驱动模块 出现 Invalid module format
- insmod: error inserting : -1 Invalid module format
- insmod 时出现 "invalid module format"
- 驱动模块加载错误:insmod: can't insert 'xx.ko': invalid module format
- module编译和insmod invalid format问题解决方法
- 解决insmod: error inserting 'helloworld.ko': -1 Invalid module format
- 解决insmod: error inserting 'helloworld.ko': -1 Invalid module format
- insmod: error inserting 'hello.ko': -1 Invalid module format
- module编译和insmod invalid format问题解决方法
- insmod: error inserting 'hello.ko': -1 Invalid module format
- 纪念开通博客
- c# 更改最大化按钮功能实现最大化时遮盖任务栏,点击Esc取消全屏
- UVA 138 Street Numbers
- 叶诗文得到了百万豪宅,价值三百多万
- HDU-1686(KMP)
- /usr/src/kernels/ 下没有当前内核文件夹 及 insmod错误Invalid module format
- 键盘驱动系列---JIURL键盘驱动 5
- ffmpeg开发指南
- 手机端和服务端交互
- 【ubuntu linux】 QT中使用MYSQL中文乱码解决方法
- Oracle BAM发送报警信息超长的解决方法
- string.h头文件解析
- 关于sizeof和strlen
- C++ 内存对齐