交叉编译内核模块:无效的模块格式 [英] Cross compiling a kernel module: invalid module format

查看:374
本文介绍了交叉编译内核模块:无效的模块格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图穿越编译规格的HelloWorld内核模块:

I'm trying to cross compile a helloworld kernel module with specifications:


  • 主持人:英特尔的x86 32位,Linux的3.0.0

  • 目标:ARM机(鹦鹉AR.Drone的),Linux的2.6.27.47

我使用的生成文件:

PWD := $(shell pwd)
obj-m := test.o
all:
    $(MAKE) -C /path/to/kernel M=$(PWD) CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm  modules

其中, ARM-NONE-Linux的gnueabi - 是胳膊工具链的preFIX

Where arm-none-linux-gnueabi- is the prefix of the arm toolchain.

由于内核中,我尝试使用从克隆的git://github.com/CyanogenMod/cm-kernel.git 为核心。这是一个2.6版本的内核分支。使用这个内核,编译是全成。当试图插入模块,它提供了错误:

As kernel, I tried using a clone from git://github.com/CyanogenMod/cm-kernel.git as kernel. This is a 2.6 kernel fork. Using this kernel, compilation was successfull. When trying to insert the module, it gives the error:

invalid module format

其中,可悲的是,说的很少。

Which, sadly, says very little.

推荐答案

由于尤金的提示使用的dmesg ,我发现了错误:

Thanks to the hint of Eugene to use dmesg, I found the error:

version magic '2.6.37.6 mod_unload modversions ARMv5 ' should be '2.6.27.47-parrot preempt mod_unload ARMv5 '

结论:编译内核模块时,不仅版本需要匹配,但也有一些配置参数。我的问题是通过使用正确的版本,编辑配置解决了。

Conclusion: when compiling a kernel module, not only versions need to match, but also some config-parameters. My problem was solved by using the right version and editing the configuration.

如果您不希望重新配置的一切,快速(丑陋的)的解决办法是修改包含/生成/ autoconf.h

If you don't want to reconfigure everything, a quick (ugly) fix is to edit include/generated/autoconf.h

这篇关于交叉编译内核模块:无效的模块格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆