分享

用buildroot来建立交叉编译工具链

 charlie_linux 2014-05-10

"工欲善其事,必先利其器!",嵌入式学习也是如此,要想顺利的学习、学好嵌入式,那么你就必须得先准备好的开发的“利器”!

 

呵呵,真是郁闷,编了好久的uboot,可是一直都有个错误:

/usr/local/arm/usr/bin/arm-ep9312-linux-gnueabi-ld: ERROR: Source object /usr/local/arm/usr/bin/../lib/gcc/arm-ep9312-linux-gnueabi/4.1.1/libgcc.a(_clz.o) has EABI version 4, but target u-boot has EABI version 0
/usr/local/arm/usr/bin/arm-ep9312-linux-gnueabi-ld: failed to merge target specific data of file /usr/local/arm/usr/bin/../lib/gcc/arm-ep9312-linux-gnueabi/4.1.1/libgcc.a(_clz.o)
/usr/local/arm/usr/bin/../lib/gcc/arm-ep9312-linux-gnueabi/4.1.1/libgcc.a(_udivdi3.o)用buildroot来建立交叉编译工具链.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
make: *** [u-boot] Error 1
[alu@localhost u-boot-1.1.6]$

    在Google,baidu上寻访了N多的网页、论坛,最后一些大侠给出了重做交叉编译工具链的提议。用buildroot来建立交叉编译工具链郁闷,之前本来就做了好久的交叉编译工具链的,可是一直都没有成功,又闲麻烦,所以就直接下载个现成的用算了,可以到编译的时候还是出现问题,无赖之余,还是决定做个OABI的交叉编译工具链。别人说的EABI和OABI,是什么东西不知道,反正错误是处在它的头上,大侠们说了做OABI的,那我就做个OABI的。

    大侠说“初学者,我推荐用buildroot编译工具链,个人觉得uclibc在嵌入式系统方面比glibc要强的多,经济实惠,空间占用少,呵呵,功能也一点不弱,uclibc都能支持QT。 ”所以就用buildroot来做个吧!说来惭愧,就是说这句话的大侠,之前曾经差不多是手把手的教我做过,可是就是不成功!用buildroot来建立交叉编译工具链

 

还是言归正传,开始做工具链吧!

首先从此处 http://buildroot./downloads/snapshots/  下载最新的buildroot

buildroot-snapshot.tar.bz2

$ tar jxvf buildroot-snapshot.tar.bz2

$ cd buildroot

$ make menuconfig

配置项如下:Target Architecture (arm)--->           

            Target Architecture variant (arm920t) -->           

            Target ABI (OABI) ---> (呵呵,上边出错的就是这里了,要选OABI)

            Build option --> (pc-linux-gnu) GNU build hostname suffix  默认,之前看来一个博客的

方法,他就是将pc改成了arm,害的我编了几天都没做出来,后来幸亏高手指点,才做成功!用buildroot来建立交叉编译工具链

            Toolchain type (buildroot toolchain) -->

            Toolchain Options --->

              ---Kernel Header Options

                Kernel Headers (Linux 2.6.26.x kernel headers) ->

              ----uClibc Options

                uClibc C library version (uClinbc0.9.29) ->

                (toolchain/uClibc/uClibc-0.9.29.config) uClibc configuration files to

              [ ] Enable locale/gettext/i8n support?

                Thread library implementation (linux threads (stable/old))-->

              [ ] Thread library debugging

              -----Binutils options

                  Binutils version (binutils 2.1.8) -->

              () Additional binutils options

              -----Gcc options

                 GCC compiler version (gcc 4.1.2)-->

               [ ] Enable setjmp /longjmp exceptions?

                 () Additional gcc options

                 [*]Build/install c++ compiler and libstdc++?

                 [ ]Build/install Objective –C compiler and runtime?

                 [ ]Build/install Fortran compiler and runtime?

                 [*]Build/install a shared libgcc?

              -------Ccache Options

                   [ ]Enable ccache support?

              --------Gdb Options

                   [ ]Build gdb debugger for the Target

                   [ ]Build gdb server for the Target

                   [ ]Build gdb for the Host

              ---------elf2flt 未配置该选项

              ---------Common Toolchain Options  未配置该选项

              (-Os –pipe) Target Optimizations

              [*] Include target utils in cross toolchain

          Package Selection for the target --> busybox另外编译,这里未配置

          Target Options --> [*] ext2 root filesystem 其他为默认配置

          Board Support Options ---> [*] Atmel Target 其他未配置

 

$ make all

在这里make all的时候,因为我用的是RADHAT 9,所以出现了一个什么make的版本过低的问题,那就下个高些版本的吧!ftp://ftp.gnu.org/pub/gnu/make/make-3.81.tar.gz)本来有个http的地址的,可是忘了。下了后就解压:

#tar zxvf make-3.81.tar.gz

#cd make-3.81                  

#./make-3.81/configure       #执行配置文件 
   #make                       #编译后,会生成一个"make"文件在当前目录下 
   #make install   (可能要修改权限或者换成root用户) # make文件会被放到 /usr/local/bin

成功后,回到buildroot目录

    $ cd buildroot

    $ make menuconfig

    然后就是一段漫长漫长的等待……用buildroot来建立交叉编译工具链

如果不出错的话,那就恭喜你了!如果出错的话,那就Google家baidu吧,至于会出现什么错误呢,我也不知道,因为我也还在等待……呵呵,希望别出错啊……

    对了,如果等待下载的时间过长,或者是因为时间长而中止,那么你可以将所需的工具软件包先下下来,放到你linux里面,在接着make,也是可以的……

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多