insmod: no symbol version for module_layout

insmod: no symbol version for module_layout  

2011-03-21 11:24:25|  分类: 操作系统 |  标签: |字号 订阅

解决方法汇总:

The package kernel-default-devel was missing. To install it, run this command as root:
zypper in kernel-default-devel

The answer..... incorrect information to begin with.

The instructions I followed used the following make command:
make -C /usr/src/`uname -r` M=`pwd` modules
the code compiled... but I had the issues I reported.

using this:
make -C /lib/modules/`uname -r`/build M=`pwd` modules
allowed me to compile and insert my module with out any issues.

So apparently there is some difference in the configuration information provided in the modules/build directory ... when I have time I will investigate more.

I would still like to know what "no symbol version for module_layout" means... I'm curious that way, but I will take this as a small success and move on.

 

1.Invalid module format
编译环境:PC Ubuntu 9.10(Linux-2.6.31)
比如编译2.6.31下的usbserial.ko,当insmod之后出现
insmod: error inserting 'usbserial.ko': -1 Invalid module format
dmesg后有如下信息:
usbserial: no symbol version for module_layout
网络上查找信息,说是当前编译的源码版本跟系统内核的版本没有一致。这就无法理解了,我的源码是用Ubuntu自带的新立得下的,说版本不一致很让人费解。至于相关的信息可查看:内核模块加载时的版本检查
也有些人说是编译器版本不同造成的,觉得不太可能。而且也有高人指点,明确这跟编译器无关,就是源码问题。网上找的帖子确实未能解决掉这个问题。
解决办法:使用PC自带的头文件,首先用uname -a查看自己内核版本,比如我的是:
Linux Pro 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009 i686 GNU/Linux
于是在Makefile中将路径改为:
KERNELDIR := /usr/src/linux-headers-2.6.31-15-generic
或者KERNELDIR := /usr/src/linux-headers-$(uname -r)
再次编译,成功通过。
 
2.insmod时出现Unknown symbol in module
添加MODULE_LICENSE("GPL");

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值