3 # Some things for you to configure
12 # Where you want to install the tools
13 if [ "${1}" = "" ]; then
14 echo "Syntax: ${0} </installation/target/directory> [download & build directory (default ${PWD})]"
20 # Where do you want to build the tools. This is where the log files
21 # will be written (which you can monitor with 'tail' during compilation).
22 # You can delete this directory after everything is done.
23 if [ ! "${2}" = "" ]; then
28 BUILDDIR
=${SRCDIR}/build-gnuarm4
30 # Where to get each of the toolchain components
31 BINUTILS
=ftp://gcc.gnu.org
/pub
/binutils
/releases
/binutils-
${BINUTILS_VER}.
tar.bz2
32 GCCCORE
=ftp://gcc.gnu.org
/pub
/gcc
/releases
/gcc-
${GCC_VER}/gcc-core-
${GCC_VER}.
tar.bz2
33 GPP
=ftp://gcc.gnu.org
/pub
/gcc
/releases
/gcc-
${GCC_VER}/gcc-g
++-${GCC_VER}.
tar.bz2
34 NEWLIB
=ftp://sources.redhat.com
/pub
/newlib
/newlib-
${NEWLIB_VER}.
tar.gz
35 #INSIGHT=ftp://sourceware.org/pub/insight/releases/insight-${INSIGHT_VER}.tar.bz2
36 INSIGHT
=http
://mirrors.kernel.org
/sources.redhat.com
/insight
/releases
/insight-
${INSIGHT_VER}.
tar.bz2
37 #INSIGHT=http://www.mirrorservice.org/sites/sources.redhat.com/pub/insight/releases/insight-${INSIGHT_VER}.tar.bz2
38 GDB
=ftp://sourceware.org
/pub
/gdb
/releases
/gdb-
${GDB_VER}.
tar.bz2
39 GMP
=http
://ftp.sunet.se
/pub
/gnu
/gmp
/gmp-
${GMP_VER}.
tar.bz2
40 MPFR
=http
://www.mpfr.org
/mpfr-current
/mpfr-
${MPFR_VER}.
tar.bz2
42 # Common configuration options (i.e., things to pass to 'configure')
43 COMMON_CFG
="--enable-interwork --target=arm-elf --program-prefix=arm-elf- --prefix=${DESTDIR} --disable-werror --enable-languages=c,c++ --enable-multilib --disable-shared"
45 # Extra configuration options for each toolchain component
47 GCCCORE_CFG
="--disable-nls --disable-threads --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 --with-newlib --with-headers=${BUILDDIR}/newlib-${NEWLIB_VER}/newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp -v"
56 # -nv: non-verbose but not too quiet (still print errors/warnings)
57 # -nc: no-clobber, do not download a file that already exists
58 # -t 0: retry indefinitely
59 # -a wget.log: append errors/warnings to wget.log file
61 #WGET_OPTS="-nv -nc -t 0 -a wget.log"
64 # Compiler flags for compiling Newlib (-O2 is already hard-coded)
65 NEWLIB_FLAGS
="-march=armv4t -mcpu=arm7tdmi -g"
67 ############################################################################
68 # End of configuration section. You shouldn't have to modify anything below.
69 ############################################################################
71 if [[ `whoami` != "root" ]]; then
72 echo "*** Warning! Not running as root!"
73 echo "Installation may fail if you do not have appropriate permissions!"
79 if [[ -f all.downloaded
]]; then
80 echo Looks like all downloads are complete
, skipping downloads
82 echo Now downloading BINUTILS...
83 wget
${WGET_OPTS} ${BINUTILS}
85 echo Now downloading GCC...
86 wget
${WGET_OPTS} ${GCCCORE}
88 echo Now downloading G
++...
89 wget
${WGET_OPTS} ${GPP}
91 echo Now downloading NEWLIB...
92 wget
${WGET_OPTS} ${NEWLIB}
94 echo Now downloading INSIGHT...
95 wget
${WGET_OPTS} ${INSIGHT}
97 echo Now downloading GDB...
98 wget
${WGET_OPTS} ${GDB}
100 echo Now downloading GMP...
101 wget
${WGET_OPTS} ${GMP}
103 echo Now downloading MPFR...
104 wget
${WGET_OPTS} ${MPFR}
110 if [[ -f binutils.built
]]; then
111 echo Looks like BINUTILS was already built.
113 echo Building BINUTILS...
114 tar -xjf ..
/`basename ${BINUTILS}`
115 echo ___________________
> make.log
116 echo Building binutils...
>> make.log
117 cd `find . -maxdepth 1 -type d -name 'binutils*'`
120 ..
/configure
${COMMON_CFG} ${BINUTILS_CFG} >> ..
/..
/make.log
2>&1
121 make ${MAKEFLAGS} MAKEINFO
=`which makeinfo` >> ..
/..
/make.log
2>&1
122 make install >> ..
/..
/make.log
2>&1
127 echo ___________________
>> make.log
128 echo Adding
${DESTDIR}/bin to PATH
>> make.log
129 export PATH
; PATH
=${DESTDIR}/bin
:$PATH
130 echo ___________________
>> make.log
132 if [[ -f gcc.built
]]; then
133 echo Looks like GCC was already built.
136 tar -xjf ..
/`basename ${GCCCORE}`
137 tar -xjf ..
/`basename ${GPP}`
138 tar -xjf ..
/`basename ${GMP}`
139 ln -s "${BUILDDIR}/gmp-${GMP_VER}" "${BUILDDIR}/gcc-${GCC_VER}/gmp"
140 tar -xjf ..
/`basename ${MPFR}`
141 ln -s "${BUILDDIR}/mpfr-${MPFR_VER}" "${BUILDDIR}/gcc-${GCC_VER}/mpfr"
142 tar -xzf ..
/`basename ${NEWLIB}`
144 echo ___________________
>> make.log
146 cat << EOF > gcc.patch
147 --- gcc-4.3.3.orig/gcc/config/arm/t-arm-elf
148 +++ gcc-4.3.3.mod/gcc/config/arm/t-arm-elf
150 # MULTILIB_DIRNAMES += fpu soft
151 # MULTILIB_EXCEPTIONS += *mthumb/*mhard-float*
153 -# MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
154 -# MULTILIB_DIRNAMES += normal interwork
155 +MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
156 +MULTILIB_DIRNAMES += normal interwork
158 # MULTILIB_OPTIONS += fno-leading-underscore/fleading-underscore
159 # MULTILIB_DIRNAMES += elf under
162 echo Patching GCC
>> make.log
163 cd `find . -maxdepth 1 -type d -name 'gcc*'`
164 patch -p1 < ..
/gcc.
patch
165 echo Building gcc...
>> make.log
168 ..
/configure
${COMMON_CFG} ${GCCCORE_CFG} >> ..
/..
/make.log
2>&1
169 make ${MAKEFLAGS} all-gcc
>> ..
/..
/make.log
2>&1
170 make install >> ..
/..
/make.log
2>&1
175 if [[ -f newlib.built
]]; then
176 echo Looks like NEWLIB was already built.
178 echo Building NEWLIB...
179 echo ___________________
>> make.log
180 echo Building newlib...
>> make.log
181 cd `find . -maxdepth 1 -type d -name 'newlib*'`
184 ..
/configure
${COMMON_CFG} ${NEWLIB_CFG} >> ..
/..
/make.log
2>&1
186 # This line adds our NEWLIB_CFLAGS to the configure.host file in the
187 # newlib subdirectory. This is the only way I could find to tell Newlib to
188 # compile itself with the -mmarch=armv4t and -mcpu=arm7tdmi flags.
189 # sed -i "/^newlib_cflags=/s/=.*\$/=\"${NEWLIB_FLAGS}\"/" ../newlib/configure.host
190 make ${MAKEFLAGS} >> ..
/..
/make.log
2>&1
191 make install >> ..
/..
/make.log
2>&1
196 echo ___________________
>> make.log
197 echo "Now that newlib is built, second pass for GCC..." >> make.log
198 cd `find . -maxdepth 1 -type d -name 'gcc*'`
200 make ${MAKEFLAGS} >> ..
/..
/make.log
2>&1
201 make install >> ..
/..
/make.log
2>&1
205 if [[ -f insight.built
]]; then
206 echo Looks like INSIGHT was already built.
208 echo Building INSIGHT...
209 tar -xjf ..
/`basename ${INSIGHT}`
210 echo ___________________
>> make.log
211 echo Building insight...
>> make.log
212 cd `find . -maxdepth 1 -type d -name 'insight*'`
215 ..
/configure
${COMMON_CFG} ${INSIGHT_CFG} >> ..
/..
/make.log
2>&1
216 make ${MAKEFLAGS} >> ..
/..
/make.log
2>&1
217 make install >> ..
/..
/make.log
2>&1
222 if [[ -f gdb.built
]]; then
223 echo Looks like GDB was already built.
226 tar -xjf ..
/`basename ${GDB}`
227 echo ___________________
>> make.log
228 echo Building insight...
>> make.log
229 cd `find . -maxdepth 1 -type d -name 'gdb*'`
232 ..
/configure
${COMMON_CFG} ${GDB_CFG} >> ..
/..
/make.log
2>&1
233 make ${MAKEFLAGS} >> ..
/..
/make.log
2>&1
234 make install >> ..
/..
/make.log
2>&1
239 echo ___________________
>> make.log
240 echo Build complete.
>> make.log
245 echo Downloaded archives are
in ${SRCDIR}
246 echo build driectory
: ${BUILDDIR}
247 echo set environment variable ARMLIB to
${DESTDIR}/lib
/gcc
/arm-elf
/4.3.3/interwork
for Makefile.linux