123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- #!/bin/sh
- # file: arm-none-eabi.sh
- #
- # This script downloads, compiles and installs an ARM toolchain for
- # building QCA PLC Hosted Applications;
- #
- # This script is my version of http://blog.tan-ce.com/gcc-bare-metal/
- # charles maier <cmaier@qca.qualcomm.com>
- #
- # ====================================================================
- # install packages;
- # --------------------------------------------------------------------
- apt-get install texinfo
- # ====================================================================
- # define folders
- # --------------------------------------------------------------------
- tmp=~
- opt=/opt
- pkg=arm-none-eabi
- # ====================================================================
- # define toolchain programs
- # --------------------------------------------------------------------
- GCC=gcc-4.7.1
- BIN=binutils-2.22
- GDB=gdb-7.4
- LIB=newlib-1.20.0
- # ====================================================================
- #
- # --------------------------------------------------------------------
- mkdir ${tmp}/${pkg} ${opt}/${pkg}
- cd ${tmp}/${pkg}
- mkdir src bld
- # ====================================================================
- # download tools;
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/src
- if [ ! -f ${GCC}.tar.bz2 ]; then
- wget ftp://ftp.gnu.org/gnu/gcc/${GCC}/${GCC}.tar.bz2
- fi
- if [ ! -f ${BIN}.tar.bz2 ]; then
- wget ftp://ftp.gnu.org/gnu/binutils/${BIN}.tar.bz2
- fi
- if [ ! -f ${GDB}.tar.bz2 ]; then
- wget ftp://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2
- fi
- if [ ! -f ${LIB}.tar.gz ]; then
- wget ftp://sources.redhat.com/pub/newlib/${LIB}.tar.gz
- fi
- # ====================================================================
- # unpack tools;
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/src
- if [ ! -d ${GCC} ]; then
- tar -xf ${GCC}.tar.bz2
- fi
- if [ ! -d ${BIN} ]; then
- tar -xf ${BIN}.tar.bz2
- fi
- if [ ! -d ${GDB} ]; then
- tar -xf ${GDB}.tar.bz2
- fi
- if [ ! -d ${LIB} ]; then
- tar -xf ${LIB}.tar.gz
- fi
- # ====================================================================
- # build binutils
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/bld
- mkdir ${BIN}
- cd ${BIN}
- ../../src/${BIN}/configure \
- --target=${pkg} \
- --prefix=${opt}/${pkg} \
- --enable-interwork \
- --enable-multilib
- make all install
- # ====================================================================
- # build gcc
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/bld
- mkdir ${GCC}
- cd ${GCC}
- ../../src/${GCC}/configure
- --target=${pkg} \
- --prefix=${opt}/${pkg} \
- --enable-interwork \
- --enable-multilib \
- --enable-languages="c,c++" \
- --with-newlib \
- --with-headers=../../src/${LIB}/newlib/libc/include \
- --with-system-zlib
- make all-gcc install-gcc
- # ====================================================================
- # build newlib
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/bld
- mkdir ${LIB}
- cd ${LIB}
- ../../src/${LIB}/configure \
- --target=${pkg} \
- --prefix=${opt}/${pkg} \
- --enable-interwork \
- --enable-multilib \
- --disable-newlib-supplied-syscalls
- make all install
- # ====================================================================
- # complete gcc build
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/bld/${GCC}
- make all install
- # ====================================================================
- # build gdb
- # --------------------------------------------------------------------
- cd ${tmp}/${pkg}/bld
- mkdir ${GDB}
- cd ${GDB}
- ../../src/${GDB}/configure \
- --target=${pkg} \
- --prefix=${opt}/${pkg} \
- --enable-interwork \
- --enable-multilib
- make all install
- # ====================================================================
- # export PATH
- # --------------------------------------------------------------------
- export PATH="$PATH:${opt}/${pkg}/bin"
|