diff options
author | Robert Schwebel <r.schwebel@pengutronix.de> | 2006-08-29 11:37:11 +0000 |
---|---|---|
committer | Robert Schwebel <r.schwebel@pengutronix.de> | 2006-08-29 11:37:11 +0000 |
commit | b4530153ff35ce82fdf10d0d7fbae7700047c2fe (patch) | |
tree | d0f084f8c062311eb242f6a22a26de1f415ab913 /EXTERNAL/mk-arm-soft | |
parent | a09127b31e4a718afef553b7aff77ab6a20cdfe2 (diff) | |
download | OSELAS.Toolchain-b4530153ff35ce82fdf10d0d7fbae7700047c2fe.tar.gz OSELAS.Toolchain-b4530153ff35ce82fdf10d0d7fbae7700047c2fe.tar.xz |
git-svn-id: https://svn.pengutronix.de/svn/oselas/toolchain/trunks/OSELAS.Toolchain-trunk@769 f8d472c7-5700-0410-ac5a-87979cec3adf
Diffstat (limited to 'EXTERNAL/mk-arm-soft')
-rw-r--r-- | EXTERNAL/mk-arm-soft | 277 |
1 files changed, 277 insertions, 0 deletions
diff --git a/EXTERNAL/mk-arm-soft b/EXTERNAL/mk-arm-soft new file mode 100644 index 0000000..e4992de --- /dev/null +++ b/EXTERNAL/mk-arm-soft @@ -0,0 +1,277 @@ +#! /bin/sh + +INSTDIR=/opt/cross/arm-unknown +ARCH=arm +TARGET=arm-unknown-linux-gnu +HOST=i686-pc-linux-gnu + +SYSROOT=$INSTDIR/sys-root-soft +HEADERDIR=$SYSROOT/usr/include +BINDIR=linuxthreads-soft + +SYSROOTNPTL=$INSTDIR/sys-root-nptl-soft +HEADERDIRNPTL=$SYSROOTNPTL/usr/include +BINDIRNPTL=nptl-soft + +ORIGPATH=$PATH + +cleanup() { + # cleanup + sudo rm -rf ep-soft-* + sudo rm -rf $SYSROOT + sudo rm -rf $SYSROOTNPTL + sudo rm -rf $BINDIR + sudo rm -rf $BINDIRNPTL +} + +create_sys_root() { + # create sys-root + mkdir -p $SYSROOT/lib + mkdir -p $SYSROOT/usr/lib + mkdir -p $HEADERDIR +} + +create_sys_root_nptl() { + # create sys-root-nptl + mkdir -p $SYSROOTNPTL/lib + mkdir -p $SYSROOTNPTL/usr/lib + mkdir -p $HEADERDIRNPTL +} + +prepare_kernel() { + # prepare kernel + pushd linux + make distclean + make ARCH=$ARCH edb7211_defconfig + make ARCH=$ARCH include/asm include/linux/version.h include/asm-$ARCH/.arch + + cp -r include/linux $HEADERDIR + cp -r include/asm-${ARCH} $HEADERDIR/asm + cp -r include/asm-generic $HEADERDIR/asm-generic + + cp -r include/linux $HEADERDIRNPTL + cp -r include/asm-${ARCH} $HEADERDIRNPTL/asm + cp -r include/asm-generic $HEADERDIRNPTL/asm-generic + + popd +} + +build_binutils() { + # build binutils + mkdir -p ep-soft-binutils + + pushd ep-soft-binutils + ../binutils/configure --target=$TARGET --host=$HOST --with-sysroot=$SYSROOT \ + --prefix=$INSTDIR/$BINDIR + make + sudo make install + + ../binutils/configure --target=$TARGET --host=$HOST \ + --with-sysroot=$SYSROOTNPTL --prefix=$INSTDIR/$BINDIRNPTL + make + sudo make install + + popd +} + +glibc_header() { + # glibc-header + mkdir -p ep-soft-glibc-header + + pushd ep-soft-glibc-header + libc_cv_ppc_machine=yes ../libc/configure --prefix=/usr \ + --build=$HOST --host=$TARGET --without-cvs \ + --disable-sanity-checks --with-headers=$HEADERDIR \ + --enable-hacker-mode + + libc_cv_ppc_machine=yes make sysdeps/gnu/errlist.c + mkdir -p stdio-common + touch stdio-common/errlist-compat.c + + libc_cv_ppc_machine=yes make cross-compiling=yes install_root=$SYSROOT \ + install-headers + mkdir -p $HEADERDIR/gnu + touch $HEADERDIR/gnu/stubs.h + cp ../libc/include/features.h $HEADERDIR/features.h + cp bits/stdio_lim.h $HEADERDIR/bits/stdio_lim.h + + libc_cv_ppc_machine=yes make cross-compiling=yes install_root=$SYSROOTNPTL \ + install-headers + mkdir -p $HEADERDIRNPTL/gnu + touch $HEADERDIRNPTL/gnu/stubs.h + cp ../libc/include/features.h $HEADERDIRNPTL/features.h + cp bits/stdio_lim.h $HEADERDIRNPTL/bits/stdio_lim.h + + popd +} + +build_gcc_core() { + # build gcc-core + export PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH + mkdir -p ep-soft-gcc-core + + pushd ep-soft-gcc-core + ../gcc-arm/configure --target=$TARGET --host=$HOST \ + --with-local-prefix=$SYSROOT --disable-multilib --with-newlib \ + --with-sysroot=$SYSROOT --enable-threads=no --with-softfloat-supp \ + --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c \ + --disable-shared --prefix=$INSTDIR/$BINDIR --with-float=soft + make all-gcc + sudo make PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH install-gcc + popd +} + +build_glibc_linuxthreads() { + # build glibc/linuxthreads + export PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH + + mkdir -p ep-soft-glibc + sudo touch $INSTDIR/$BINDIR/lib/gcc/arm-unknown-linux-gnu/3.4.3/libgcc_s.a + + pushd ep-soft-glibc + #BUILD_CC=gcc CFLAGS="-O2 -funroll-loops -mcpu=ep9312 -mfpu=maverick" \ + BUILD_CC=gcc CFLAGS="-O2 -funroll-loops" \ + CC=$TARGET-gcc AR=$TARGET-ar RANLIB=$TARGET-ranlib \ + ../libc/configure --prefix=/usr \ + --build=$HOST --host=$TARGET \ + --enable-kernel=2.4.3 --without-cvs --disable-profile \ + --disable-debug --without-gd --without-tls --without-__thread \ + --enable-shared --enable-add-ons=linuxthreads --enable-omitfp \ + --without-fp --with-headers=$HEADERDIR + make LD=$TARGET-ld RANLIB=$TARGET-ranlib lib + make install_root=$SYSROOT install-lib-all install-headers + popd + + sudo rm $INSTDIR/$BINDIR/lib/gcc/arm-unknown-linux-gnu/3.4.3/libgcc_s.a +} + +build_final_gcc() { + # build final gcc + export PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH + + mkdir -p ep-soft-gcc + pushd ep-soft-gcc + ac_cv_lib_m_main=yes ../gcc-arm/configure --target=$TARGET --host=$HOST \ + --with-local-prefix=$SYSROOT --with-sysroot=$SYSROOT \ + --enable-threads=posix --enable-symvers=gnu \ + --enable-__cxa_atexit --enable-languages="c,c++" \ + --enable-shared --enable-c99 --enable-long-long \ + --prefix=$INSTDIR/$BINDIR --with-float=soft \ + --enable-multilib --with-softfloat-supp + make all + sudo make PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH install + popd +} + +build_glibc_NPTL() { + # build glibc-NPTL + export PATH=$INSTDIR/$BINDIR/bin:$ORIGPATH + + mkdir -p ep-soft-glibc-nptl + pushd ep-soft-glibc-nptl + #BUILD_CC=gcc CFLAGS="-O2 -funroll-loops -mcpu=ep9312 -mfpu=maverick" -mtp=linux" \ + BUILD_CC=gcc CFLAGS="-O2 -funroll-loops -mtp=soft" \ + CC=$TARGET-gcc AR=$TARGET-ar RANLIB=$TARGET-ranlib \ + ../libc/configure --prefix=/usr \ + --build=$HOST --host=$TARGET \ + --enable-kernel=2.4.3 --without-cvs --disable-profile \ + --enable-debug --without-gd --with-tls --with-__thread \ + --enable-shared --enable-add-ons=nptl --enable-profile \ + --without-fp --with-headers=$HEADERDIRNPTL + make LD=$TARGET-ld RANLIB=$TARGET-ranlib lib + make install_root=$SYSROOTNPTL install-lib-all install-headers + popd +} + +build_final_nptl_gcc() { + # build final nptl gcc + export PATH=$INSTDIR/$BINDIRNPTL/bin:$ORIGPATH + mkdir -p ep-soft-gcc-nptl + + pushd ep-soft-gcc-nptl + ac_cv_lib_m_main=yes ../gcc-arm/configure --target=$TARGET --host=$HOST \ + --with-local-prefix=$SYSROOTNPTL --with-sysroot=$SYSROOTNPTL \ + --enable-threads=posix --enable-symvers=gnu \ + --enable-__cxa_atexit --enable-languages="c,c++" \ + --enable-shared --enable-c99 --enable-long-long \ + --prefix=$INSTDIR/$BINDIRNPTL --with-float=soft --with-softfloat-supp \ + # --enable-cxx-flags='-mcpu=ep9312 -mfpu=maverick' + make all + sudo make PATH=$INSTDIR/$BINDIRNPTL/bin:$ORIGPATH install + popd +} + +build_gdb() { + # build gdb + pushd ep-soft-binutils + + mkdir readline + cd readline + ../../binutils-complete/readline/configure --target=$TARGET --host=$HOST + make + cd .. + mkdir gdb + cd gdb + ../../binutils-complete/gdb/configure --target=$TARGET --host=$HOST \ + --with-sysroot=$SYSROOT --prefix=$INSTDIR/$BINDIR \ + --enable-tui --disable-gdbtk + make + sudo make install + + ../../binutils-complete/gdb/configure --target=$TARGET --host=$HOST \ + --with-sysroot=$SYSROOTNPTL --prefix=$INSTDIR/$BINDIRNPTL \ + --enable-tui --disable-gdbtk + make + sudo make install + + cd .. + popd +} + +err() { + echo Failed to build $1 + exec false +} + +keystroke() { +# read -n1 -p "$@ [key to continue]" + echo "*** $@ ***" +} + +### MAIN ### + +keystroke "cleanup" +cleanup + +keystroke "create sys_root" +create_sys_root + +keystroke "create sys_root_nptl" +create_sys_root_nptl + +keystroke "prepare kernel" +prepare_kernel + +keystroke "binutils" +build_binutils + +keystroke "glibc header" +glibc_header + +keystroke "gcc core" +build_gcc_core + +keystroke "glibc linuxthreads" +build_glibc_linuxthreads + +keystroke "final gcc linuxthreads" +build_final_gcc + +keystroke "glibc nptl" +build_glibc_NPTL + +keystroke "final gcc nptl" +build_final_nptl_gcc + +keystroke "gdb" +build_gdb |