Will0 2010-08-11
ARM926的Linux工具链的制作(续 : 基于uclibc),用uClibc代替了Glibc。
下载的代码目录 root: /home/lake/arm-uclibc-linux
目标目录
dir: /home/lake/arm-uclibc-linux/uclibc-tools
1. 准备工作:
下载 Binutil2.17/Gcc3.4.6/uClibc0.9.28/Linux-kernel2.6.24
Patch:
URL: http://gcc.gnu.org/bugzilla/attachment.cgi?id=6132
此时针对Gcc3.4编译libstd的补丁
环境设定
export PREFIX=/home/lake/arm-uclibc-linux/uclibc-tools
export TARGET=arm-uclibc-linux
export TARGET_PREFIX=$PREFIX/$TARGET
export PATH=$PREFIX/bin:$PATH
编译的host环境是LFS6.3 /Gcc4.1.2版本,不过在RedHat Enterprise Linux4或者5上也可以编译通过。
lake:~/mysrc$ uname -a
Linux LFS 2.6.24 #2 SMP Thu Apr 30 03:05:00 CST 2009 i686 i686 i386 GNU/Linux
lake:~/mysrc$
2. 编译binutil
#mkdir binutils
# cd build_binutils
# rm -fr *
# ../binutils-2.17/configure --target=$TARGET --prefix=$PREFIX --disable-multilib --disable-nls
# make all
# make install
3. 获得核心针对ARM926的头文件
cd ~/lfs/linux-2.6.24
make ARCH=arm CROSS_COMPILE=arm-linux- defconfig
#make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig ------> Select ARM type
make ARCH=arm CROSS_COMPILE=arm-linux-
make include/linux/version.h
cp -ar include/linux ${TARGET_PREFIX}/include/
cp -ar include/asm-arm ${TARGET_PREFIX}/include/asm
cp -ar include/asm-generic ${TARGET_PREFIX}/include/asm-generic
cd $TARGET_PREFIX/
ln -s include sys-include ###GCC编译时候默认使用sys-include,做一个软连接
4. 编译GCC---第一阶段
patch URL: http://gcc.gnu.org/bugzilla/attachment.cgi?id=6132
lake:~/arm-uclibc-linux$ patch -p1 -d gcc-3.4.6 < gcc3.4-libstdc++-uclibc.patch
==============================================================
###Compile first stage gcc
# mkdir build_bootstrap
# cd build_bootstrap
# rm -fr * ----->必须删除就的编译
#
../gcc-3.4.6/configure --target=$TARGET --prefix=$PREFIX \
--with-local-prefix=$TARGET_PREFIX --disable-multilib \
--with-newlib --disable-nls --enable-threads=no --enable-symvers=gnu \
--enable-__cxa_atexit --enable-languages=c --disable-shared \
注意有些编译器版本支持 --with-float=soft --with-softfloat-supp,这对编译U-boot有帮助,不过在Gcc3.4.6上,笔者未试成功
# make all-gcc
# make install-gcc