Linux kernel package used: (ftp://ftp.kernel.org/pub/linux/kernel/v2.6/)
linux-2.6.17.tar.gz
GNU compiler sources: (ftp://ftp.gnu.org/gnu/)
binutils-2.17.tar.gz
gcc-3.4.6.tar.gz
glibc-2.3.6.tar.gz
glibc-linuxthreads-2.3.6.tar.gz
Patches used: (http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/)
33_all_pr15068-fix.patch
5090_all_divdi3-asm-fix.patch
6200_all_arm-glibc-2.3.6-ioperm.patch
6230_all_arm-glibc-2.3.6-socket-no-weak-lias.patch
gcc_eh.patch.cross
1. Preparation
Create project directory like this:
/root/scholar
|
|--toolchain
| |--binutils-2.17.tar.gz
| |--gcc-3.4.6.tar.gz
| |--glibc-2.3.6.tar.gz
| |--glibc-linuxthreads-2.3.6.tar.gz
|
|--patches
| |--33_all_pr15068-fix.patch
| |--5090_all_divdi3-asm-fix.patch
| |--6200_all_arm-glibc-2.3.6-ioperm.patch
| |--6230_all_arm-glibc-2.3.6-socket-no-weak-lias.patch
| |--gcc_eh.patch.cross
|
|--kernel
|--linux-2.6.17.tar.gz
export PREFIX=/usr/local/arm/scholar
2. Building binutils-2.17
tar -zxvf binutils-2.17.tar.gz
cd binutils-2.17
mkdir arm-linux
cd arm-linux
../configure --target=arm-linux --prefix=$PREFIX --program-prefix=arm-linux-
make
make install
3. Bootstrap GCC (First time compiling GCC without glibc, only pure-C is supported)
tar -zxvf gcc-3.4.6.tar.gz
patch -p1 -d gcc-3.4.6 < patches/33_all_pr15068-fix.patch
cd gcc-3.4.6
vi gcc/config/arm/t-linux (TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h)
mkdir arm-linux
cd arm-linux
../configure --target=arm-linux --prefix=$PREFIX --program-prefix=arm-linux- --disable-threads --disable-shared --enable-languages=c
make
make install
4. Linux kernel header files (This step creates the arm-specified header files for glibc)
tar -zxvf linux-2.6.17.tar.gz
cd linux-2.6.17
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
make include/linux/version.h
cp -dR include/linux $PREFIX/arm-linux/include/
cp -dR include/asm-generic $PREFIX/arm-linux/include/
cp -dR include/asm-arm $PREFIX/arm-linux/include/
mv $PREFIX/arm-linux/include/asm-arm $PREFIX/arm-linux/include/asm
5. glibc-2.3.6
tar -zxvf glibc-2.3.6.tar.gz
tar -zxvf glibc-linuxthreads-2.3.6.tar.gz --directory ./glibc-2.3.6
patch -p1 -d glibc-2.3.6 < patches/5090_all_divdi3-asm-fix.patch
patch -p1 -d glibc-2.3.6 < patches/6200_all_arm-glibc-2.3.6-ioperm.patch
patch -p1 -d glibc-2.3.6 < patches/6230_all_arm-glibc-2.3.6-socket-no-weak-lias.patch
patch -p1 -d glibc-2.3.6 < patches/gcc_eh.patch.cross
mkdir arm-linux
cd arm-linux
CC=arm-linux-gcc AR=arm-linux-ar RANLIB=arm-linux-ranlib LD=arm-linux-ld ../configure --target=arm-linux --prefix=$PREFIX/arm-linux --host=arm-linux --enable-add-ons=linuxthreads --enable-shared --with-headers=$PREFIX/arm-linux/include
make
make install
6. gcc-3.4.6 full version (with glibc, support C/C++)
cd gcc-3.4.6
Change ./gcc/config/arm/t-linux back to original
cd arm-linux
../configure --target=arm-linux --prefix=$PREFIX --program-prefix=arm-linux- --enable-multilib --with-headers=$PREFIX/arm-linux/include --enable-languages=c,c++
make
make install
自此,整个arm-linux的工具链也就生成了.