在redhat下
我加载82574L的网卡驱动
[root@master conf]# insmod e1000e.ko
insmod: cannot insert 'e1000e.ko': Invalid module format (-1): Exec format error
用dmesg命令查看,错误日志是:
e1000e: disagrees about version of symbol struct_module
在make menuconfig时,你把Loadable module support ---> Module versioning support一项如是选上,则去掉。
去掉该选项后,再用上面的步骤,可以编过module。
Rusty Russell提到modversions是为了不使一个没有版本的module插入一个修改版的内核
Don't allow a module built without versions altogether to be inserted into a kernel which expects modversions.
modprobe --force will strip vermagic as well as modversions, so it won't be effected, but this will make sure that a non-CONFIG_MODVERSIONS module won't be accidentally inserted into a CONFIG_MODVERSIONS kernel.
http://lkml.indiana.edu/hypermail/linux/kernel/0805.1/0588.html
还有一个密切相关的地方是include/linux/vermagic.h,里面定义了所有magic的生成:
#define VERMAGIC_STRING /
UTS_RELEASE " " /
MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT /
MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS /
MODULE_ARCH_VERMAGIC