2005年4月29日

Build ARM ToolChain - I

Following building instructions described in "Building Embedded Linux Systems" book, I had built a ARM toolchain for my private KS8695P platform for testing purpose.

Files needed:
binutils-2.10.1.tar.gz
gcc-2.95.3.tar.gz
glibc-2.2.3.tar.gz
glibc-linuxthreaders-2.2.3.tar.gz
uClibc-0.9.16

Make a new directory “${PROJECT-PATH}/build-tools” to store new toolchains, and new directories build-binutils, build-boot-gcc, build-glibc, and build-uClibc under build-tools/ directory to store new compiled tools, and for those new binary tools and libraries will be installed to tools/ and tools/arm-linux/ directory. The following steps are showing how to compile each tool for my target(KS8695P Board).
(In my experimental machine, ${PROJECT-PATH}= /home/porter/projects/ks8695p/myself-2.4.16-2.95.3/)

1. Binutils
// Include all needed header files provided by KS8695P vendor.
#mkdir ${PROJECT-PATH}/tools/arm-linux/include
#cp –r {kernel}/include/linux/ arm-linux/include
#cp –r {kernel}/include/asm-arm/ arm-linux/include/asm
#cp –r {kernel}/include/asm-generic arm-linux/include
#cd ${PROJECT-PATH}/buld-tools/
#tar zxvf binutils-2.10.1.tar.gz
#cd ${PROJECT-PATH}/build-tools/build-binutils
// Do not do the compilation under the original untar directory.
#../binutils-2.10.1/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools
// Using absolute path for --prefix argument.
#make
#make install
// All binary utilities will be installed to tools/ directory, and we will have arm-linux-addrline、arm-linux-ar、arm-linux-as, etc. under tools/bin/ directory.

2. Bootstrap compiler GCC
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf gcc-2.95.3.tar.gz
#cd ${PROJECT-PATH}/build-tools/build-boot-gcc
//
Do not do the compilation under the original untar directory.
#../gcc-2.95.3/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools --without-headers --with-newlib --enable-languages=c
// To prevent compiling error, "can't find pthread.h", we can change the flag from "--without-headers" to "--with-headers=/usr/include".
#make all-gcc
#make install-gcc
// Under tools/bin, one new arm-linux-gcc tool will be generated.

3. Glibc
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf glibc-2.2.3.tar.gz
#tar zxvf glibc-linuxthreaders-2.2.3.tar.gz –-directory=glibc-2.2.3
#cd ${PROJECT-PATH}/build-tools/build-glibc
//
Do not do the compilation under the original untar directory.
#CC=arm-linux-gcc ../glibc-2.2.3/configure --host=arm-linux --prefix=”/usr” --enable-add-ons --with-headers=${PROJECT-PATH}/tools/arm-linux/include
// Add --disable-profile argument to not use statistics library.
// Add --enable-add-ons=linuxthreads due to we only use
linuxthreads addon.
// Add --without-fp for targets without FPU support.
// Here, the flag, --prefix="/usr", actually is used to pass configuring, we won't install the lib to /usr.
#make
#make install_root=${PROJECT-PATH}/tools/arm-linux prefix=”” install
// Install libraries and headers to "install_root" directory, not the previsous defined "--prefix".
// If the following errors found:
// ./stdio.texi:3270: Cross reference to nonexistent node `bison.info'.
// ./stdio.texi:3269: Cross reference to nonexistent node `flex.info'.
// makeinfo: Removing output file `${PROJECT-PATH}/build-tools/glibc-2.2.3/manual/
// libc.info' due to errors; use --force to preserve.
// Directly modify build-tools/glibc-2.2.3/manual/stdio.texi, and remove @ref{*} to pass the compilation.
// Then several libraries will be created under tools/arm-linux/lib.
// Besides, modify ${PROJECT-PATH}/tools/arm-linux/lib/libc.so, remove the absolute path "/lib/" for our taret platform, GROUP( libc.so.6 libc_nonshared.a ).

To be continued...

0 意見: