X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/258a9f3899be3af24dc2bd40c617e395cedbeded..fd4f21b766a715303f0b1436c9970f5965e644dc:/tools/install-gnuarm4.sh diff --git a/tools/install-gnuarm4.sh b/tools/install-gnuarm4.sh index 68ebde72..793bdbf5 100755 --- a/tools/install-gnuarm4.sh +++ b/tools/install-gnuarm4.sh @@ -1,13 +1,13 @@ #!/bin/bash # Some things for you to configure -BINUTILS_VER="2.19.1" +BINUTILS_VER="2.19.1a" GCC_VER="4.3.3" -GDB_VER="6.8" +GDB_VER="6.8a" NEWLIB_VER="1.17.0" GMP_VER="4.2.4" -MPFR_VER="2.4.1" -INSIGHT_VER="6.8" +MPFR_VER="2.4.2" +INSIGHT_VER="6.8a" # Where you want to install the tools if [ "${1}" = "" ]; then @@ -29,18 +29,28 @@ BUILDDIR=${SRCDIR}/build-gnuarm4 # Where to get each of the toolchain components BINUTILS=http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.bz2 +BINUTILS_TAR=binutils-${BINUTILS_VER}.tar.bz2 GCCCORE=http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-core-${GCC_VER}.tar.bz2 +GCCCORE_TAR=gcc-core-${GCC_VER}.tar.bz2 GPP=http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-g++-${GCC_VER}.tar.bz2 +GPP_TAR=gcc-g++-${GCC_VER}.tar.bz2 NEWLIB=ftp://sources.redhat.com/pub/newlib/newlib-${NEWLIB_VER}.tar.gz +NEWLIB_TAR=newlib-${NEWLIB_VER}.tar.gz #INSIGHT=ftp://sourceware.org/pub/insight/releases/insight-${INSIGHT_VER}.tar.bz2 INSIGHT=http://mirrors.kernel.org/sources.redhat.com/insight/releases/insight-${INSIGHT_VER}.tar.bz2 +INSIGHT_TAR=insight-${INSIGHT_VER}.tar.bz2 #INSIGHT=http://www.mirrorservice.org/sites/sources.redhat.com/pub/insight/releases/insight-${INSIGHT_VER}.tar.bz2 -GDB=ftp://sourceware.org/pub/gdb/releases/gdb-${GDB_VER}.tar.bz2 +GDB=http://ftp.gnu.org/gnu/gdb/gdb-${GDB_VER}.tar.bz2 +GDB_TAR=gdb-${GDB_VER}.tar.bz2 GMP=http://ftp.sunet.se/pub/gnu/gmp/gmp-${GMP_VER}.tar.bz2 -MPFR=http://mpfr.loria.fr/mpfr-current/mpfr-${MPFR_VER}.tar.bz2 +GMP_TAR=gmp-${GMP_VER}.tar.bz2 +MPFR=http://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VER}.tar.bz2 +MPFR_TAR=mpfr-${MPFR_VER}.tar.bz2 +GNU_KEYRING_GPG=gnu-keyring.gpg +GNU_KEYRING=ftp://ftp.gnu.org/gnu/${GNU_KEYRING_GPG} # Common configuration options (i.e., things to pass to 'configure') -COMMON_CFG="--enable-interwork --target=arm-elf --program-prefix=arm-elf- --prefix=${DESTDIR} --disable-werror --enable-languages=c,c++ --enable-multilib --disable-shared" +COMMON_CFG="--enable-interwork --target=arm-eabi --program-prefix=arm-none-eabi- --prefix=${DESTDIR} --disable-werror --enable-languages=c,c++ --enable-multilib --disable-shared" # Extra configuration options for each toolchain component BINUTILS_CFG= @@ -64,11 +74,14 @@ WGET_OPTS="-c -t 0" # Compiler flags for compiling Newlib (-O2 is already hard-coded) NEWLIB_FLAGS="-march=armv4t -mcpu=arm7tdmi -g" +# GPG options to avoid polluting the user's keyring +GPG_OPTS="--keyring ${GNU_KEYRING_GPG} --no-default-keyring --homedir ." + ############################################################################ # End of configuration section. You shouldn't have to modify anything below. ############################################################################ -if [[ `whoami` != "root" ]]; then +if [[ "$USER" != "root" ]]; then echo "*** Warning! Not running as root!" echo "Installation may fail if you do not have appropriate permissions!" fi @@ -79,31 +92,47 @@ cd ${SRCDIR} if [[ -f all.downloaded ]]; then echo Looks like all downloads are complete, skipping downloads else - echo Now downloading BINUTILS... - wget ${WGET_OPTS} ${BINUTILS} - - echo Now downloading GCC... - wget ${WGET_OPTS} ${GCCCORE} - - echo Now downloading G++... - wget ${WGET_OPTS} ${GPP} - - echo Now downloading NEWLIB... - wget ${WGET_OPTS} ${NEWLIB} - - echo Now downloading INSIGHT... - wget ${WGET_OPTS} ${INSIGHT} - - echo Now downloading GDB... - wget ${WGET_OPTS} ${GDB} - - echo Now downloading GMP... - wget ${WGET_OPTS} ${GMP} - - echo Now downloading MPFR... - wget ${WGET_OPTS} ${MPFR} - - touch all.downloaded + wget ${WGET_OPTS} ${GNU_KEYRING} + + # TODO: guess it's better to have a function that "downloads, checks file-presence and signature, and returns true/false" whether the file is ok + # Function will check if file exists (otherwise try to download the file - if failed and file still doesn't exist, complain and exit the script) + # Check if signature file exists (otherwise download the signature file as well - if download fail, warn the user and return function) + # Check the signature. If failed, backup-by-renaming current files, redownload both file & signature, run the function body one more time - if still no success, warn and return from function + + function download_lib { + echo Now downloading $1 + wget ${WGET_OPTS} $2 + } + + function download_signed_lib { + download_lib $1 $2 + wget -N ${WGET_OPTS} $2.sig + gpg $GPG_OPTS --verify $3.sig 2> /dev/null + if [[ $? != 0 ]]; then + echo "Failed signature check for:" $3.sig + exit 1 + fi + } + + # NOTE: If new downloads are added here, please see the IMPORTANT note below + download_signed_lib BINUTILS ${BINUTILS} ${BINUTILS_TAR} || exit 1 + download_signed_lib GCC ${GCCCORE} ${GCCCORE_TAR} || exit 1 + download_signed_lib G++ ${GPP} ${GPP_TAR} || exit 1 + download_lib NEWLIB ${NEWLIB} + # TODO: signature/hash check + download_lib INSIGHT ${INSIGHT} + # TODO: signature/hash check + download_signed_lib GDB ${GDB} ${GDB_TAR} || exit 1 + download_signed_lib GMP ${GMP} ${GMP_TAR} || exit 1 + download_signed_lib MPFR ${MPFR} ${MPFR_TAR} || exit 1 + + # IMPORTANT: Here is the number of .tar. archives downloaded above. Please update if new .tar. are added to download list. + if [[ `ls -1 *.tar.bz2 *.tar.gz | wc -l` != 8 ]]; then + echo "Seems like not all prerequisite files downloaded... Exiting." + exit 1 + else + touch all.downloaded + fi fi cd ${BUILDDIR} @@ -244,5 +273,5 @@ chmod -R a+rX . echo Downloaded archives are in ${SRCDIR} echo build driectory: ${BUILDDIR} -echo set environment variable ARMLIB to ${DESTDIR}/lib/gcc/arm-elf/4.3.3/interwork for Makefile.linux +echo set environment variable ARMLIB to ${DESTDIR}/lib/gcc/arm-eabi/4.3.3/interwork for Makefile.linux exit 0