MODPOST 0 modules的解决办法
来源:互联网 发布:迅雷看看mac版 编辑:程序博客网 时间:2024/05/28 22:10
http://blog.163.com/luffy_ye/blog/static/12387653201061542917464/(转)
[root@localhost]~/kernel-stu/hello-1# make
make -C /lib/modules/2.6.23.1-42.fc8/build M=/root/kernel-stu/hello-1 modulesmake[1]: Entering directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
Solution: review the Makefile of the source code, any of the following can get this error:
First:
[root@localhost]~/kernel-stu/hello-1# cat Makefile
bj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Second:
[root@localhost]~/kernel-stu/hello-1# cat Makefile
obj-m += hello-1.c
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
The right content of Makefile is:
[root@localhost]~/kernel-stu/hello-1# cat Makefile
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
The content of hello-1.c:
[root@localhost]~/kernel-stu/hello-1# cat hello-1.c
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void){
printk(KERN_ALERT "hello,world\n");
return 0;
}
static void hello_exit(void){
printk(KERN_ALERT "goodbye,cruel world\n");
return 0;
}
module_init(hello_init);
module_exit(hello_exit);
Make:
[root@localhost]~/kernel-stu/hello-1# make
make -C /lib/modules/2.6.23.1-42.fc8/build M=/root/kernel-stu/hello-1 modules
make[1]: Entering directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
CC [M] /root/kernel-stu/hello-1/hello-1.o
/root/kernel-stu/hello-1/hello-1.c: In function ‘hello_exit’:
/root/kernel-stu/hello-1/hello-1.c:13: warning: ‘return’ with a value, in function returning void
Building modules, stage 2.
MODPOST 1 modules
CC /root/kernel-stu/hello-1/hello-1.mod.o
LD [M] /root/kernel-stu/hello-1/hello-1.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
-------------------------------------------------------------
the kernel build system (kbuild) allows to compile modules whose sourceslive outside the kernel source tree by setting SUBDIRS as follows (fromthe module sources's directory): $ make -C /lib/modules/$(uname -r)/build modules SUBDIRS=$(pwd)people use this mechanism to compile kernel modules that are missing intheir kernel sources, or have been updated/fixed in the meantime.Currently there are a number of deficiencies for building such modules: (1) symbol versioning (MODVERSIONS) is not properly supported, and (2) only the `modules' make target is supported.Problem (1) did not exist in the 2.4 kernel series. The currentsituation has lead authors of several external modules to implement someof the kbuild functionality in their own makefiles, which can only leadto problems later on.During the kernel compile, a list of all files that export symbols iscreated in .tmp_versions/ of the kernel source tree. After everything iscompiled, the module versions of all these object files are resolvedwith modpost. When an external module is compiled, it ends up being theonly file in .tmp_versions/, and so symbols in other modules would notbe found.An additional problem is that resolving symbol versions requires allmodule files plus vmlinux to be in the kernel source tree, so modulescannot be build against a clean kernel source tree.Reference :
lwn.net/Articles/69148/
附:
obj-m 写为obj-s,也会报同样的错误;
- MODPOST 0 modules的解决办法
- 关于无法生成模块的原因MODPOST 0 modules
- MODPOST 1 modules/bin/sh: scripts/mod/modpost: not found的解决
- ubuntu下hello world kernel Module:MODPOST 0 modules
- Linux下模块编译 MODPOST 0
- modinfo命令找不到modules.dep文件的解决办法
- modules.conf的原理
- modules的Makefile
- modules.order的产生
- scripts/mod/modpost
- modules
- Modules
- Modules
- modules
- [小技巧] cat /proc/modules 显示的地址为 0
- Modules的概念及使用
- linux中modules的使用
- 安装你自己的perl modules
- J2SE学习笔记:J2SE重点难点,TreeSet比较器
- Linux新手入门:通过chmod改变文件权限
- TCP SOCKET recv的内存情况
- 漫谈大数据仓库与挖掘系统
- UVA - 11027 Palindromic Permutation
- MODPOST 0 modules的解决办法
- 2013-10-19第一次去招聘市场面试
- 多线程-线程间通信和等待唤醒
- C++在类中定义静态数据成员
- android引导欢迎界面--Guide第一篇
- MATLAB绘制3D隐函数曲面的几种方法
- 数组、集合比较学习。
- “ant debug install” 出错: sdk.dir is missing. Make sure....
- 简单二叉树的实现