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目录,如下图:


1

可见采用的交叉编译器是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'

make: *** [depend]错误 2

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

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


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


2

在此先记录下来

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

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐