ARM GCC 도구 체인 구축

5990 단어
1. 다운로드 코드는 다음과 같습니다.
binutils-2.24.tar.bz2  glibc-2.17.tar      linux-3.10.28.tar
gcc-4.8.0.tar.bz2      glibc-2.19.tar.bz2

2. binutils 컴파일
binutls 코드를 src 디렉터리에 압축을 풀고build 디렉터리에 binutil 디렉터리를 만듭니다.
build/binutils 디렉토리에서 다음을 수행합니다.
../../src/binutils-2.24/configure --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --target=arm-linux-gnueabi

그리고make-j10,makeinstall을 실행합니다.
3. 커널 헤드 파일 설치
커널 코드를 src 디렉토리에 압축을 풀고 커널 코드 디렉토리에 들어가서 다음을 수행합니다.
make mrproper
make ARCH=arm vexpress_defconfig
make ARCH=arm headers_check
make ARCH=arm INSTALL_HDR_PATH=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot/usr headers_install
 
find ../../toolchain/arm-linux-gnueabi/sysroot/usr/include/ -name ".install" -or -name "..install.cmd" | xargs rm -fv

4.bootstrap GCC 만들기
디렉터리build/gcc 만들기first, 그리고 이 디렉터리에 들어가서:
 ../../src/gcc-4.8.0/configure --build=i686-pc-linux-gnu  --target=arm-linux-gnueabi --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --with-newlib --without-headers --disable-threads  --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-nls  --disable-shared  --with-gnu-ld  --with-gnu-as --enable-languages=c --with-float=softfp --with-fpu=vfpv3 --with-cpu=cortex-a15 --with-tune=cortex-a15  --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local --with-mode=arm
이후 다음을 수행합니다.
make all-gcc install-gcc

make all-target-libgcc install-target-libgcc

5. GLIBC 컴파일
먼저 실행:
export PATH=$PATH:/home/charles/code/cross-compile-arm/toolchain/bin

디렉터리build/glibc를 만들고 이 디렉터리에 들어가서 실행하십시오:
 CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar  RANLIB=arm-linux-gnueabi-ranlib ../../src/glibc-2.17/configure   --build=i686-pc-linux-gnu  --host=arm-linux-gnueabi --prefix=/usr --with-headers=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot/usr/include  --enable-add-ons --with-mode=arm
다음을 수행합니다.
make; make install install_root=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot
6.최종 gcc 컴파일:
디렉터리build/gcc 만들기final, 실행:
../../src/gcc-4.8.0/configure --build=i686-pc-linux-gnu --target=arm-linux-gnueabi --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --disable-libmudflap --disable-libssp --disable-nls --disable-libstdcxx-pch --with-interwork --with-mode=arm --with-fpu=vfpv3 --with-cpu=cortex-a15 --with-tune=cortex-a15 --with-float=softfp --enable-libgomp --enable-poison-system-directories --enable-symvers=gnu --enable-long-long --enable-threads --enable-languages=c,c++ --enable-shared --enable-lto --enable-__cxa_atexit --with-gnu-as --with-gnu-ld --enable-__cxa_atexit  --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local
다음을 수행합니다.
make all
make install

마지막으로 생성된 도구 체인은 다음과 같습니다.
$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/charles/code/cross-compile-arm/toolchain/libexec/gcc/arm-linux-gnueabi/4.8.0/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../../src/gcc-4.8.0/configure --build=i686-pc-linux-gnu --target=arm-linux-gnueabi --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --disable-libmudflap --disable-libssp --disable-nls --disable-libstdcxx-pch --with-interwork --with-mode=arm --with-fpu=vfpv3 --with-cpu=cortex-a15 --with-tune=cortex-a15 --with-float=softfp --enable-libgomp --enable-poison-system-directories --enable-symvers=gnu --enable-long-long --enable-threads --enable-languages=c,c++ --enable-shared --enable-lto --enable-__cxa_atexit --with-gnu-as --with-gnu-ld --enable-__cxa_atexit --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local
Thread model: posix
gcc version 4.8.0 (GCC) 

============================================
1. cortex-a9의 경우 다음과 같이 구성됩니다.
bootstrap gcc:
../../src/gcc-4.8.0/configure --build=i686-pc-linux-gnu  --target=arm-linux-gnueabi --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --with-newlib --without-headers --disable-threads  --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-nls  --disable-shared  --with-gnu-ld  --with-gnu-as --enable-languages=c --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3  --with-tune=cortex-a9  --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local --with-mode=arm 

full gcc
  ../../src/gcc-4.8.0/configure --build=i686-pc-linux-gnu --target=arm-linux-gnueabi --prefix=/home/charles/code/cross-compile-arm/toolchain --with-sysroot=/home/charles/code/cross-compile-arm/toolchain/arm-linux-gnueabi/sysroot --disable-libmudflap --disable-libssp --disable-nls --disable-libstdcxx-pch --with-interwork --with-arch=armv7-a --with-mode=arm --with-fpu=vfpv3  --with-tune=cortex-a9 --with-float=softfp --enable-libgomp --enable-poison-system-directories --enable-symvers=gnu --enable-long-long --enable-threads --enable-languages=c,c++ --enable-shared --enable-lto --enable-__cxa_atexit --with-gnu-as --with-gnu-ld --enable-__cxa_atexit  --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local

좋은 웹페이지 즐겨찾기