免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1727 | 回复: 0
打印 上一主题 下一主题

insmod 时出现 "Invalid module format" 的可能原因及解决方案 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-07 12:53 |只看该作者 |倒序浏览
如果你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 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-vermagic
Every module contains a small string containing important
information, such as the kernel and compiler versions. If a module
fails 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 version of 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.
       
如果dmesg中提示的是:
          代码:
       
       
          version magic '2.6.12 686 gcc-3.3' should be '2.6.12-10-686 686 gcc-3.4'
       
那就要考虑前三条的问题,或者用--force-vermagic来解决,不过这样风险比较大。
如果dmesg提示的是:
          代码:
       
       
          disagrees about version of symbol struct_module
       
那就是最后一条的问题,可以用--force-modversion,风险比较小。
from: http://forum.ubuntu.org.cn/weblog.php?w=37
                                                                       
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/9577/showart_82106.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP