Chinaunix首页 | 论坛 | 博客
  • 博客访问: 361140
  • 博文数量: 81
  • 博客积分: 4016
  • 博客等级: 上校
  • 技术积分: 800
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-17 18:38
文章分类

全部博文(81)

文章存档

2016年(5)

2015年(2)

2010年(1)

2008年(1)

2007年(4)

2006年(68)

我的朋友

分类: LINUX

2006-06-17 23:04:51

这里给出建立toolchain.3.3.2的脚本(注意,必须先设置内核头文件,如上所述):
gcc-3.3.2.tar.bz2
glibc-2.3.2.tar.bz2,
binutils-head.tar.bz2,
glibc-linuxthreads-2.3.2.tar.bz2
这里是host:i386,target:arm
 
#!/bin/sh -e
 
set -v
 
build_binutils=yes
build_bootstrap=yes
build_glibc=yes
 
#  With thanks to erik mouw, jeff sutherland, and many others
PREFIX=/usr/local/arm/3.3.2     #建立的toolchain的位置,可根据需要自己设定
HOST=i686-pc-linux-gnu           #host类型
#KERNEL=/work/kernel.h3900
KERNEL=YourKernel目录         #这里要注意,不然找不到配置头文件
TGT=arm-linux
DNLD=/work/gcc-downloads      #放置建立toolchain所需要的工具包,把工具包搞到里面去
BLD=/work/arm                 #建立toolchain的编译工作目录
#GCC=gcc-3.3-cvs
GCC=gcc-3.3.2                    #这几个指定工具包的版本
GLIBC=glibc-2.3.2
GLIBC_THREADS=glibc-linuxthreads-2.3.2
BINUTILS=binutils-head
 
if [ "x$build_bootstrap" = "xyes" ] ; then
[ -d $PREFIX ] && rm -rf $PREFIX/*
fi
 
mkdir -p $PREFIX $BLD
pushd $BLD
export PATH=${PREFIX}/bin:$PATH
echo "Versions" > ${PREFIX}/VERSIONS
echo "  $GCC" >> ${PREFIX}/VERSIONS
echo "  $GLIBC" >> ${PREFIX}/VERSIONS
echo "  $BINUTILS" >> ${PREFIX}/VERSIONS
 
# binutils
if [ "x$build_binutils" = "xyes" ] ; then
echo "Tool chain binutils configuration:" >> ${PREFIX}/VERSIONS
echo "../${BINUTILS}/configure --target=$TGT --prefix=$PREFIX --host=$HOST" >> ${PREFIX}/VERSIONS
echo "" >> ${PREFIX}/VERSIONS
rm -rf $BINUTILS ${BINUTILS}-bld
tar jxf ${DNLD}/${BINUTILS}.tar.bz2
mkdir -p ${BINUTILS}-bld
cd ${BINUTILS}-bld
../${BINUTILS}/configure --target=$TGT --prefix=$PREFIX --host=$HOST || exit 1
make || exit 1
make install || exit 1
cd ..
rm -rf $BINUTILS ${BINUTILS}-bld
fi
export PATH=$PREFIX/bin:$PATH
 
# bootstrap compiler
if [ "x$build_bootstrap" = "xyes" ] ; then
rm -rf $GCC ${GCC}-bld
tar jxf ${DNLD}/${GCC}.tar.bz2
mkdir -p ${GCC}-bld
perl -pi -e 's/^(TARGET_LIBGCC2_CFLAGS.*)/$1 -Dinhibit_libc -D__gthr_posix_h/' ${GCC}/gcc/config/arm/t-linux
echo 'T_CFLAGS = -Dinhibit_libc -D__gthr_posix_h' >> ${GCC}/gcc/config/arm/t-linux
cd ${GCC}-bld
../${GCC}/configure --target=$TGT --prefix=$PREFIX --host=$HOST --with-cpu=strongarm1100 --with-headers=$KERNEL/include --disable-shared --disable-threads --enable-languages="c" || exit 1
make || exit 1
make install || exit 1
cd ..
rm -rf $GCC ${GCC}-bld
fi
 
# glibc
if [ "x$build_glibc" = "xyes" ] ; then
echo "Tool chain glibc configuration:" >> ${PREFIX}/VERSIONS
echo "../${GLIBC}/configure --host=$TGT --build=$HOST --with-headers=$KERNEL/include --enable-add-ons=linuxthreads --enable-shared --prefix=$PREFIX" >> ${PREFIX}/VERSIONS
echo "" >> ${PREFIX}/VERSIONS
rm -rf $GLIBC ${GLIBC}-bld
tar jxf ${DNLD}/${GLIBC}.tar.bz2
tar -C $GLIBC -jxf ${DNLD}/${GLIBC_THREADS}.tar.bz2
pushd ${BLD}/${GLIBC}
export CC=arm-linux-gcc
( cat << GLIBC_PATCH_END1
--- ./sysdeps/unix/sysv/linux/arm/sysdep.h.orig 2003-02-20 12:22:10.000000000 -0800
+++ ./sysdeps/unix/sysv/linux/arm/sysdep.h 2003-08-04 19:06:17.000000000 -0700
@@ -158,7 +158,7 @@
        asm volatile ("swi %1 @ syscall " #name \\
        : "=r" (_a1)    \\
        : "i" (SYS_ify(name)) ASM_ARGS_##nr \\
-       : "a1", "memory");    \\
+       : "memory");    \\
        _sys_result = _a1;     \\
      }        \\
      (int) _sys_result; })
--- ./stdio-common/sscanf.c.orig 2003-08-04 19:27:34.000000000 -0700
+++ ./stdio-common/sscanf.c 2003-08-04 19:27:59.000000000 -0700
@@ -27,9 +27,7 @@
 /* Read formatted input from S, according to the format string FORMAT.  */
 /* VARARGS2 */
 int
-sscanf (s, format)
-     const char *s;
-     const char *format;
+sscanf (const char *s, const char *format, ...)
 {
   va_list arg;
   int done;
--- ./linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h.orig 2003-08-04 20:14:05.000000000 -0700
+++ ./linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h 2003-08-04 20:14:33.000000000 -0700
@@ -34,7 +34,7 @@
 # define PSEUDO(name, syscall_name, args)    \\
   .section ".text";       \\
     PSEUDO_PROLOGUE;       \\
-  ENTRY (name)        \\
+  ENTRY (name);        \\
     SINGLE_THREAD_P_INT;      \\
     bne .Lpseudo_cancel;      \\
     DO_CALL (syscall_name, args);     \\
GLIBC_PATCH_END1
) | patch -p1 || exit 1
popd
mkdir -p ${GLIBC}-bld
cd ${GLIBC}-bld
../${GLIBC}/configure --host=$TGT --build=$HOST --with-headers=$KERNEL/include --enable-add-ons=linuxthreads --enable-shared --prefix=$PREFIX || exit 1
make || exit 1
make install || exit 1
cd ..
pushd ${PREFIX}/arm-linux/lib
ln -s ../../lib/* .
export CC=gcc
popd
rm -rf $GLIBC ${GLIBC}-bld
fi
 
sed -e '/*** BUG/d' ${PREFIX}/lib/libc.so > ${PREFIX}/lib/libc.so.new
mv -f ${PREFIX}/lib/libc.so.new -f ${PREFIX}/lib/libc.so
sed -e '/*** BUG/d' ${PREFIX}/lib/libpthread.so > ${PREFIX}/lib/libpthread.so.new
mv -f ${PREFIX}/lib/libpthread.so.new -f ${PREFIX}/lib/libpthread.so
# complete compiler
echo "Tool chain gcc configuration" >> ${PREFIX}/VERSIONS
echo "../${GCC}/configure --target=arm-linux --with-cpu=strongarm1100 --prefix=$PREFIX $HOST --with-headers=$KERNEL/include --enable-threads=pthreads --enable-shared --enable-static --enable-languages=c,c++" >> ${PREFIX}/VERSIONS
echo "" >> ${PREFIX}/VERSIONS
tar jmxf ${DNLD}/${GCC}.tar.bz2
mkdir -p ${GCC}-bld
#perl -pi -e 's/int namelen/unsigned int namelen/' ${GCC}/libjava/java/net/natInetAddress.cc
cd ${GCC}-bld
../${GCC}/configure --target=$TGT --with-cpu=strongarm1100 --prefix=$PREFIX $HOST --with-headers=$KERNEL/include --enable-threads=pthreads --enable-shared --enable-static --enable-languages="c,c++" || exit 1
make || exit 1
make install || exit 1
cd ..
rm -rf $GCC ${GCC}-bld
pushd ${PREFIX}/lib
find ../${TGT}/lib -name "lib*" -type f -exec ln -sf {} . \;
阅读(3887) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

lixin1987052010-07-09 18:03:16

http://www.eefocus.com/article/10-03/94471_1s.html 怎么不要binutils-2.14.tar.bz2呢