Advertisement
Guest User

install-toolchain.sh

a guest
Jun 15th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. #!/bin/sh
  2. # Written by Uwe Hermann <uwe@hermann-uwe.de>, released as public domain.
  3. # Edited by Travis Wiens ( http://blog.nutaksas.com/2009/05/installing-gnuarm-arm-toolchain-on.html )
  4. # Edited by Lionel Debroux for newer gcc/binutils/newlib/gdb versions and nspire-gcc.
  5.  
  6. TARGET=arm-none-eabi
  7. PREFIX=/usr/local
  8. PARALLEL="-j2" # or "-j<number of build jobs>"
  9.  
  10. BINUTILS=binutils-2.23.2 # http://www.gnu.org/software/binutils/
  11. GCC=gcc-4.8.1 # http://gcc.gnu.org/
  12. NEWLIB=newlib-2.0.0 # http://sourceware.org/newlib/
  13. GDB=gdb-7.6 # http://www.gnu.org/software/gdb/
  14.  
  15. mkdir build-binutils
  16. mkdir build
  17.  
  18. # IMPORTANT NOTE: in order to compile GCC 4.8, you need the GMP, MPFR and MPC development libraries.
  19. # For example, if you have installed them yourself in $PREFIX, you'll have to add --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX.
  20.  
  21. # NOTE: the second rm -rf is commented, because it's not strictly necessary.
  22.  
  23. # Section 1: GNU Binutils.
  24. (wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2 && tar xvjf $BINUTILS.tar.bz2 && cd build-binutils && ../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --with-system-zlib --with-gnu-as --with-gnu-ld --disable-nls --with-float=soft --disable-werror && make $PARALLEL all && make install && cd ..) || exit 1;
  25. ##rm -rf $BINUTILS $BINUTILS.tar.bz2
  26.  
  27. # Section 2: GCC, step 1.
  28. (wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2 && tar xvjf $GCC.tar.bz2 && cd build && ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c,c++" --with-system-zlib --with-newlib --without-headers --disable-shared --with-gnu-as --with-gnu-ld --with-float=soft --disable-werror && make $PARALLEL all-gcc && make install-gcc && cd .. && rm -rf build/*) || exit 1;
  29. ##rm -rf $GCC.tar.bz2
  30.  
  31. # Section 3: Newlib.
  32. (wget -c ftp://sourceware.org/pub/newlib/$NEWLIB.tar.gz && tar xvzf $NEWLIB.tar.gz && cd build && ../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls --with-float=soft --disable-werror && make $PARALLEL && make install && cd .. && rm -rf build/*) || exit 1;
  33. ##rm -rf $NEWLIB $NEWLIB.tar.gz
  34.  
  35. # Section 4: GCC, step 2. Yes, this is necessary.
  36. (cd build && ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c,c++" --with-system-zlib --with-newlib --disable-shared --with-gnu-as --with-gnu-ld --with-float=soft --disable-werror && make $PARALLEL && make install && cd .. && rm -rf build/*) || exit 1
  37. ##rm -rf $GCC
  38.  
  39. # Section 5: GDB.
  40. (wget -c ftp://ftp.gnu.org/gnu/gdb/$GDB.tar.bz2 && tar xvjf $GDB.tar.bz2 && cd build && ../$GDB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --disable-werror && make $PARALLEL && make install && cd .. && rm -rf build/*) || exit 1;
  41. ##rm -rf $GDB $GDB.tar.bz2
  42.  
  43. # Section 6: elf2flt.
  44. cat > Ndless-elf2flt.patch << EOF
  45. 91a92,97
  46. > #define R_ARM_CALL 28
  47. > #define R_ARM_JUMP24 29
  48. > #define R_ARM_TARGET1 38
  49. > #define R_ARM_V4BX 40
  50. > #define R_ARM_TARGET2 41
  51. > #define R_ARM_PREL31 42
  52. 647a654,660
  53. > case R_ARM_NONE:
  54. > case R_ARM_PREL31:
  55. > case R_ARM_TARGET1:
  56. > case R_ARM_TARGET2:
  57. > case R_ARM_CALL:
  58. > case R_ARM_V4BX:
  59. > case R_ARM_JUMP24:
  60. EOF
  61.  
  62. (cvs -z3 -d:pserver:anonymous@cvs.uclinux.org:/var/cvs checkout -P elf2flt && patch elf2flt/elf2flt.c Ndless-elf2flt.patch && cd build && ../elf2flt/configure --target=$TARGET --prefix=$PREFIX -with-libbfd=../build-binutils/bfd/libbfd.a --with-libiberty=../build-binutils/libiberty/libiberty.a --with-bfd-include-dir=../build-binutils/bfd --with-binutils-include-dir=../$BINUTILS/include && make $PARALLEL && make install && cd .. && rm -rf build/*) || exit 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement