Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1861989
  • 博文数量: 317
  • 博客积分: 1557
  • 博客等级: 上尉
  • 技术积分: 1208
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-26 23:38
个人简介

如果想出发,就不要等到明天!

文章分类

全部博文(317)

文章存档

2016年(1)

2015年(41)

2014年(152)

2013年(114)

2012年(4)

2011年(1)

2009年(4)

分类: 嵌入式

2009-08-30 18:04:43

arm-linux-gcc 3.4.6 + linux 2.6.22.6 + glibc 2.3.6 交叉编译工具链制作
 
所需源码包:
binutils-2.18.tar.bz2
gcc-3.4.6.tar.bz2
glibc-2.3.6.tar.bz2
glibc-linuxthreads-2.3.6.tar.bz2
linux-2.6.22.6.tar.gz
 
 
 
所需补丁下载及下载地址:
 
 
 
33_all_pr15068-fix.patch
5090_all_divdi3-asm-fix.patch
6200_all_arm-glibc-2.3.4-ioperm.patch
6230_all_arm-glibc-2.3.6-socket-no-weak-alias.patch
binutils-2.18-posix-1.patch
glibc-2.3.6-libgcc_eh-1.patch
 
 
 
 

export TAR=/tar
export TOP=/usr/local/arm
export CLFS=${TOP}/clfs
export SYSROOT=${TOP}/3.4.6
export TARGET_PREFIX=${TOP}/3.4.6

LINUX_VERSION=2.6.22.6
BINUTILS_VERSION=2.18
GLIBC_VERSION=2.3.6
GCC_VERSION=3.4.6

unset CFLAGS
unset CXXFLAGS

export CLFS_TARGET="arm-linux"
export PATH=${TARGET_PREFIX}/bin:/bin:/usr/bin:$PATH

rm -rf ${TOP}

install -dv ${SYSROOT}/usr/include
install -dv ${TOP}/source
cd ${TOP}/source
cp ${TAR}/linux-${LINUX_VERSION}.tar.gz ./
gzip -d ./linux-${LINUX_VERSION}.tar.gz
tar -xf linux-${LINUX_VERSION}.tar
rm -rf linux-${LINUX_VERSION}.tar
cd linux-${LINUX_VERSION}
make s3c2410_defconfig ARCH=arm
make include/linux/version.h
cp -a include/{asm-generic,linux,mtd,scsi,sound} ${SYSROOT}/usr/include
cp -a include/asm-arm ${SYSROOT}/usr/include/asm

 

mkdir -p ${TARGET_PREFIX}

 

            ####  INSTALLATION OF CROSS BINUTILS #######

 

cd ${TOP}/source
tar -jxf ${TAR}/binutils-${BINUTILS_VERSION}.tar.bz2
cd binutils-${BINUTILS_VERSION}
patch -Np1 -i ${TAR}/binutils-${BINUTILS_VERSION}-posix-1.patch
mkdir -p ${TOP}/source/BUILD/binutils-${BINUTILS_VERSION}
cd ${TOP}/source/BUILD/binutils-${BINUTILS_VERSION}
AR=ar
AS=as
${TOP}/source/binutils-${BINUTILS_VERSION}/configure --prefix=${TARGET_PREFIX} --target=${CLFS_TARGET} --with-sysroot=${SYSROOT} --disable-nls --enable-shared --disable-multilib
make configure-host
make
make install
cp -v ${TOP}/source/binutils-${BINUTILS_VERSION}/include/libiberty.h ${SYSROOT}/usr/include


       #######    INSTALLATION OF GLIBC HEADERS   #######

cd ${TOP}/source
tar -jxf ${TAR}/glibc-${GLIBC_VERSION}.tar.bz2
mv glibc-${GLIBC_VERSION} glibc-${GLIBC_VERSION}-headers-build
cd ${TOP}/source/glibc-${GLIBC_VERSION}-headers-build
tar -jxf ${TAR}/glibc-linuxthreads-2.3.6.tar.bz2

mkdir -p ${TOP}/source/BUILD/glibc-${GLIBC_VERSION}-headers-build
cd ${TOP}/source/BUILD/glibc-${GLIBC_VERSION}-headers-build

echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
echo "libc_cv_arm_tls=yes" >> config.cache

CC=gcc
${TOP}/source/glibc-${GLIBC_VERSION}-headers-build/configure --prefix=/usr --host=${CLFS_TARGET} --with-headers=${SYSROOT}/usr/include --enable-add-ons=linuxthreads --cache-file=config.cache


make cross-compiling=yes install-headers install_root=${SYSROOT}
cp -v bits/stdio_lim.h ${SYSROOT}/usr/include/bits
touch ${SYSROOT}/usr/include/gnu/stubs.h
touch ${SYSROOT}/usr/include/bits/stdio_lim.h

           ######  gcc-${GCC_VERSION}-stage1  ##########
cd ${TOP}/source
tar -jxf ${TAR}/gcc-${GCC_VERSION}.tar.bz2
mv gcc-${GCC_VERSION} gcc-${GCC_VERSION}-stage1
cd gcc-${GCC_VERSION}-stage1
patch -p1 < ${TAR}/33_all_pr15068-fix.patch
#patch -Np1 -i ${TAR}/gcc-${GCC_VERSION}-posix-1.patch
#patch -Np1 -i ${TAR}/gcc-${GCC_VERSION}-cross_search_paths-1.patch
cd ${TOP}/source
mkdir -p BUILD/gcc-${GCC_VERSION}-stage1
cd BUILD/gcc-${GCC_VERSION}-stage1
${TOP}/source/gcc-${GCC_VERSION}-stage1/configure --prefix=${TARGET_PREFIX} --host=i686-pc-linux-gnu --target=${CLFS_TARGET} --with-sysroot=${SYSROOT} --disable-shared --enable-languages=c
make all-gcc
make install-gcc

 

 

              ##########  GLIBC BUILD ############

cd ${TOP}/source
tar -jxf ${TAR}/glibc-${GLIBC_VERSION}.tar.bz2
cd ${TOP}/source/glibc-${GLIBC_VERSION}
tar -jxf ${TAR}/glibc-linuxthreads-2.3.6.tar.bz2
mkdir -p ${TOP}/source/BUILD/glibc-${GLIBC_VERSION}
cd ${TOP}/source/BUILD/glibc-${GLIBC_VERSION}
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
echo "libc_cv_arm_tls=yes" >> config.cache
BUILD_CC="gcc"
CC="${CLFS_TARGET}-gcc"
AR="${CLFS_TARGET}-ar"
RANLIB="${CLFS_TARGET}-ranlib"
${TOP}/source/glibc-${GLIBC_VERSION}/configure --prefix=/usr --libexecdir=/usr/lib/glibc --host=${CLFS_TARGET} --build=i686-pc-linux-gnu --disable-profile --enable-add-ons=linuxthreads --with-tls --enable-kernel=2.6.0 --with-__thread --with-binutils=${TARGET_PREFIX}/bin --with-headers=${SYSROOT}/usr/include --cache-file=config.cache
cd ${TOP}/source/glibc-${GLIBC_VERSION}
patch -p0 <${TAR}/5090_all_divdi3-asm-fix.patch
patch -p1 <${TAR}/6200_all_arm-glibc-2.3.4-ioperm.patch
patch -p1 <${TAR}/6230_all_arm-glibc-2.3.6-socket-no-weak-alias.patch
patch -p1 <${TAR}/glibc-2.3.6-libgcc_eh-1.patch
cd ${TOP}/source/BUILD/glibc-${GLIBC_VERSION}
make
make install install_root=${SYSROOT}

 

配置libc.so文件
# vi ${SYSROOT}/usr/lib/libc.so
将GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a )
改为:GROUP ( libc.so.6 libc_nonshared.a )
 
配置libpthread.so文件
# vi ${SYSROOT}/usr/lib/libpthread.so
将GROUP ( /lib/libpthread.so.0 /lib/libpthread_nonshared.a )
改为:GROUP ( libpthread.so.0 libpthread_nonshared.a )

 

 

           ########  gcc-${GCC_VERSION}-stage2 #########

cd ${TOP}/source
tar -jxf ${TAR}/gcc-${GCC_VERSION}.tar.bz2
mv gcc-${GCC_VERSION} gcc-${GCC_VERSION}-stage2
cd gcc-${GCC_VERSION}-stage2
patch -p1 < ${TAR}/33_all_pr15068-fix.patch
cd ${TOP}/source
mkdir -p BUILD/gcc-${GCC_VERSION}-stage2
cd BUILD/gcc-${GCC_VERSION}-stage2
${TOP}/source/gcc-${GCC_VERSION}-stage2/configure --prefix=${TARGET_PREFIX} --host=i686-pc-linux-gnu --target=${CLFS_TARGET} --with-sysroot=${SYSROOT} --enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix

make all-gcc
read stop
make install-gcc install_root=${TARGET_PREFIX}

 

 

 

 

阅读(8129) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~