一、準(zhǔn)備工作 1,、準(zhǔn)備文件 binutils-2.22.tar.bz2 gcc-4.6.3.tar.bz2 glibc-2.14.1.tar.xz glibc-ports-2.14.1.tar.gz glibc-linuxthreads-2.5.tar.bz2 gdb-7.4.1.tar.bz2 linux-2.6.38.8.tar.bz2 mpfr-3.1.1.tar.bz2 mpc-1.0.1.tar.gz gmp-5.1.0.tar.bz2
2,、建立以下變量,方便稍候的輸入 #vim ~/.bashrc export TARGET=arm-linux-gnueabi
3,、為宿主機(jī)安裝mpfr,、mpc、gmp #tar -xvf gmp-5.1.0.tar.bz2 #cd gmp-5.1.0 #mkdir build #cd build #../configure #make all -j4 #make install
#tar -xvf mpfr-3.1.1.tar.bz2 # cd mpfr-3.1.1 #cd build #../configure #make all -j4 #make install
#tar -xvf mpc-1.0.1.tar.gz #cd mpc-1.0.1 #mkdir build #cd build #../configure #make all -j4 #make install
4,、復(fù)制linux-kernel-headers #tar -xvf linux-2.6.38.8.tar.bz2 #cd linux-2.6.38.8 #make include/linux/version.h #mkdir -p $TARGET_PREFIX/include #cp -r ./include/linux/ $TARGET_PREFIX/include #cp -r ./include/asm-generic/ $TARGET_PREFIX/include #cp -r ./arch/arm/include/asm/ $TARGET_PREFIX/include
二,、編譯binutils #tar -xvf binutils-2.22.tar.bz2 #cd binutils-2.22 #mkdir build #cd build #../configure --prefix=$PREFIX --target=$TARGET #make all -j4 #make install
三、初步編譯gcc(不帶glibc支持) #tar -xvf gcc-4.6.3.tar.bz2
重新解壓mpfr-3.1.1.tar.bz2,、mpc-1.0.1.tar.gz,、gmp-5.1.0.tar.bz2,并改名復(fù)制至gcc-4.6.3中 #rm -rf mpfr-3.1.1 mpc-1.0.1 gmp-5.1.0
#tar -xvf gmp-5.1.0.tar.bz2 #mv gmp-5.1.0 gmp #mv ./gmp ./gcc-4.6.3
#tar -xvf mpfr-3.1.1.tar.bz2 #mv mpfr-3.1.1 mpfr #mv ./mpfr ./gcc-4.6.3
#tar -xvf mpc-1.0.1.tar.gz #mv mpc-1.0.1 mpc #mv ./mpc ./gcc-4.6.3
#cd gcc-4.6.3 #mkdir build #cd build #../configure --prefix=$PREFIX --target=$TARGET --without-headers --enable-languages=c --disable-threads --with-newlib --disable-shared --disable-libmudflap --disable-libssp --disable-decimal-float #make install-gcc #make all-target-libgcc -j4 #make install-target-libgcc
四,、編譯glibc #tar -xvf glibc-2.14.1.tar.xz #tar -xvf glibc-ports-2.14.1.tar.gz #mv glibc-ports-2.14.1 ports #tar -xvf glibc-linuxthreads-2.5.tar.bz2 --directory=./glibc-2.14.1
# cd glibc-2.14.1 # mkdir build # cd build # CC=$TARGET-gcc # ln -s /usr/local/arm-linux-gcc/4.6.3/lib/gcc/arm-linux-gnueabi/4.6.3/libgcc.a /usr/local/arm-linux-gcc/4.6.3/lib/gcc/arm-linux-gnueabi/4.6.3/libgcc_eh.a
創(chuàng)建config.cache配置文件 # vim config.cache libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes libc_cv_arm_tls=yes
# ../configure --host=$TARGET --target=$TARGET --prefix=$TARGET_PREFIX --enable-add-ons --disable-profile --cache-file=config.cache --with-binutils=$PREFIX/bin --with-headers=$TARGET_PREFIX/include #make all -j4 #make install
五、重新編譯gcc # cd gcc-4.6.3/build/ # rm -rf * # ../configure --prefix=$PREFIX --target=$TARGET --enable-shared --enable-languages=c,c++ # make all -j4 # make install
六,、編譯gdb # tar -xvf gdb-7.4.1.tar.bz2 # make all -j4 # make install
七,、創(chuàng)建鏈接 # cd $PREFIX/bin # ln -s arm-linux-gnueabi-addr2line arm-linux-addr2line
完成 |
|
來(lái)自: guitarhua > 《待分類(lèi)》