Linux交叉编译环境终于搭建完成具体步骤:
0、软件请到友善之臂的官网下载
1、解压
tar zxvf arm-linux-gcc-4.4.3-0728.tar.gz
-C/(别make了,直接解压后就可以)
2、设置环境变量:首先
vi ~/.bashrc
然后在最后加上
export
PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin
3、使环境变量立即生效:
source ~/.bashrc
4、验证:arm-linux-gcc-v,我的显示如下:
aidway@aidway-desktop:~$
arm-linux-gcc -v
Using
built-in specs.
Target:
arm-none-linux-gnueabi
Configured
with:
/opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure--build=i386-build_redhat-linux-gnu
--host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi
--prefix=/opt/FriendlyARM/toolschain/4.4.3
--with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root
--enable-languages=c,c++ --disable-multilib --with-arch=armv4t
--with-cpu=arm920t --with-tune=arm920t --with-float=soft
--with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions
--enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3
--with-mpfr=/opt/FriendlyARM/toolschain/4.4.3
--with-ppl=/opt/FriendlyARM/toolschain/4.4.3
--with-cloog=/opt/FriendlyARM/toolschain/4.4.3
--with-mpc=/opt/FriendlyARM/toolschain/4.4.3
--with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root
--disable-nls --enable-threads=posix --enable-symvers=gnu
--enable-c99 --enable-long-long
--enable-target-optspace
Thread model:
posix
gcc version
4.4.3 (ctng-1.6.1)
5、编写一个简单的hello程序,用arm-linux-gcc
-o hello hello.c
编译,生成hello文件,将该文件上传到ARM板(我用的使2440),在ARM板上用./hello
运行程序,如果所有步骤正确的话,将能够正常运行。