Pre-work:
Tool packages which are needed:
crosstool-0.43.tar.gz http://kegel.com/crosstool/crosstool-0.43.tar.gz
linux-2.6.15.4.tar.bz2 ftp://ftp.kernel.org
binutils-2.16.1.tar.bz2  ftp://ftp.gnu.org
gcc-4.0.2.tar.bz2 ftp://ftp.gnu.org
glibc-2.3.5.tar.bz2 ftp://ftp.gnu.org
glibc-linuxthreads-2.3.5.tar.bz2 ftp://ftp.gnu.org
linux-libc-headers-2.6.12.0.tar.bz2 ftp://ftp.gnu.org
1. Create Tool Source Directory
# cd /usr/src
# mkdir crosstool
2. Export Environment Variables
# vi /etc/profile
Add three lines at the bottom of /etc/profile
#Crosstool Chain Variables
PRJROOT=/usr/src/crosstool
export PRJROOT
# source /etc/profile
3. Unzip crosstool-0.43
# cd $PRJROOT
# tar xvfz crosstool-0.43.tar.gz
# cd crosstool-0.43
# cp demo-arm9tdmi.sh arm9.sh
# vi arm9.sh
set -ex
TARBALLS_DIR=$PRJROOT #The directory where you have downloaded tool packages
RESULT_TOP=/opt/arm #The directory where store the compiled files
export TARBALLS_DIR RESULT_TOP
GCC_LANGUAGES="c,c++"
export GCC_LANGUAGES
mkdir -p $RESULT_TOP
eval `cat arm9tdmi.dat gcc-4.0.2-glibc-2.3.5-tls.dat` sh all.sh --notest # --nounpack
echo Done.
If the source packages have been unpacked in the $PRJROOT/crosstool-0.43/build/arm-linux-/gcc-4.0.2-glibc-2.3.5,
the annotation above "# --nounpack" can be edited to "--nounpack" to save unpacking time.
#vi arm9tdmi.dat
KERNELCONFIG=`pwd`/arm.config # configure kernel
TARGET=arm-9tdmi-linux-gnu # the name of compile tool chain
GCC_EXTRA_CONFIG="--with-cpu=arm9tdmi --enable-cxx-flags=-mcpu=arm9tdmi"
TARGET_CFLAGS="-O" # compile level
#vi gcc-4.0.2-glibc-2.3.5-tls.dat
BINUTILS_DIR=binutils-2.16.1
GCC_DIR=gcc-4.0.2
GLIBC_DIR=glibc-2.3.5
LINUX_DIR=linux-2.6.15.4
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.5
GLIBC_EXTRA_CONFIG="$GLIBC_EXTRA_CONFIG --with-tls --with-__thread  --enable-kernel=2.4.18"
Note: download correct edition binutils, gcc, glibc, glibc-linuxthreads, linux, linux-libc-headers source tar, bz2 is perferred format.
The download directory is $PRJROOT.
Now input command in the directory $PRJROOT/crosstool-0.43
#cd $PRJROOT/crosstool-0.43
$./arm9.sh
If the following error message appears,
"...
+ abort 'Don'\''t run all.sh or crosstool.sh as root, it'\''s dangerous'
+ echo 'Don'\''t' run all.sh or crosstool.sh as root, 'it'\''s' dangerous
Don't run all.sh or crosstool.sh as root, it's dangerous
+ exec false"
You should exit root user account, use common user to execute the ./arm9.sh
Now you can have a cup of tea to wait for your arm compile tool chain.
Where you get the following message, congratulation! Today's work is successfully finished.
"...
testhello: C compiler can in fact build a trivial program.
+ test '' = 1
+ test '' = 1
+ test '' = 1
+ test 1 = ''
+ echo Done.
Done."