#!/bin/bash # # This script if used as part of ATS needs to be invoked with # argument 'ats'. All build directories will be removed. # # W/o any argument this script can be used to # install the openrisc uclinux toolchain. It should automatically # checkout all the sources, automatically build all the tools and # install them. If you modify the sources, you can't commit back # to CVS because sources are checked out as anonymous. Build # directories are not removed. # # # Some common variables # if [ "$1" == "ats" ]; then OR1K_WEB=../../www/cores/or1k/ats/or32-uclinux OR1K_WEB_LAST=$OR1K_WEB/last_ok INSTALL_PREFIX=/home/oc/testpool/or1k/or32-uclinux export PATH=$PATH:/usr/local/bin else OR1K_WEB=. OR1K_WEB_LAST=$OR1K_WEB/last_ok INSTALL_PREFIX=/opt/or32-uclinux fi OK_STR="Test Passed" FAIL_STR="Test Failed" ALL_STABLE=1 # # Allocate test pool directory # mkdir or1k cd or1k # # Copy script for web visitors' reference # cp ../or1k_ats_uclinux.sh $OR1K_WEB/or1k_ats_uclinux.txt # # Start with binutils # date > checkout_binutils.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d binutils or1k/binutils >> checkout_binutils.txt 2>&1 mkdir b-b cd b-b date > ../build_binutils.txt 2>&1 uname -a >> ../build_binutils.txt 2>&1 ../binutils/configure --target=or32-uclinux --prefix=$INSTALL_PREFIX >> ../build_binutils.txt 2>&1 nice /usr/bin/make all install >> ../build_binutils.txt 2>&1 BUILD_BINUTILS_STATUS=$? export PATH=$INSTALL_PREFIX/bin:$PATH cd .. if [ "$1" == "ats" ]; then rm -rf binutils fi # # Copy all log files into or1k web directory # cp checkout_binutils.txt $OR1K_WEB cp build_binutils.txt $OR1K_WEB # # Check if binutils was built and installed correctly # if [ $BUILD_BINUTILS_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_binutils.status cp $OR1K_WEB/build_binutils.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_binutils.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_binutils.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/binutils $OR1K_WEB_LAST/build_binutils.status < build_binutils.txt echo "$FAIL_STR (`date`)" > $OR1K_WEB/build_binutils.status ALL_STABLE=0 fi # # Start with gcc # date > checkout_gcc.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d gcc or1k/gcc-3.2.3 >> checkout_gcc.txt 2>&1 mkdir b-gcc cd b-gcc date > ../build_gcc.txt 2>&1 uname -a >> ../build_gcc.txt 2>&1 nice ../gcc/configure --target=or32-uclinux \ --with-gnu-as --with-gnu-ld --verbose \ --enable-threads --prefix=$INSTALL_PREFIX \ --local-prefix=$INSTALL_PREFIX/or32-uclinux --enable-languages="c" >> ../build_gcc.txt 2>&1 nice /usr/bin/make all install >> ../build_gcc.txt 2>&1 BUILD_GCC_STATUS=$? cd .. # # Copy all log files into or1k web directory # cp checkout_gcc.txt $OR1K_WEB cp build_gcc.txt $OR1K_WEB # # Check if gcc was built and installed correctly # if [ $BUILD_GCC_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_gcc.status cp $OR1K_WEB/build_gcc.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_gcc.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_gcc.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/gcc-3.2.3 $OR1K_WEB_LAST/build_gcc.status < build_gcc.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/build_gcc.status ALL_STABLE=0 fi # # Start with gdb # date > checkout_gdb.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d gdb or1k/gdb-5.0 >> checkout_gdb.txt 2>&1 mkdir b-gdb cd b-gdb date > ../build_gdb.txt 2>&1 uname -a >> ../build_gdb.txt 2>&1 ../gdb/configure --target=or32-uclinux --prefix=$INSTALL_PREFIX >> ../build_gdb.txt 2>&1 nice /usr/bin/make all install >> ../build_gdb.txt 2>&1 BUILD_GDB_STATUS=$? cd .. if [ "$1" == "ats" ]; then rm -rf gdb fi # # Copy all log files into or1k web directory # cp checkout_gdb.txt $OR1K_WEB cp build_gdb.txt $OR1K_WEB # # Check if gdb was built and installed correctly # echo $BUILD_GDB_STATUS if [ $BUILD_GDB_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_gdb.status cp $OR1K_WEB/build_gdb.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_gdb.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_gdb.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/gdb-5.0 $OR1K_WEB_LAST/build_gdb.status < build_gdb.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/build_gdb.status ALL_STABLE=0 fi # # Start with or1ksim # date > checkout_or1ksim.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d or1ksim or1k/or1ksim >> checkout_or1ksim.txt 2>&1 cd or1ksim date > ../build_or1ksim.txt 2>&1 uname -a >> ../build_or1ksim.txt 2>&1 ../or1ksim/configure --target=or32-uclinux --prefix=$INSTALL_PREFIX >> ../build_or1ksim.txt 2>&1 nice /usr/bin/make all install >> ../build_or1ksim.txt 2>&1 BUILD_OR1KSIM_STATUS=$? cd .. # # Copy all log files into or1k web directory # cp checkout_or1ksim.txt $OR1K_WEB cp build_or1ksim.txt $OR1K_WEB # # Check if or1ksim was built and installed correctly # if [ $BUILD_OR1KSIM_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_or1ksim.status cp $OR1K_WEB/build_or1ksim.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_or1ksim.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_or1ksim.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/or1ksim $OR1K_WEB_LAST/build_or1ksim.status < build_or1ksim.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/build_or1ksim.status ALL_STABLE=0 fi # # Start with uclinux # date > checkout_uclinux.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d uClinux-2.0.x \ or1k/uclinux/uClinux-2.0.x >> checkout_uclinux.txt 2>&1 mkdir uclinux mv uClinux-2.0.x uclinux cd uclinux/uClinux-2.0.x sed -e 's/^LIBGCC/#LIBGCC/; /^#LIBGCC/ a \ LIBGCC = '$INSTALL_PREFIX'\/lib\/gcc-lib\/or32-uclinux\/3.2.3\/libgcc.a' \ < arch/or32/Rules.make > arch/or32/Rules.make.edited mv arch/or32/Rules.make.edited arch/or32/Rules.make sed -e 's/^CONFIG_NET/#CONFIG_NET/; /^#CONFIG_NET/ a \ CONFIG_NET=n' < arch/or32/defconfig > arch/or32/defconfig.edited mv arch/or32/defconfig.edited arch/or32/defconfig nice make oldconfig >> ../../build_uclinux.txt 2>&1 nice make dep >> ../../build_uclinux.txt 2>&1 nice /usr/bin/make all >> ../../build_uclinux.txt 2>&1 BUILD_UCLINUX_STATUS=$? touch uart0.rx echo -e "run 40000000 hush\nq" | or32-uclinux-sim -f sim.cfg linux -i > /dev/null cp uart0.tx ../../or1ksim_uclinux.txt cd ../../ # # Copy all log files into or1k web directory # cp checkout_uclinux.txt $OR1K_WEB cp build_uclinux.txt $OR1K_WEB cp or1ksim_uclinux.txt $OR1K_WEB # # Check if uclinux was built and installed correctly # if [ $BUILD_UCLINUX_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_uclinux.status cp $OR1K_WEB/build_uclinux.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_uclinux.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_uclinux.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/uclinux $OR1K_WEB_LAST/build_uclinux.status < build_uclinux.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/build_uclinux.status ALL_STABLE=0 fi if [ `grep Executing or1ksim_uclinux.txt | wc -l` -gt 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/or1ksim_uclinux.status cp $OR1K_WEB/or1ksim_uclinux.status $OR1K_WEB_LAST cp $OR1K_WEB/or1ksim_uclinux.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/uclinux $OR1K_WEB_LAST/or1ksim_uclinux.status < or1ksim_uclinux.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/or1ksim_uclinux.status ALL_STABLE=0 fi # # Start with uclibc # date > checkout_uclibc.txt 2>&1 nice cvs -d :pserver:cvs@cvs.opencores.org:/home/oc/cvs -z9 co -d uclibc \ or1k/uclibc >> checkout_uclibc.txt 2>&1 cd uclibc date > ../build_uclibc.txt 2>&1 uname -a >> ../build_uclibc.txt 2>&1 ln -s ./extra/Configs/Config.cross.or32.uclinux Config sed -e 's/^KERNEL_SOURCE/#KERNEL_SOURCE/; /^#KERNEL_SOURCE/ a \ KERNEL_SOURCE = '`pwd`'\/..\/uclinux\/uClinux-2.0.x' < Config > Config.edited sed -e 's/^DEVEL_PREFIX/#DEVEL_PREFIX/; /^#DEVEL_PREFIX/ a \ DEVEL_PREFIX = '$INSTALL_PREFIX < Config.edited > Config rm Config.edited nice /usr/bin/make all install >> ../build_uclibc.txt 2>&1 BUILD_UCLIBC_STATUS=$? pushd . cd $INSTALL_PREFIX/bin rm -f ar as cc cpp gasp gcc ld nm objcopy objdump ranlib size strings strip jar grepjar popd cd ../b-gcc date > ../rebuild_gcc.txt 2>&1 uname -a >> ../rebuild_gcc.txt 2>&1 nice ../gcc/configure --target=or32-uclinux \ --with-gnu-as --with-gnu-ld --verbose \ --enable-threads --prefix=$INSTALL_PREFIX \ --local-prefix=$INSTALL_PREFIX/or32-uclinux --enable-languages="c" >> ../rebuild_gcc.txt 2>&1 nice make all install >> ../rebuild_gcc.txt 2>&1 REBUILD_GCC_STATUS=$? cd .. # # Check or1ksim testbench # cd or1ksim/testbench date > ../../or1ksim_testbench.txt 2>&1 CFLAGS="-nostdlib" ./configure --target=or32-uclinux --host=or32-uclinux >> ../../or1ksim_testbench.txt 2>&1 export PATH=$PATH:.. make check >> ../../or1ksim_testbench.txt 2>&1 cd ../.. # # Copy all log files into or1k web directory # cp or1ksim_testbench.txt $OR1K_WEB # # Check if or1ksim testbench passed OK # if [ `grep passed or1ksim_testbench.txt | wc -l` -gt 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/or1ksim_testbench.status cp $OR1K_WEB/or1ksim_testbench.status $OR1K_WEB_LAST cp $OR1K_WEB/or1ksim_testbench.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/or1ksim/testbench $OR1K_WEB_LAST/or1ksim_testbench.status < or1ksim_testbench.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/or1ksim_testbench.status ALL_STABLE=0 fi if [ "$1" == "ats" ]; then rm -rf uclibc uclinux gcc or1ksim fi # # Copy all log files into or1k web directory # cp checkout_uclibc.txt $OR1K_WEB cp build_uclibc.txt $OR1K_WEB cp rebuild_gcc.txt $OR1K_WEB # # Check if uclibc was built and installed correctly # if [ $BUILD_UCLIBC_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/build_uclibc.status cp $OR1K_WEB/build_uclibc.status $OR1K_WEB_LAST cp $OR1K_WEB/checkout_uclibc.txt $OR1K_WEB_LAST cp $OR1K_WEB/build_uclibc.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/uclibc $OR1K_WEB_LAST/build_uclibc.status < build_uclibc.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/build_uclibc.status ALL_STABLE=0 fi if [ $REBUILD_GCC_STATUS = 0 ]; then echo "$OK_STR (`date`)" > $OR1K_WEB/rebuild_gcc.status cp $OR1K_WEB/rebuild_gcc.status $OR1K_WEB_LAST cp $OR1K_WEB/rebuild_gcc.txt $OR1K_WEB_LAST else ../notice_developers.sh or1k/gcc-3.2.3 $OR1K_WEB_LAST/rebuild_gcc.status < rebuild_gcc.txt echo "$FAIL_STR (`date`)"> $OR1K_WEB/rebuild_gcc.status ALL_STABLE-0 fi # # rtag sources as ats-stable if everything worked # cd .. if [ "$1" == "ats" ]; then if [ $ALL_STABLE = 1 ]; then nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/binutils > /dev/null 2>&1 nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/gcc-3.2.3 > /dev/null 2>&1 nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/gdb-5.0 > /dev/null 2>&1 nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/or1ksim > /dev/null 2>&1 nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/uclinux > /dev/null 2>&1 nice cvs -d :pserver:ats@cvs.opencores.org:/home/oc/cvs -z9 rtag -FR ats-stable or1k/uclibc > /dev/null 2>&1 fi fi # # Clean testpool # if [ "$1" == "ats" ]; then rm -rf or1k fi