QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2225|回复: 1

编译内核出现的奇怪现象,不知道有没有人见过?

[复制链接]
发表于 2006-8-8 14:09:57 | 显示全部楼层 |阅读模式
2006.8.8

我用的板子是优龙s3c2410的板子,编译其光盘自带配置好的2.4.18内核,老是出错,麻烦大虾们帮忙看看是什么原因造成的,谢谢!

以下是实验过程:
       1.   用交叉编译工具toochain3.3.2编译2.4.18-rmk7内核.解压后进入该目录,修改Makefile,
ARCH :=arm和CROSS_COMPILE=arm-linux-
保存好后执行#make menuconfig后选择Load an Alternate Configuration,输入kernel_2410.cfg(根目录下中自带的配置文件),保存退出后,执行#make dep.之前一直很顺利,但接着#make zImage时出现的错误提示:

blkpg.c: In function `blk_ioctl':
blkpg.c:250: error: asm-specifier for variable `__r1' conflicts with asm clobber list
blkpg.c:250: confused by earlier errors, bailing out
make[3]: *** [blkpg.o] Error 1
make[3]: Leaving directory `/home/andante/2.4.18-rmk7/drivers/block'
make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/home/andante/2.4.18-rmk7/drivers/block'
make[1]: *** [_subdir_block] Error 2
make[1]: Leaving directory `/home/andante/2.4.18-rmk7/drivers'
make: *** [_dir_drivers] Error 2
[root@localhost 2.4.18-rmk7]#

       2.    出现错误,不知道是不是编译工具有问题,在/etc/bashrc中修改路径用
用toolchain2.95.3编译,注消后
[root@localhost 2.4.18-rmk7]# make menuconfig
rm -f include/asm-arm/arch include/asm-arm/proc
(cd include/asm-arm; ln -sf arch-s3c2410 arch; ln -sf proc-armv proc)
rm -f include/asm
( cd include ; ln -sf asm-arm asm)
make -C scripts/lxdialog all
make[1]: Entering directory `/home/andante/2.4.18-rmk7/scripts/lxdialog'
make[1]: Leaving directory `/home/andante/2.4.18-rmk7/scripts/lxdialog'
/bin/sh scripts/Menuconfig arch/arm/config.in
Using defaults found in .config
Preparing scripts: functions, parsing.........................................................................done.

Saving your kernel configuration...

*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.

3.    没有提示make dep,我选择直接make zImage

[root@localhost 2.4.18-rmk7]# make zImage
scripts/split-include include/linux/autoconf.h include/config
arm-linux-gcc -D__KERNEL__ -I/home/andante/2.4.18-rmk7/include -Wall -Wstrict-prototypes -Wno-trigraphs -Os -mapcs -fno-strict-aliasing -fno-common -fno-common
-pipe -mapcs-32 -march=armv4 -mtune=arm9tdmi -mshort-load-bytes -msoft-float   -DKBUILD_BASENAME=main -c -o init/main.o init/main.c
arm-linux-gcc: installation problem, cannot exec `cpp0': ?????????
arm-linux-gcc: installation problem, cannot exec `cc1': ?????????
as:无法识别的选项“-marmv4”
make: *** [init/main.o] Error 1

      4.   有错,然后make clean 重新配置
[root@localhost 2.4.18-rmk7]# make clean
[root@localhost 2.4.18-rmk7]# make menuconfig
Preparing scripts: functions, parsing.........................................................................done.

Saving your kernel configuration...

*** End of Linux kernel configuration.
*** Check the top-level Makefile for additional configuration.
*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.

      5.    结果和2一样,我选择将内核编译为另一种格式(具体是什么我也不知道),结果如意料中--不能编译.
[root@localhost 2.4.18-rmk7]#make bzdisk
make: *** No rule to make target `bzdisk'.  Stop.

之后无论如何也无法在make menuconfig之后提示make dep,均为提示:
*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.

      6.别无他法,重新解压2.4.18.rmk7,设置好后make zImage仍然有错(此时编译工具仍然为2.95.3,在此环境下make zImage的错误和用3.3.2时是一样的:

[root@localhost 2.4.18-rmk7]#make zImage
blkpg.c: In function `blk_ioctl':
blkpg.c:250: error: asm-specifier for variable `__r1' conflicts with asm clobber list
blkpg.c:250: confused by earlier errors, bailing out
make[3]: *** [blkpg.o] Error 1
make[3]: Leaving directory `/home/andante/2.4.18-rmk7/drivers/block'
make[2]: *** [first_rule] Error 2
make[2]: Leaving directory `/home/andante/2.4.18-rmk7/drivers/block'
make[1]: *** [_subdir_block] Error 2
make[1]: Leaving directory `/home/andante/2.4.18-rmk7/drivers'
make: *** [_dir_drivers] Error 2


为什么总是出错?并且换用2.95.3编译时为什么连make dep 的提示都没有了?究竟应该怎样解决呢?

会不会是我系统的原因?我此前编译光盘的内核时就有问题,后来跑去/usr/src/linux下编译系统自带的内核了,版本为2.4.20,也出错,不过没记录出错信息.会不会时在编译自身内核时造成了系统的错误?麻烦大虾们多多指教啊,刚学嵌入式不久,还真的要麻烦大家多帮忙啊.
 楼主| 发表于 2006-8-13 10:57:59 | 显示全部楼层
过了这么久也没有人回答啊?

原来原因很简单, 我原来的编译器路径是/usr/local/toochain/2.95.3/bin
修改存放编译器的文件夹名子为 arm,路径修改为/usr/local/arm/2.95.3/bin
然后再去编译就行了!
\\编译器是有默认路径的,虽然很多资料也给出编译器的存放路径
但是都没有指出这是默认的,如果做了改动,会导致错误.

觉得这个算是个需要注意的问题, 很多编译成功了的同学也不知道是这个原因...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-22 23:06 , Processed in 0.040404 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表