分类: LINUX
2011-10-25 14:39:06
博客原文:http://blog.csdn.net/zjujoe/article/details/3185382
现象从 svn 仓库check out 一份内核, 然后make (该配置内置了initramfs 文件系统),第一次make 成功, 但是此后再也不行了!make , make clean 等后都会出错。给开发带来极大麻烦。
内核版本: 2.6.21.5
出错信息如下:
20081007_kernel>make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
/home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel/usr/Makefile:41: *** multiple target patterns. Stop.
make: *** [usr] Error 2
20081007_kernel>make clean
CLEAN arch/arm/boot/compressed
CLEAN arch/arm/boot
CLEAN /home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel
CLEAN arch/arm/kernel
CLEAN drivers/char
CLEAN init
CLEAN lib
/home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel/usr/Makefile:41: *** multiple target patterns. Stop.
make: *** [_clean_usr] Error 2
20081007_kernel>make distclean
/home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel/usr/Makefile:41: *** multiple target patterns. Stop.
make: *** [_clean_usr] Error 2
问题解决
(同时打算再仔细研究一下 Makefile 语法:P)
google 了一下, 查到文档:
http://www.ibm.com/developerworks/cn/linux/l-debugmake.html
该文档说make 时使用 -d 参数可以看到大量信息, 试着用 make –d, 最后几行:
This program built for i486-pc-linux-gnu
Reading makefiles...
Reading makefile `scripts/Makefile.build'...
Reading makefile `include/config/auto.conf' (search path) (don't care) (no ~ expansion)...
Reading makefile `scripts/Kbuild.include' (search path) (no ~ expansion)...
Reading makefile `/home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel/usr/Makefile' (search path) (no ~ expansion)...
Reading makefile `usr/.initramfs_data.cpio.gz.d' (search path) (no ~ expansion)...
/home/zjujoe/svn/mhlv_2.6/working/songlixin/20081007_kernel/usr/Makefile:41: *** multiple target patterns. Stop.
Reaping losing child 0x080af520 PID 6349
make: *** [usr] Error 2
Removing child 0x080af520 PID 6349 from chain.
看一下,usr/.initramfs_data.cpio.gz.d 为initramfs 的目录列表,
试着删除文件 usr/.initramfs_data.cpio.gz.d 再 Make, 居然不出错了!!!
20081007_kernel>rm -f usr/.initramfs_data.cpio.gz.d
20081007_kernel>make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
MODPOST vmlinux
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 33 modules