红联Linux门户
Linux帮助

在Fedora 8 下建立 ARM-Linux 交叉编译环境

发布时间:2008-02-19 09:57:26来源:红联作者:erfcend
补:在Fedora 8 下建立 ARM-Linux 交叉编译环境

Host CPU:AMD 3000+ (X86-64)
RAM: DDR400 1GB (双通道)
OS: Fedora 8

同样使用crosstool-0.43,因为没有新的版本(截止2008年1月24日),强烈希望Dan Kegel能出新的版本!

我在http://kegel.com/crosstool/crosstool-0.43/buildlogs/上看到arm9tdmi平台的交叉编译器最新的成功组合为

gcc-4.1.1
cgcc-3.3.6
glibc-2.3.2
binutils-2.16.1
linux-2.6.15.4
hdrs-2.6.12.0

我回来看了看去年我在f7下做gcc-4.1.0还不是最新的,而且现在的内核已经是linux-2.6.24,所以决定重做交叉编译器。

我对demo-arm9tdmi.sh的修改为:

引用:
#!/bin/sh

# This script has one line for each known working toolchain

# for this architecture. Uncomment the one you want.

# Generated by generate-demo.pl from buildlogs/all.dats.txt



set -ex
TARBALLS_DIR=/home/tekkamanninja/embeddedLinux/ARM-Linux_source

RESULT_TOP=/home/tekkamanninja/embeddedLinux/crosstool-4.1.1
export TARBALLS_DIR RESULT_TOP

GCC_LANGUAGES="c,c++"

export GCC_LANGUAGES



# Really, you should do the mkdir before running this,

# and chown /opt/crosstool to yourself so you don't need to run as root.

mkdir -p $RESULT_TOP



#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.2.5.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.2.3-glibc-2.3.2-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.2.5.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.3.6-glibc-2.3.2-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.2.5.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.2-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.5-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.2-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.6-tls.dat` sh all.sh --notest

#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2.dat` sh all.sh --notest
#eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2-tls.dat` sh all.sh --notest
eval `cat arm9tdmi.dat gcc-4.1.1-glibc-2.3.2.dat` sh all.sh --notest

echo Done.



然后修改gcc-4.1.1-glibc-2.3.2.dat :
BINUTILS_DIR=binutils-2.16.1
GCC_CORE_DIR=gcc-3.3.6
GCC_DIR=gcc-4.1.1
GLIBC_DIR=glibc-2.3.2
LINUX_DIR=linux-2.6.24
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.2
GDB_DIR=gdb-6.5


然后下载相应的bz2包到 TARBALLS_DIR文件夹,最后进入crosstool-0.43目录,输入./demo-arm9tdmi.sh,最后经过不到一个小时,编译成功!

网友反馈:

1、有位网友按以上的方法做,碰到了如下错误提示:

引用:
abort 'Don'\''t run all.sh or crosstool.sh as root, it'\''s dangerous'
echo 'Don'\''t' run all.sh or crosstool.sh as root, 'it'\''s' dangerous
Don't run all.sh or crosstool.sh as root, it


原因是他用root登录编译,后来他以普通用户登录,就成功了!

所以我在这里再次建议:在嵌入式开发时,最好以普通用户登录,这样Host系统会比较安全。《构建嵌入式Linux系统》里也是这样建议的!!!

2、有位网友碰到了如下错误提示:
......

crosstool: glibc refuses to build if LD_LIBRARY_PATH is set. Please unset it before running this script.

问题的解决办法:

在shell中输入:
unset LD_LIBRARY_PATH

类似的问题也可这么解决的!

作者:雄锋 文章引用
文章评论

共有 0 条评论