3 # Some things for you to configure
5 # Where you want to install the tools
6 DESTDIR
=/usr
/local
/gnuarm-4.3
.0
8 # Where do you want to build the tools. This is where the log files
9 # will be written (which you can monitor with 'tail' during compilation).
10 # You can delete this directory after everything is done.
11 SRCDIR
="/home/lafargue/Documents/Hobbies/RFID/Toolchain/linux"
13 # Where to get each of the toolchain components
14 BINUTILS
=ftp://ftp.gnu.org
/gnu
/binutils
/binutils-2.18.
tar.bz2
15 GCCCORE
=ftp://ftp.gnu.org
/gnu
/gcc
/gcc-4.3
.0/gcc-core-4.3
.0.
tar.bz2
16 GPP
=ftp://ftp.gnu.org
/gnu
/gcc
/gcc-4.3
.0/gcc-g
++-4.3
.0.
tar.bz2
17 NEWLIB
=ftp://sources.redhat.com
/pub
/newlib
/newlib-1.16
.0.
tar.gz
18 #INSIGHT=ftp://sourceware.org/pub/insight/releases/insight-6.8.tar.bz2
19 INSIGHT
=http
://mirrors.kernel.org
/sources.redhat.com
/insight
/releases
/insight-6.8.
tar.bz2
20 #INSIGHT=http://www.mirrorservice.org/sites/sources.redhat.com/pub/insight/releases/insight-6.8.tar.bz2
22 # Common configuration options (i.e., things to pass to 'configure')
23 COMMON_CFG
="--enable-interwork --target=arm-elf --program-prefix=arm-elf- --prefix=${DESTDIR} --disable-werror --enable-languages=c,c++ --enable-multilib --disable-shared"
25 # Extra configuration options for each toolchain component
27 GCCCORE_CFG
="--disable-libssp --disable-threads --with-newlib" # Not sure about these last 2 options...there to try to make C++ support work
31 # Compiler flags for compiling Newlib (-O2 is already hard-coded)
32 NEWLIB_FLAGS
="-march=armv4t -mcpu=arm7tdmi -g"
34 ############################################################################
35 # End of configuration section. You shouldn't have to modify anything below.
36 ############################################################################
38 if [[ `whoami` != "root" ]]; then
39 echo You must be root to run this
script
46 if [[ -f `basename ${BINUTILS}` ]]; then
47 echo Looks like BINUTILS has already been downloaded.
49 echo Now downloading BINUTILS...
50 # -nv: non-verbose but not too quiet (still print errors/warnings)
51 # -nc: no-clobber, do not download a file that already exists
52 # -t 0: retry indefinitely
53 # -a wget.log: append errors/warnings to wget.log file
54 wget
-nv -nc -t 0 -a wget.log
${BINUTILS}
57 if [[ -f `basename ${GCCCORE}` ]]; then
58 echo Looks like GCC has already been downloaded.
60 echo Now downloading GCC...
61 wget
-nv -nc -t 0 -a wget.log
${GCCCORE}
64 if [[ -f `basename ${GPP}` ]]; then
65 echo Looks like G
++ has already been downloaded.
67 echo Now downloading G
++...
68 wget
-nv -nc -t 0 -a wget.log
${GPP}
71 if [[ -f `basename ${NEWLIB}` ]]; then
72 echo Looks like NEWLIB has already been downloaded.
74 echo Now downloading NEWLIB...
75 wget
-nv -nc -t 0 -a wget.log
${NEWLIB}
78 if [[ -f `basename ${INSIGHT}` ]]; then
79 echo Looks like INSIGHT has already been downloaded.
81 echo Now downloading INSIGHT...
82 wget
-nv -nc -t 0 -a wget.log
${INSIGHT}
85 if [[ -f binutils.built
]]; then
86 echo Looks like BINUTILS was already built.
88 echo Building BINUTILS...
89 tar -xjf `basename ${BINUTILS}`
90 echo ___________________
> make.log
91 echo Building binutils...
>> make.log
92 cd `find . -maxdepth 1 -type d -name 'binutils*'`
95 ..
/configure
${COMMON_CFG} ${BINUTILS_CFG} >> ..
/..
/make.log
2>&1
96 make MAKEINFO
=`which makeinfo` >> ..
/..
/make.log
2>&1
97 make install >> ..
/..
/make.log
2>&1
102 echo ___________________
>> make.log
103 echo Adding
${DESTDIR}/bin to PATH
>> make.log
104 export PATH
; PATH
=${DESTDIR}/bin
:$PATH
105 echo ___________________
>> make.log
107 if [[ -f gcc.built
]]; then
108 echo Looks like GCC was already built.
111 tar -xjf `basename ${GCCCORE}`
112 tar -xjf `basename ${GPP}`
113 echo ___________________
>> make.log
115 cat << EOF > gcc.patch
116 --- gcc-4.2.2.orig/gcc/config/arm/t-arm-elf 2006-11-06 13:13:53.000000000 +0100
117 +++ gcc-4.2.2.mod/gcc/config/arm/t-arm-elf 2007-10-05 12:13:00.000000000 +0200
119 # MULTILIB_DIRNAMES += fpu soft
120 # MULTILIB_EXCEPTIONS += *mthumb/*mhard-float*
122 -# MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
123 -# MULTILIB_DIRNAMES += normal interwork
124 +MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork
125 +MULTILIB_DIRNAMES += normal interwork
127 # MULTILIB_OPTIONS += fno-leading-underscore/fleading-underscore
128 # MULTILIB_DIRNAMES += elf under
131 echo Patching GCC
>> make.log
132 cd `find . -maxdepth 1 -type d -name 'gcc*'`
133 patch -p1 < ..
/gcc.
patch
134 echo Building gcc...
>> make.log
137 ..
/configure
${COMMON_CFG} ${GCCCORE_CFG} >> ..
/..
/make.log
2>&1
138 make >> ..
/..
/make.log
2>&1
139 make install >> ..
/..
/make.log
2>&1
144 if [[ -f newlib.built
]]; then
145 echo Looks like NEWLIB was already built.
147 echo Building NEWLIB...
148 tar -xzf `basename ${NEWLIB}`
149 echo ___________________
>> make.log
150 echo Building newlib...
>> make.log
151 cd `find . -maxdepth 1 -type d -name 'newlib*'`
154 ..
/configure
${COMMON_CFG} ${NEWLIB_CFG} >> ..
/..
/make.log
2>&1
156 # This line adds our NEWLIB_CFLAGS to the configure.host file in the
157 # newlib subdirectory. This is the only way I could find to tell Newlib to
158 # compile itself with the -mmarch=armv4t and -mcpu=arm7tdmi flags.
159 sed -i "/^newlib_cflags=/s/=.*\$/=\"${NEWLIB_FLAGS}\"/" ..
/newlib
/configure.
host
160 make >> ..
/..
/make.log
2>&1
161 make install >> ..
/..
/make.log
2>&1
166 echo ___________________
>> make.log
167 echo "Now that newlib is built, second pass for GCC..." >> make.log
168 cd `find . -maxdepth 1 -type d -name 'gcc*'`
170 make >> ..
/..
/make.log
2>&1
171 make install >> ..
/..
/make.log
2>&1
175 if [[ -f insight.built
]]; then
176 echo Looks like INSIGHT was already built.
178 echo Building INSIGHT...
179 tar -xjf `basename ${INSIGHT}`
180 echo ___________________
>> make.log
181 echo Building insight...
>> make.log
182 cd `find . -maxdepth 1 -type d -name 'insight*'`
185 ..
/configure
${COMMON_CFG} ${INSIGHT_CFG} >> ..
/..
/make.log
2>&1
186 make >> ..
/..
/make.log
2>&1
187 make install >> ..
/..
/make.log
2>&1
192 echo ___________________
>> make.log
193 echo Build complete.
>> make.log