ubuntu 8.04中编译ARM交叉平台的一点心得!


由于以前一直在FC9中摸索,刚安装的ubuntu 8.04很多东西也不是很清楚,连安装的那些库什么的都不清楚,所以在安装过程中出现了很多的问题,走了很多的弯路!
如果你也是ubuntu 8.04的系统,那么请在安装之前先确认你已安装了以下软件包:
1.patch  :
2.bison :
3.flex :

参考的文章主要有:
generating csu/version-info.h 》
在ubuntu下使用crosstool制作交叉编译工具
在Fedora 下建立 ARM-Linux 交叉编译环境
嵌入式ARM移植之二:交叉编译工具

选用的方案是:
crosstool-0.43
gcc-4.1.1
cgcc-3.3.6
glibc-2.3.2
binutils-2.16.1
linux-libc-headers-2.6.12.0
linux-2.6.26.5

可用的搭配请参考
Crosstool build results 》。

根据前面的这些教程:

我修改了如下文件:
demo-arm9tdmi.sh

#!/bin/sh
# This script has one line for each known working toolchain
# for this architecture.  Uncomment the one you want.
# Generated by generate-demo.pl from buildlogs/all.dats.txt

set -ex
TARBALLS_DIR=/home/chinajszcw/working/source
RESULT_TOP=/home/chinajszcw/working/crosstool
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES

# Really, you should do the mkdir before running this,
# and chown /opt/crosstool to yourself so you don't need to run as root.
mkdir -p $RESULT_TOP

#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.2.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6-tls.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2-tls.dat` sh all.sh --notest
eval `cat arm9tdmi.dat gcc-4.1.1-glibc-2.3.2.dat` sh all.sh --notest


echo Done.

其中红色部分是我修改的。

接着再修改 gcc-4.1.1-glibc-2.3.2.dat

cp gcc-4.1.0-glibc-2.3.2.dat gcc-4.1.1-glibc-2.3.2.dat

BINUTILS_DIR=binutils-2.16.1
GCC_CORE_DIR=gcc-3.3.6
GCC_DIR=gcc-4.1.1
GLIBC_DIR=glibc-2.3.2
LINUX_DIR=linux-2.6.26.5
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.2
GDB_DIR=gdb-6.5


之后就是进入 crosstool-0.43目录执行 ./demo-arm9tdmi.sh

下面说说的我悲惨经历:
第一次运行:./demo-arm9tdmi.sh
   结果:提示什么 PATCH XXXXXXXXXXXX (这个记录没有保留)
        

   原因是因为 ubuntu8.04 没有安装patch软件包,郁闷之极,运行: sudo apt-get install patch后。进行第二次运行。(不知道 crosstool-0.43下面的 clean.sh能不能清理产生临时文件,反正是我把crosstool-0.43目录删了重新解压,从头开始的。嘿嘿)  

第二次运行:./demo-arm9tdmi.sh
   结果:提示 configure: error: installation or configuration problem: C compiler cannot create executables.

   原因是因为没有安装:libc6-dev,运行: sudo apt-get install libc6-dev安装后,进行第三次运行。

第三次运行:
   出现的结果是:configure: error:
          *** These critical programs are missing or too old: gcc
          *** Check the INSTALL file for required versions.

   原因是因为ubuntu8.04自带的gcc版本太新了,不必卸载系统自带的gcc4.2.4。去下载个gcc4.1的版本安装一下。
   然后进行: sudo rm /usr/bin/gcc (删除GCC,它只是个连接文件)
           sudo ln -s /usr/bin/gcc-4.1 /usr/bin/gcc (建立GCC到gcc-4.1的连接)

第四次运行:
   出现的结果是:+ echo Done.
   到这里应该可以算是结束了。但我是看到过程中有很多的warning:************信息,以为是出什么问题了,受 嵌入式ARM移植之二:交叉编译工具文章的影响,删除了系统自带的gcc4.2。事实证明,这纯粹是多此一举,呵呵。

最后就是添加 arm-linux的目录。

到此<完结>

此文组织一般,纯用于个人记录。~~~
   



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值