diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-03-28 15:56:15 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-03-28 15:56:15 +0000 |
commit | cf1d05fed16422010da6e196ca426bc04e490275 (patch) | |
tree | 494d6ff891cbd327e0379d4ab1aae35087424ae0 /simple-build-script | |
parent | 459fc4321ef066e00355f9a5af881bb35babb48b (diff) |
2010-03-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog, README, build_tools: New files.
Diffstat (limited to 'simple-build-script')
-rw-r--r-- | simple-build-script/ChangeLog | 4 | ||||
-rw-r--r-- | simple-build-script/README | 26 | ||||
-rw-r--r-- | simple-build-script/build_tools | 152 |
3 files changed, 182 insertions, 0 deletions
diff --git a/simple-build-script/ChangeLog b/simple-build-script/ChangeLog new file mode 100644 index 0000000..977563c --- /dev/null +++ b/simple-build-script/ChangeLog @@ -0,0 +1,4 @@ +2010-03-28 Joel Sherrill <joel.sherrill@oarcorp.com> + + * ChangeLog, README, build_tools: New files. + diff --git a/simple-build-script/README b/simple-build-script/README new file mode 100644 index 0000000..c26673a --- /dev/null +++ b/simple-build-script/README @@ -0,0 +1,26 @@ +# +# $Id$ +# + +This directory contains the build_tools script. This script is used to +build and install an RTEMS toolset from source. You are responsible for +downloading the various tools from either release images or their +development versions and patching as appropriate. + +To build the tools, simply invoke the following command with INSTALL_POINT +replaced with "prefix" in GNU tool terms: + +./build_tools INSTALL_POINT + +Depending on the target and the speed of the machine, this can take +anywhere from 30 minutes to a few hours. + +When completed, you should prepend INSTALL_POINT/bin to your PATH: + +export PATH=INSTALL_POINT/bin:$PATH + +Since you need the proper autoconf and automake versions to bootstrap +RTEMS from CVS, these are included in the build script. + +--Joel Sherrill (28 Match 2010) + diff --git a/simple-build-script/build_tools b/simple-build-script/build_tools new file mode 100644 index 0000000..fa91071 --- /dev/null +++ b/simple-build-script/build_tools @@ -0,0 +1,152 @@ +#! /bin/sh +# +# This script is a simple script to build and install rtems toolset +# for the target you specify by editing TARGET below. It should be +# of the form <CPU>-rtems<VERSION>. For example, sparc-rtems4.11 +# +# This can be used to build versions from CVS/SVN or released versions. +# Please be sure to apply appropriate patches from +# rtems/contrib/crossrpms/patches. +# +# --Joel Sherrill (28 Match 2010) +# +# $Id$ +# + +### EDIT THESE AS NEEDED +INSTALL=NOT_SET +TARGET=sparc-rtems4.10 +AUTOCONF=autoconf-2.65 +AUTOMAKE=automake-1.11.1 +BINUTILS=binutils-2.20.1 +GDB=gdb-7.1 +GCC=gcc-4.4.3 +NEWLIB=newlib-1.18.0 +LANGUAGES="c,c++" +### END OF EDIT THESE + +BASE=`pwd` + +# log an error to stderr +prerr() +{ + echo "$*" >&2 +} + +fatal() { + prerr "$USAGE" + [ "$1" ] && (prerr ; prerr $*); + exit 1 +} + +check_status() +{ + if [ $1 -ne 0 ] ; then + shift + echo "FAILED: " "$*" >&2 + exit 1 + fi +} + +test $# -eq 1 +check_status $? "Useage: $0 install_point" + +INSTALL=$1 + +### Validate arguments +if [ ! -d ${INSTALL} ] ; then + mkdir ${INSTALL} + check_status $? "failed to make ${INSTALL}" +fi + +test -d ${BINUTILS} +check_status $? "No ${BINUTILS} - You do not appear to be in src directory" + +test -d ${GCC} +check_status $? "No ${GCC} - You do not appear to be in src directory" + +test -d ${NEWLIB} +check_status $? "No ${NEWLIB} - You do not appear to be in src directory" + +test -d ${GDB} +check_status $? "No ${GDB} - You do not appear to be in src directory" + +if [ ! -d ${GCC}/newlib -o ! -d ${GCC}/libgloss ] ; then + echo "Please ensure that ${GCC}/newlib and ${GCC}/libgloss are symbolic" + echo "links into the newlib tree. Use commands simiilar to the following:" + echo "" + echo "ln -s ${BASE}/${NEWLIB}/newlib ${BASE}/${GCC}/newlib" + echo "ln -s ${BASE}/${NEWLIB}/libgloss ${BASE}/${GCC}/libgloss" + exit 1 +fi + +export PATH=${INSTALL}/bin:$PATH + +### Everything except GCC +for pkg in ${AUTOCONF} ${AUTOMAKE} ${BINUTILS} ${GDB} +do + mkdir b-${pkg} + check_status $? "failed to make b-${pkg}" + + cd b-${pkg} + check_status $? "failed to cd b-${pkg}" + + case pkg in + auto*) # autotools are native + ../${pkg}/configure --prefix=${INSTALL} >c.log 2>&1 + check_status $? "failed to configure ${pkg}" + ;; + binutils*) + ../${pkg}/configure --target=${TARGET} \ + --prefix=${INSTALL} >c.log 2>&1 + check_status $? "failed to configure ${pkg}" + ;; + gdb*) + ../${pkg}/configure --target=${TARGET} \ + --prefix=${INSTALL} \ + --enable-sim --enable-sim-hardware \ + --enable-timebase --enable-sim-trace + >c.log 2>&1 + check_status $? "failed to configure ${pkg}" + ;; + *) + prerr "UNKNOWN PACKAGE ${pkg}" + exit 1 + ;; + esac + + make >b.log 2>&1 + check_status $? "failed to make ${pkg}" + + make install >i.log 2>&1 + check_status $? "failed to install ${pkg}" + + cd .. + rm -rf b-${pkg} +done + +### GCC/NEWLIB +mkdir b-${GCC} +check_status $? "failed to make b-${GCC}" + +cd b-${GCC} +check_status $? "failed to cd b-${GCC}" + +../${GCC}/configure \ + --enable-threads=rtems --with-gnu-as --enable-multilib \ + --enable-newlib-mb --enable-newlib-iconv \ + --with-gnu-ld --with-newlib --verbose --with-system-zlib --disable-nls \ + --enable-version-specific-runtime-libs \ + --enable-languages=${LANGUAGES} --target=${TARGET} --prefix=${INSTALL} \ + >c.log 2>&1 + +make >b.log 2>&1 +check_status $? "failed to make ${GCC}/newlib" + +make install >i.log 2>&1 +check_status $? "failed to install ${GCC}/newlib" + +cd .. +rm -rf b-${GCC} + +exit 0 |