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. GridView - javascript 触发后台 OnSelectedIndexChanged

    1.ASPX <asp:GridView ID="gdvDealers" runat="server" AutoGenerateColumns=" ...

  2. javascript 面向对象技术

    面向对象术语 对象 ECMA-262 把对象(object)定义为“属性的无序集合,每个属性存放一个原始值.对象或函数”.严格来说,这意味着对象是无特定顺序的值的数组. 尽管 ECMAScript 如 ...

  3. IE6/IE7中li底部4px的Bug

    当li的子元素中有浮动(float)时,IE6/IE7中<li>元素的下面会产生4px空隙的bug. XHTML <ul class="list"> < ...

  4. 搭建pptpd实现vpn

    PPTP(Point to Point Tuneling Protocol,点对点隧道协议)是一种主要用于VPN的数据链路层网络协议. 环境:debian 7.0 在linux下安装pptpd服务实现 ...

  5. 淘宝IP地址库API接口(PHP)通过ip获取地址信息

    淘宝IP地址库网址:http://ip.taobao.com/ 提供的服务包括: 1. 根据用户提供的IP地址,快速查询出该IP地址所在的地理信息和地理相关的信息,包括国家.省.市和运营商. 2. 用 ...

  6. Ping的过程详解

    先看拓朴图: 我在这里讲拼的两情况,一种是同一网段内,一种是跨网段的ping …. 首先,如果主机A,要去拼主机B,那么主机A,就要封装二层报文,他会先查自己的MAC地址表,如果没有B的MAC地址,就 ...

  7. js 手机端触发事事件、javascript手机端/移动端触发事件

    处理Touch事件能让你跟踪用户的每一根手指的位置.你可以绑定以下四种Touch事件: touchstart: // 手指放到屏幕上的时候触发 touchmove: // 手指在屏幕上移动的时候触发 ...

  8. PL/SQL数据导入导出浅谈(1)

    近来需要通过PL/SQL向Oracle中导数据,特此总结一下 试例表:test 字段:id;name;org; 1.直接复制粘贴(当数据量不是特别大的时候) 1)使用select * from tes ...

  9. Hibernate从入门到精通(三)Hibernate配置文件

    在上次的博文Hibernate从入门到精通(二)Hibernate实例演示我们已经通过一个实例的演示对Hibernate的基本使用有了一个简单的认识,这里我们在此简单回顾一下Hibernate框架的使 ...

  10. cocos2dx之C++调用Lua

    原文地址:http://blog.csdn.net/dingkun520wy/article/details/49839701 1.引入头文件 #include "cocos2d.h&quo ...