Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Source: http://forum.chdk-treff.de/viewtopic.php?t=1829&postdays=0&postorder=asc&highlight=compilieren+linux&start=45
- #!/bin/sh
- # Builds a arm-elf cross compiler for use on linux
- # host systems. This target has no file system or kernel.
- #
- TARGET="arm-elf"
- BUILDDIR=`pwd`
- BUILDDIR="${BUILDDIR}/build-dir"
- mkdir ${BUILDDIR}
- SRC="${BUILDDIR}/packages" # package directory
- PREFIX="${BUILDDIR}/arm/toolchain" # final toolchain directory
- PARALLEL="-j 4"
- BINUTILS=binutils-2.18
- GCC=gcc-4.5.2
- GMP=gmp-5.0.1
- MPFR=mpfr-3.0.0
- MPC=mpc-0.8.2
- NEWLIB=newlib-1.18.0
- export PATH="$PATH:$PREFIX/bin"
- # Before we do anything we need all the source files.
- # We keep them in one place and we never need to
- # download them twice if this build fails.
- mkdir $SRC
- cd $SRC
- echo "Dounloading source packages. This may take a while."
- echo
- wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
- wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2
- wget -c ftp://ftp.gmplib.org/pub/$GMP/$GMP.tar.bz2
- wget -c http://www.mpfr.org/mpfr-current/$MPFR.tar.bz2
- wget -c http://www.multiprecision.org/mpc/download/$MPC.tar.gz
- wget -c ftp://sources.redhat.com/pub/newlib/$NEWLIB.tar.gz
- cd ..
- echo "Starting Build..."
- echo
- mkdir build
- echo "Building binutils"
- echo
- tar xfj $SRC/$BINUTILS.tar.bz2
- cd $BINUTILS
- ./configure --target=$TARGET --prefix=$PREFIX --disable-werror
- # --enable-interwork --disable-multilib --with-gnu-as
- # --with-gnu-ld --disable-nls --disable-werror
- make $PARALLEL
- make install
- cd ..
- rm -rf build/* $BINUTILS
- echo "Building GCC pass 1"
- tar xfj $SRC/$GCC.tar.bz2
- # the compiler math prereqs
- tar -jxf $SRC/$GMP.tar.bz2
- tar -jxf $SRC/$MPFR.tar.bz2
- tar -zxf $SRC/$MPC.tar.gz
- cd $GCC
- mv ../$GMP gmp
- mv ../$MPFR mpfr
- mv ../$MPC mpc
- echo ""
- cd ../build
- #
- echo "ed ../$GCC/gcc/config/arm/t-arm-elf"
- ed ../$GCC/gcc/config/arm/t-arm-elf << EOF
- /MULTILIB_OPTIONS/s/^M/# M/
- /MULTILIB_DIRNAMES/s/^M/# M/
- /mno-thumb-interwork/s/^# //
- /normal interwork/s/^# //
- wq
- EOF
- #
- ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
- --enable-multilib --enable-languages="c" --with-newlib \
- --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
- --without-headers --disable-shared --disable-nls --with-gnu-as --with-gnu-ld
- make $PARALLEL all-gcc
- make install-gcc
- cd ..
- rm -rf build/* # (We retain the GCC directory for pass 2)
- echo "Building Newlib"
- echo
- tar xfz $SRC/$NEWLIB.tar.gz
- cd build
- ../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
- --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls
- make $PARALLEL
- make install
- cd ..
- rm -rf build/* $NEWLIB
- echo " Building GCC pass 2"
- echo
- cd build
- ../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork \
- --enable-multilib --enable-languages="c" --with-newlib \
- --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
- --without-headers --disable-libssp --disable-nls --disable-zlib --disable-libc --disable-libm --disable-intl \
- --disable-hardfloat --disable-threads --with-gnu-as --with-gnu-ld
- make $PARALLEL
- make install
- cd ..
- rm -rf build/* $GCC
- echo "Compiler Finished for "$TARGET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement