分类: LINUX
2012-02-09 00:21:56
转载自: http://hi.baidu.com/shishlv/blog/item/8699d426e3aedd1a8a82a1f5.html
用crosstool-ng建立Linux交叉编译环境(以S3C2440(armv4t)为例)
最近准备针对支持ARMv4指令的可执行文件进行反汇编,但是当我安装arm-linux-gcc并用其进行编译一个简单的c程序时,却只能得到支持 ARMv1指令的可执行文件,我需要的是ARMv4。查了很多资料,知道crosstool-ng这个工具了,于是上网收集了不少相关资料,但是很多不是 很满意的,最后很感谢同事--小高,是他帮我找到了一篇比较满意的文章,很感谢他。我现在正在进行很复习的crosstool-ng安装过程,不知道对我 的工作有没有帮助。但闲话不多说,现在就开始见证我的制作过程。
首先可以去了解一下这个工具,从那里我们可以知道他是根据crosstool写的。
本文档的重点参考资料:用crosstool-ng建立arm-linux交叉工具链
libncurses5-dev bison flex texinfo automake libtool patch gcj cvs cvsd gawk |
这个问题只在ubuntu 9.0.4中遇到...缺少了termcap 库,下载安装(termcap这东西的确很古老)
cd /tmp
wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
tar zxvf termcap-1.3.1.tar.gz
cd termcap-1.3.1
./configure --prefix=/usr
make
make install
cd /tmp mkdir crosstool-ng wget tar jxvf crosstool-ng-1.6.2.tar.bz2 cd /tmp/crosstool-ng-1.6.2 ./configure --prefix=/opt/crosstool-ng make make install echo "PATH=$PATH:/opt/crosstool-ng/bin" >> ~/.bashrc source ~/.bashrc ct-ng help ## ^ ^ 安装成功
|
cd ${CROSSTOOLNG}/crosstool-ng-1.6.1_build/ #进入编译新交叉编译器的工作目录 #拷贝默认配置文件到工作目录 mv crosstool.config .config #修改文件名 ../crosstool-ng-1.6.1_install/bin/ct-ng menuconfig 进入menuconfig,开始修改配置。 |
man ./gcc.1 |
...... ...... |
[INFO ] ================================================================= [INFO ] Installing final compiler [EXTRA] Configuring final compiler [EXTRA] Building final compiler [ERROR] jar: internal error: [ERROR] make[4]: *** [libgcj-4.3.2.jar] Error 1 [ERROR] make[3]: *** [all-recursive] Error 1 [ERROR] make[2]: *** [all-target-libjava] Error 2 [ERROR] make[1]: *** [all] Error 2 [ERROR] Build failed in step 'Installing final compiler' [ERROR] Error happened in '/home/tekkaman/development/research/crosstool-ng/crosstool-ng-1.6.1_install/lib/ct-ng-1.6.1/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry) [ERROR] called from '/home/tekkaman/development/research/crosstool-ng/crosstool-ng-1.6.1_install/lib/ct-ng-1.6.1/scripts/build/cc/gcc.sh' at line # 350 in function 'do_cc' [ERROR] called from '/home/tekkaman/development/research/crosstool-ng/crosstool-ng-1.6.1_install/lib/ct-ng-1.6.1/scripts/crosstool-NG.sh' at line # 562 in function 'main' [ERROR] Look at '/home/tekkaman/development/x-tools/arm-tekkaman-linux-gnueabi/build.log' for more info on this error. [ERROR] (elapsed: 67:10.67) [67:11] / make: *** [build] 错误 2 |
CT_KERNEL_VERSION= CT_KERNEL_V_2_6_??_?=y CT_LIBC_GLIBC_MIN_KERNEL= |
../crosstool-ng-1.6.1_install/bin/ct-ng bluid |