2007/09/10

GNU toolchain

這裡針對arm 920T版子做設定

主要參考Karim的書, 另外再補充一些東西

1. 設定環境變數:

export PROJECT=embedded
export PRJROOT=/root/${PROJECT}
export TARGET=arm-linux
export PREFIX=${PRJROOT}/tools
export TARGET_PREFIX=${PREFIX}/${TARGET}
export PATH=${PREFIX}/bin:${PATH}
cd $PRJROOT

2. 核心設定

使用linux-2.4.18在下載patch-2.4.18-rmk7.gz patch檔
解壓縮後:
cd linux-2.4.18
gzip -cd ../patch-2.4.18-rmk7.gz patch -p1
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig

3. binutils

下載binutils-2.10.1.tar.gz
cd ${PRJROOT}/build-tools
tar zxvf binutils-2.10.1.tar.gz
cd build-binutils
../binutils-2.10.1/configure --target=$TARGET --prefix=${PREFIX}
make
make install

4. gcc

下載gcc-2.95.3.tar.gz
patch檔: gcc-2.95.3-2.patch gcc-2.95.3-no_fixinc-1.patch gcc-2.95.3-returntype_fix-1.patch
tar zxvf gcc-2.95.3.tar.gz
cd gcc-2.95.3
patch -p1 < gcc-2.95.3-2.patch
patch -p1 < gcc-2.95.3-no_fixinc-1.patch
patch -p1 < gcc-2.95.3-returntype_fix-1.patch
cd ../build-boot-gcc
../gcc-2.95.3/configure --target=${TARGET} --prefix=${PREFIX} \
> --without-headers --with-newlib --enable-languages=c
make all-gcc
make install-gcc

5. glibc

下載glibc-2.2.3 , glibc-linuxthreads-2.2.3.tar.gz
patch檔: glibc-manual-stdin.texi-1.127.patch
Fixes error./stdio.texi:3269: First argument to cross-reference may not be
empty../stdio.texi:3270: First argument to cross-reference may not be
empty.makeinfo: Removing output file
`/home/dank/downloads/crosstool-0.24/build/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/glibc-2.2.3/manual/libc.info'
due to errors; use --force to preserve.make[2]: *** [libc.info] Error 2make[2]:
Leaving directory
`/home/dank/downloads/crosstool-0.24/build/mipsel-unknown-linux-gnu/gcc-3.2.3-glibc-2.2.3/glibc-2.2.3/manual'
===================================================================RCS
file: /cvs/glibc/libc/manual/stdio.texi,vretrieving revision 1.126retrieving
revision 1.127diff -u -r1.126 -r1.127--- libc/manual/stdio.texi 2001/06/06
07:11:31 1.126+++ libc/manual/stdio.texi 2001/07/31 18:57:16 1.127@@
-3265,8 +3265,8 @@ If you are trying to read input that doesn't match a
single, fixed pattern, you may be better off using a tool such as Flex to
generate a lexical scanner, or Bison to generate a parser, rather than
using-@code{scanf}. For more
information about these tools, see @ref{, , ,-flex.info, Flex: The Lexical
Scanner Generator}, and @ref{, , ,+@code{scanf}. For more information about
these tools, see @ref{Top, , ,+flex.info, Flex: The Lexical Scanner Generator},
and @ref{Top, , , bison.info, The Bison Reference Manual}.
@node
Input Conversion Syntax

tar -xvzf glibc-2.2.3.tar.gz
tar -xzvf glibc-linuxthreads-2.2.3.tar.gz --directory=glibc-2.2.3
cd build-glibc
CC=arm-linux-gcc ../glibc-2.2.3/configure --host=$TARGET \
> --prefix="/usr"--enable-add-ons \
> --with-headers=$TARGET_PREFIX/include

make
make install_root=$TARGET_PREFIX prefix="" install

6. 修改libc.so

vi ${TARGET_PREFIX}/bin/libc.so

/* GNU ld script Use the shared library, but some functions are only in
the static library, so try that secondarily. */
GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a )
改成
GROUP ( libc.so.6 libc_nonshared.a )

7. 完整gcc的規劃

cd $PRJROOT/build-tools/build-gcc
../gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++
make all
make install

8.配置uClibc
下載uClibc-0.9.16
cd $PRJROOT/build-tools/uClibc-0.2.98
make CROSS=arm-linux- menuconfig

make CROSS=arm-linux-
make CROSS=arm-linux- PREFIX="" install