内核ko模块strip使用

来源:互联网 发布:做淘宝客靠谱吗 编辑:程序博客网 时间:2024/05/15 04:00

编译一个内核时,习惯性的在install目标下加了命令:

$(STRIP)  --strip-all --remove-section=.note --remove-section=.comment  test.ko

结果在insmod test.ko时出现错误:

test: module has no symbols (stripped?)

..................

 上网查了以下,发现内核模块在插入时,insmod会使用模块的一些符号信息。那是不是内核模块不可以被stip呢?答案是可以strp 但不能strip太多东西,应该使用:

$(STRIP)  --strip-debug test.ko

另外:内核模块的version magic的问题:

插入模块出现错误:

test: version magic '2.6.15 gcc-3.4' should be '2.6.14 gcc-3.4'

内核模块对应的内核版本不对,可以修改内核版本代号试一试:

修改liunx源码下的Makefile 前面的版本定义,然后重新编译内核,再编译内核模块。当然这样做可能会有副作用。

查看一个模块的version magic信息:

$modinfo test.ko


file test.ko 也可以用于查看ko文件的信息

0 0