编译内核模块常见问题
来源:互联网 发布:3d蓝光网络影视播放器 编辑:程序博客网 时间:2024/06/13 03:32
在x86上做出来了,但是在ARM上却出现了很多问题,有内核代码准备的问题,有模块代码问题,也有Makefile的问题。看似不起眼的角色,出了问题也很纠结。
第一种:内核代码没有准备好
[root@localhost module]# make make -C /opt/kangear/kernel/linux-2.6.32.2 M=/root/桌面/kangear/module modulesmake[1]: Entering directory `/opt/kangear/kernel/linux-2.6.32.2' ERROR: Kernel configuration is invalid. include/linux/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it. WARNING: Symbol version dump /opt/kangear/kernel/linux-2.6.32.2/Module.symvers is missing; modules will have no dependencies and modversions. Building modules, stage 2./opt/kangear/kernel/linux-2.6.32.2/scripts/Makefile.modpost:42: include/config/auto.conf: 没有那个文件或目录make[2]: *** 没有规则可以创建目标“include/config/auto.conf”。 停止。make[1]: *** [modules] 错误 2make[1]: Leaving directory `/opt/kangear/kernel/linux-2.6.32.2'make: *** [all] 错误 2[root@localhost module]#这种是下载的很干净的内核,配置都没有配置;或是配置了,有.config但是没有make zImage。编译一下,不为用这个zImage,只是为了更好的编译内核模块。
其实看实质就是找不到auto.conf,这个其实已经有了,就是.config,但是如果不想手动来拷贝可以假装make zImage(如下),这里就可以了,完整的编译一个内核只为了这个一个配置文件,也太浪费了。
[root@localhost linux-2.6.32.2]# make zImage HOSTLD scripts/kconfig/confscripts/kconfig/conf -s arch/arm/Kconfig CHK include/linux/version.h UPD include/linux/version.h Generating include/asm-arm/mach-types.h CHK include/linux/utsrelease.h UPD include/linux/utsrelease.h SYMLINK include/asm -> include/asm-arm CC kernel/bounds.s GEN include/linux/bounds.h CC arch/arm/kernel/asm-offsets.s GEN include/asm/asm-offsets.h CALL scripts/checksyscalls.sh CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o HOSTLD scripts/mod/modpost HOSTCC scripts/kallsyms HOSTCC scripts/pnmtologo HOSTCC scripts/conmakehash CC init/main.o CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o^Cmake[1]: *** wait: 没有子进程。 停止。make[1]: *** 正在等待未完成的任务....make[1]: *** wait: 没有子进程。 停止。make: *** wait: 没有子进程。 停止。make: *** 正在等待未完成的任务....make: *** wait: 没有子进程。 停止。[root@localhost linux-2.6.32.2]#这里再来make一下:
[root@localhost module]# makemake -C /opt/kangear/kernel/linux-2.6.32.2 M=/root/桌面/kangear/module modulesmake[1]: Entering directory `/opt/kangear/kernel/linux-2.6.32.2' WARNING: Symbol version dump /opt/kangear/kernel/linux-2.6.32.2/Module.symvers is missing; modules will have no dependencies and modversions. CC [M] /root/桌面/kangear/module/hello.o Building modules, stage 2. MODPOST 1 modulesWARNING: modpost: missing MODULE_LICENSE() in /root/桌面/kangear/module/hello.osee include/linux/module.h for more information CC /root/桌面/kangear/module/hello.mod.o LD [M] /root/桌面/kangear/module/hello.komake[1]: Leaving directory `/opt/kangear/kernel/linux-2.6.32.2'[root@localhost module]# lshello.c hello.mod.c hello.o modules.order paramhello.ko hello.mod.o Makefile Module.symvers symbol[root@localhost module]#
注意看hello.ko就出来了。
第二种错误:模块代码有异常
[root@localhost hello]# makemake -C /opt/kangear/kernel/linux-2.6.32.2 M=/opt/kangear/hello modulesmake[1]: Entering directory `/opt/kangear/kernel/linux-2.6.32.2' WARNING: Symbol version dump /opt/kangear/kernel/linux-2.6.32.2/Module.symvers is missing; modules will have no dependencies and modversions. CC [M] /opt/kangear/hello/hello.o/opt/kangear/hello/hello.c:3: error: expected declaration specifiers or '...' before string constant/opt/kangear/hello/hello.c:3: warning: data definition has no type or storage class/opt/kangear/hello/hello.c:3: warning: type defaults to 'int' in declaration of 'MODULE_LECENSE'/opt/kangear/hello/hello.c:3: warning: function declaration isn't a prototype/opt/kangear/hello/hello.c:17: error: redefinition of '__inittest'/opt/kangear/hello/hello.c:16: note: previous definition of '__inittest' was here/opt/kangear/hello/hello.c: In function '__inittest':/opt/kangear/hello/hello.c:17: warning: return from incompatible pointer type/opt/kangear/hello/hello.c: At top level:/opt/kangear/hello/hello.c:17: error: redefinition of 'init_module'/opt/kangear/hello/hello.c:16: note: previous definition of 'init_module' was heremake[2]: *** [/opt/kangear/hello/hello.o] 错误 1make[1]: *** [_module_/opt/kangear/hello] 错误 2make[1]: Leaving directory `/opt/kangear/kernel/linux-2.6.32.2'make: *** [default] 错误 2[root@localhost hello]# make
这大多是模块代码的错误,里边有中文相关的一些东西了,一些符号。代码是在博客上拷贝的或者是在win下用ue编辑的,直接拷贝到Linux中就会有这种问题。唯一的办法就是重新打一编代码了。目前还没有找到合适的方法。(语法问题就不提了)
第三种:模块Makefile语法错误
[root@localhost hello]# makemake: Nothing to be done for `default'.[root@localhost hello]#对应的makefile是命令为:
default:make -C $(KERNELDIR) M=$(PWD) modulesmake前边应该有一个tab键。或者是make前边是空格而不是tab。
- 编译内核模块常见问题
- linux内核模块常见问题
- linux内核模块常见问题
- 内核编译 & 模块编译
- linux内核模块编程常见问题
- 编译内核及内核模块
- 内核模块编译入门
- 内核模块编译说明
- 编译内核模块命令
- 编译内核模块
- linux内核模块编译
- Ubuntu内核模块编译
- 开始编译内核模块
- 编译内核模块
- 编译内核模块问题
- 内核模块及编译
- linux内核模块编译
- 内核模块的编译
- 安装oprofile
- 起来!不愿做奴隶的“张江男”
- 我的2012
- 如何使类的成员函数作为回调函数
- Nginx + Tomcat 服务器集群架构及调优经验小结
- 编译内核模块常见问题
- 我开发的第一个安卓应用《枪趣》
- UVA 11729 - Commando War
- 虚拟化VMware简介4——thin provisioning 简介
- Java内部类引用外部类中的局部变量为何必须是final问题解析
- C语言设计模式:解释器 //tbd
- 类与窗体的交互
- C语言设计模式:享元模式
- 美发CRM软件发布了