insmod 时出现 "Invalid module format"


如果你modprobe自己编译的内核模块时出现:Invalid module format,那很有可能是以下原因引起的: 
  • 所用内核源码版本号与目前使用的内核不同;
  • 编译目标不同,比如编译的是i686,装好的是i386;
  • 使用编译器版本不同;
  • 目前使用的内核不是自己编译出来的。

前3种比较好办,只要用发行版提供的源码、内核配置(/boot/config*)和编译器就可以了。但如果只是为了增加一个模块就要重新编译整个内核和 所有模块,总是让人觉得有点麻烦,而且也丧失了发行版提供的自动升级功能。其实只要前3种没有问题了,最后一种造成的问题也只是build version有区别,实际还是能用的。这情况下可以使用modprobe的force功能,以避开版本号检查。 


引用:
-f --force 
Try to strip any versioning information from the module, which might otherwise stop it from loading: this is the same as using both --force-vermagic and --force-modversion. Naturally, these checks are there for your protection, so using this optionis dangerous. 
This applies to any modules inserted: both the module (or alias) on the command line, and any modules it depends on.
--force-vermagic 
Every module contains a small string containing important information, such as the kernel and compiler versions. If a modulefails to load and the kernel complains that the "version magic" doesn’t match, you can use this option to remove it. Naturally, this check is there for your protection, so this using option is dangerous. 
This applies to any modules inserted: both the module (or alias) on the command line, and any modules it depends on. 
--force-modversion 
When modules are compiled with CONFIG_MODVERSIONS set, a section is created detailing the versions of every interface used by (or supplied by) the module. If a module fails to load and the kernel complains that the module disagrees about a versionof some interface, you can use "--force-modversion" to remove the version information altogether. Naturally, this check is there for your protection, so using this option is dangerous. 
This applies any modules inserted: both the module (or alias) on the command line, and any modules it depends on.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值