build arm toolchain

3月 4th, 2012
#this is not a bash script file, just log of commands.
export ARCH=arm
export TARGET=arm-pc-linux-gnueabi
export PREFIX=/usr/arm
export SYSROOT=$PREFIX/sysroot
export PATH=$PREFIX/bin:$PATH
 
#prepare
sudo mkdir $PREFIX
#chown to allow make install happy at user level so that we won't crash system files on error.
sudo chown $USER $PREFIX
mkdir -p $SYSROOT/usr/include
 
#build binutils
mkdir binutils-2.22/build ; cd binutils-2.22/build
../binutils-2.22/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT  --disable-nls
make
make install
 
#build gcc stage1
../gcc-4.6.3/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-languages=c --without-headers --disable-shared --disable-threads --with-gnu-as --with-gnu-ld
make all-gcc all-target-libgcc
#cd arm-* ; make libgcc_eh.a
make install-gcc install-target-libgcc
 
#linux headers
make at91rm9200dk_defconfig
make include/linux/version.h
cp -a include/linux          $SYSROOT/usr/include/
cp -a include/asm-generic    $SYSROOT/usr/include/
cp -a ./arch/arm/include/asm $SYSROOT/usr/include/
cp -a ./arch/x86/include/asm/ioctl.h  $SYSROOT/usr/include/asm/
cp -a ./arch/x86/include/asm/errno.h  $SYSROOT/usr/include/asm/
cp -a ./arch/avr32/include/asm/bitsperlong.h $SYSROOT/usr/include/asm/
 
#build eglibc
cd eglibc-2.14/libc ; ln -s ../linuxthreads . ; ln -s ../ports .
mkdir ../../build
cd ../../build
../eglibc-2.14/libc/configure --prefix=/usr --host=$TARGET --enable-add-ons --with-headers=$SYSROOT/usr/include
vim config.make
#add -march=armv6 -mfpu=vfp to CFLAGS
make
make install_root=$SYSROOT install
 
#build gcc stage2
../gcc-4.6.3/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++ --with-sysroot=$SYSROOT
 
#done
标签:
目前还没有任何评论.
*