用crosstool-0.43制作ARM Linux交叉编译工具链
主机环境:
RHEL6.0
kernel 2.6.32-220.2.1.el6.i686
gcc-4.4.6
1.下载源码包
- http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.17.tar.bz2
-
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/linux-libc-headers-2.6.12.0.tar.bz2
-
http://ftp.gnu.org/gnu/binutils/binutils-2.19.1.tar.bz2
-
ftp://ftp.gnu.org/gnu/glibc/glibc-2.3.6.tar.bz2
-
ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.3.6.tar.bz2
-
ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.5.tar.bz2
- tar xvzf ~/Downloads/crosstool-0.43.tar.gz -C /work/rhel/
-
cd /work/rhel/crosstool-0.43/
2.修改配置
编辑gcc-3.4.5-glibc-2.3.6-tls.dat,修改以下内容
- BINUTILS_DIR=binutils-2.20.1
-
LINUX_DIR=linux-2.6.32.17
编辑demo-arm9tdmi.sh,修改以下内容
- TARBALLS_DIR=/work/packages/toolchainsrc
-
RESULT_TOP=/work/rhel
-
eval `cat arm9tdmi.dat gcc-3.4.5-glibc-2.3.6-tls.dat` sh all.sh --notest
3.编译
『附录1』制作交叉编译器时出现的错误及解决办法
①make[2]: i686-host_pc-linux-gnu-ar: Command not found
解决办法:
sudo ln -s `which ar` /usr/local/bin/i686-host_pc-linux-gnu-ar
出处:
②*** These critical programs are missing or too old: as ld
解决办法:
修改glibc-2.3.6源码包的configre的3920行和3978行,改2.1[3-9]* 为2.*
③ ../sysdeps/unix/sysv/linux/bind.S: Assembler messages:
../sysdeps/unix/sysv/linux/bind.S:5: Error: symbol `__bind' is already defined
make[2]: *** [/work/rhel/cross-0.43/build/build-glibc/socket/bind.o] Error 1
make[2]: Leaving directory `/home/zht/cross-compiler/build-tools/glibc-2.3.6/socket'
make[1]: *** [socket/subdir_lib] Error 2
到网上找补丁6230_all_arm-glibc-2.3.6-socket-no-weak-alias.patch 并打入glibc2.3.6中。
- wget http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/glibc/2.3.6/6230_all_arm-glibc-2.3.6-socket-no-weak-alias.patch
参考链接:
- http://kegel.com/crosstool/crosstool-0.43/doc/crosstool-howto.html
-
http://blog.chinaunix.net/space.php?uid=10790773&do=blog&id=208190
阅读(1384) | 评论(0) | 转发(0) |