http://blog.csdn.net/heyangya2009/article/details/5424376

备注:ubuntu12.04+Android+Real6410

在主机上用来编译其他类型机器可执行代码的编译器就叫交叉编译器,我们进行嵌入式linux的开发的主机的处理器大部分都是x86,而我们的嵌入式系统的处理器有可能是arm、MIPS等非x86处理器,这时候必须使用arm、MIPS等交叉编译器才能编译出这些处理器能够执行的代码。这里我们使用的是ARM公司提供的新一代的arm交叉编译器EABI编译器。

 

1.   访问codesourcery官方网站下载最新的ARM交叉编译工具链,当前最新版本是arm-2009q3:

http://www.codesourcery.com/sgpp/lite/arm/portal/package5383/public/arm-none-linux-gnueabi/arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

把arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2拷贝到root下,用命令

tar –jxvf arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2解压到当前为目录下,生成arm-2009q3目录,如下图:

可见采用的交叉编译器是arm-none-linux-gnueabi-gcc4.4.1

2.   设置交叉编译工具环境变量

在etc/bash.bashrc文件下增加下面的内容:

#ARM_CROSS2009=/root/arm-2009q3

export PATH=$PATH:$ARM_CROSS2009/bin

保存退出后用source/etc/bash.bashrc使配置生效,通过命令echo $PATH来查看PATH环境变量的设置,比如:

/home/kandi/jdk1.6.0_45/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/kandi/jdk1.6.0_45/jre/bin:/root/arm-2009q3/bin

我们可以通过arm-none-linux-gnueabi-gcc –v(记得这里有空格),内容如下:

Using built-in specs.

Target: arm-none-linux-gnueabi

Configured with:/scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu--target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap--disable-libssp
--disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs--with-arch=armv5te --with-gnu-as --with-gnu-ld--with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}%{O2:%{!fno-remove-local-statics: -fremove-local-statics}}%{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics:
-fremove-local-statics}}}'--enable-languages=c,c++ --enable-shared --disable-lto --enable-symvers=gnu--enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q3-67'--with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls--prefix=/opt/codesourcery--with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc--with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc--with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--with-host-libstdcxx='-static-libgcc
-Wl,-Bstatic,-lstdc++,-Bdynamic -lm'--with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr--disable-libgomp --enable-poison-system-directories--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin--with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin

Thread model: posix

gcc version 4.4.1 (Sourcery G++ Lite2009q3-67)

表示设置生效,在设置过程中发现这样的规律,设置的终端调用source/etc/bash.bashrc,好像如果在设置的终端输入arm-none-linux-gnueabi-gcc
–v就看不到上面的gcc信息,在新的终端上就可以。

但去编译Uboot的时候发现有下面的错误信息:

make: arm-linux-gcc:命令未找到

find/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410 -type f \

\(-name 'core' -o -name '*.bak' -o -name '*~' \

-o-name '*~' -o -name '.depend*' \

-o-name '*.o'  -o -name '*.a'  \) -print \

|xargs rm -f

rm -f u-boot*

rm -f examples/hello_worldexamples/timer \

examples/eepro100_eeprom examples/sched \

examples/mem_to_mem_idma2intrexamples/82559_eeprom \

examples/smc91111_eepromexamples/interrupt \

examples/test_burst

rm -f tools/img2srec tools/mkimagetools/envcrc \

tools/gen_eth_addr

rm -f tools/mpc86x_clk tools/ncb

rm -f tools/easylogo/easylogotools/bmp_logo

rm -f tools/gdb/astest tools/gdb/gdbconttools/gdb/gdbsend

rm -f tools/env/fw_printenvtools/env/fw_setenv

rm -f board/cray/L1/bootscript.cboard/cray/L1/bootscript.image

rm -f board/netstar/eepromboard/netstar/crcek board/netstar/crcit

rm -f board/netstar/*.srecboard/netstar/*.bin

rm -f board/trab/trab_fktboard/voiceblue/eeprom

rm -f board/integratorap/u-boot.ldsboard/integratorcp/u-boot.lds

rm -f include/bmp_logo.h

rm -f nand_spl/u-boot-splnand_spl/u-boot-spl.map

make: arm-linux-gcc:命令未找到

for dir in tools examples post post/cpu; do make -C $dir _depend ; done

make[1]: arm-linux-gcc:命令未找到

make[1]:正在进入目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/tools'

make[1]:正在离开目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/tools'

make[1]: arm-linux-gcc:命令未找到

make[1]:正在进入目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/tools'

make[1]:没有什么可以做的为 `_depend'。

make[1]:正在离开目录 `/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/tools'

make[1]: arm-linux-gcc:命令未找到

make[1]:正在进入目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/examples'

/bin/sh: 1: arm-linux-gcc: not found

dirname:缺少操作数

请尝试执行"dirname--help"来获取更多信息。

/bin/sh: 1: arm-linux-gcc: not found

dirname:缺少操作数

请尝试执行"dirname--help"来获取更多信息。

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

make[1]: ***没有规则可以创建“_depend”需要的目标“.depend”。停止。

make[1]:正在离开目录 `/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/examples'

make[1]: arm-linux-gcc:命令未找到

make[1]:正在进入目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/post'

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

make[1]: ***没有规则可以创建“_depend”需要的目标“.depend”。停止。

make[1]:正在离开目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/post'

make[1]: arm-linux-gcc:命令未找到

make[1]:正在进入目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/post/cpu'

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

/bin/sh: 3: arm-linux-gcc: not found

make[1]: ***没有规则可以创建“_depend”需要的目标“.depend”。停止。

make[1]:正在离开目录`/home/kandi/android2.3/sc/android-source/s3c-u-boot-1.1.6-Real6410/post/cpu'

cp:
无法获取"u-boot.bin"的文件状态(stat):没有那个文件或目录

后来改为用arm-2008q3的交叉编译环境就可以了,看来交叉编译环境和linux内核、实际的Real6410还有关的,后续要注意。

在使用过程中发现root和个人的PATH环境变量值不一样如下图:

在此先记录下来

etc/bash.bashrc

export JAVA_HOME=/home/kandi/jdk1.6.0_45

export JRE_HOME=$JAVA_HOME/jre

export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

ARM_CROSS2008=/root/arm-2008q3

#ARM_CROSS2009=/root/arm-2009q3

export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/bin:$ARM_CROSS2008/bin

#export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/bin:$ARM_CROSS2009/bin

Ubuntu12.04下arm交叉编译环境的建立的更多相关文章

  1. 嵌入式开发(一) Ubuntu12.04下搭建交叉编译环境

    操作系统:Ubuntu12.04 AMD64位 交叉编译环境:arm-Linux gcc版本4.4.3 前言: 首先理解一下交叉编译的意思.我们要给嵌入式设备写应用程序,但是又不能在嵌入式设备上完成所 ...

  2. arm汇编--ubuntu12.04 安装arm-linux交叉编译环境

    1. 安装标准的C开发环境,由于Ubuntu安装默认是不安装的,所以需要先安装一下:sudo apt-get install gcc g++ libgcc1 libg++ make gdb 2.从ft ...

  3. ubuntu12.10下arm-linux-gcc交叉编译环境的搭建

    交叉编译环境搭建的原因:通俗上讲,因为嵌入式系统可用资源比较少:几十M的ARM 二三百M的flash相对我们的pc机来说资源真的没法比.所以,为了解决这种局面就将PC机等作为主机,搭建开发环境,进行编 ...

  4. ubuntu12.04下安卓编译环境搭建总结

    前言:      因为工作需要,经常要编译安卓下的动态库,公司有已经搭建好环境的服务器,但是第一自己想自己搭建一下了解一个整个过程,另外,公司的服务器也经常出现问 题,导致编译不了,所以就想自己搭建环 ...

  5. Ubuntu12.04下搭建Java环境

    1.认识需要配置的环境变量 1). PATH: 作用是指定命令搜索路径,打开/etc/environment可以看到PATH变量的值,该变量包含了一系列的路径.那些路径都是一些经常使用的系统命令的目录 ...

  6. 建立ARM交叉编译环境 (arm-none-linux-gnueabi-gcc with EABI)【转】

    转自:http://lib.csdn.net/article/embeddeddevelopment/60172?knId=886 建立ARM交叉编译环境 (arm-none-linux-gnueab ...

  7. Ubuntu18.04 LTS x64 构建ARM交叉编译环境(尝试,但失败了!!!估计是编译器没选对)

    [测试而已,由于需要了解编译器和处理器体系,因此先放弃该方法] 动机 入门嵌入式开发,又需要 Windows 又需要 Linux,但资料给的竟然是 Ubuntu9,导致我不能使用 VSCode Rem ...

  8. ubuntu12.04下NFS链接开发板并测试交叉编译的第一个应用

    思路:配置网络->安装NFS->配置NFS->挂载NFS服务->Down文件执行.Okay lets go! 配置网络: 在配置网络之前,首先咱得搞定与开发板的交互工作,那么这 ...

  9. 【转】64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解

    64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解,开发裸机环境之前需要先搭建其开发环境,毕竟工欲善其事必先利其器嘛.  安装步骤 1.准备工具安装目录 下载 ar ...

随机推荐

  1. 判断浏览器js代码

    (function(){ var UA = {}; var ua = navigator.userAgent.toLowerCase(),s; UA.ie = (s = ua.match(/(msie ...

  2. 译文:Javascript-function's return

    个人理解+google翻译.如有错误,请指正.原文来自MDN:return 概要 由function返回指定值. 版本信息 实现: JavaScript 1.0, NES 2.0(NES:游戏机在欧洲 ...

  3. 调用 GetProcAddress 失败,在 ISAPI 筛选器 "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" 上

    1.选择网站的ISAPI筛选器,设置ASP.NET的 aspnet_filter.dll右键恢复为父项 如果问题还未解决,执行第2步: 2.是否注册了asp.net,打开cmd运行:C:\Window ...

  4. Sublime字体设置

    {"font_face": "Courier New","font_options":["subpixel_antialias&q ...

  5. 服务器迁移之debian重新配置Web服务的细节

    之前配置Linux服务器时采用的是Debian系统一直很稳定,这次准备迁移到新的服务器环境上,好在以前的配置我在博客都做了备忘,所以很容易就搞定了,这次服务系统采用的是最新的Debian 7.0,但是 ...

  6. 直接下载完整chrome浏览器的方法

    目前通过下吗的链接可以获得独立的安装包. http://www.google.com/chrome/eula.html?standalone=1&hl=zh-CN

  7. Linux tar 解压缩命令

    tar -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加文件 -u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个 ...

  8. hdu 4712 Hamming Distance(随机函数暴力)

    http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Other ...

  9. [转载]WCF序列化65536大小限制的问题

    错误: The formatter threw an exception while trying to deserialize the message: There was an error whi ...

  10. 【win8技巧】去掉Win8导航菜单下面的这台电脑其他的文件夹

    win8 删除 上传 下载 这台电脑 左侧导航 另存为中的 视频.图片.文档.下载的方法!落雨 win8 Windows 8.1  默认将视频.图片.文档.下载.音乐.桌面等常用文件夹也显示在其中了, ...