FreeCalypso > hg > freecalypso-sw
annotate toolchain/build+install.sh @ 32:9a77b3395747
Pirelli ADD22 configuration
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 04 May 2013 07:34:20 +0000 |
parents | 9beb566ded04 |
children | 53b8d61c16a0 |
rev | line source |
---|---|
0
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #!/bin/sh |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 # |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 # This script builds and installs binutils, gcc and newlib in the order |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 # necessary for the whole thing to work. The present version is based |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 # on OsmocomBB's gnu-arm-build.2.sh script, which is in turn based on |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 # yet another source. The present version has been concocted by |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 # Spacefalcon the Outlaw for use in the FreeCalypso project. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 # |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 # This script needs to be invoked with two arguments: |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 # |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 # $1: the path to the directory containing the upstream binutils, gcc |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 # and newlib source tarballs; |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 # |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 # $2: the path to the directory where the built toolchain should be |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 # installed. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 # |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 # Note that there isn't a single install step at the end, instead this |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 # script will build and install one component, then proceed to build the |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 # next component which depends on the previous one, etc. For this reason |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 # you should create a dedicated install directory that is writable by your |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 # regular (non-root) uid, then run this script to populate that directory |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 # with the toolchain. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 if [ $# != 2 ] |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 then |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 echo "usage: $0 path-to-tarballs path-to-install" |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 exit 1 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 fi |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 set -ex |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 target_args="--target=arm-elf" |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 # binutils come first |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 tar xjf $1/binutils-2.21.1a.tar.bz2 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 mkdir -p binutils-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 cd binutils-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 ../binutils-2.21.1/configure --prefix=$2 ${target_args} --disable-nls |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 make all |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 make install |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 cd .. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 # unpack gcc and newlib sources at the same time: the gcc build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 # will be pointed to newlib headers |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 gcc_version=4.5.4 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 newlib_version=2.0.0 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 tar xjf $1/gcc-core-${gcc_version}.tar.bz2 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 tar xzf $1/newlib-${newlib_version}.tar.gz |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 # gcc depends on binutils - add our install destination dir to the PATH |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 # we prepend it to avoid surprises if some other arm-elf- toolchain |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 # happens to be present already |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 PATH=$2/bin:$PATH |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 export PATH |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 mkdir -p gcc-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 cd gcc-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 ../gcc-${gcc_version}/configure --prefix=$2 ${target_args} \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 --enable-interwork --enable-multilib \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 --with-cpu=arm7tdmi --with-float=soft \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 --enable-languages=c --with-newlib \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 --with-headers=`pwd`/newlib-${newlib_version}/newlib/libc/include \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 --with-system-zlib --disable-shared \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 --disable-nls |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 make all-gcc |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 make install-gcc |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 cd .. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 # now we can build newlib |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 mkdir newlib-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 cd newlib-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 ../newlib-${newlib_version}/configure --prefix=$2 ${target_args} \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 --enable-interwork --enable-multilib \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 --enable-target-optspace --enable-newlib-reent-small \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 --disable-newlib-supplied-syscalls \ |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 --disable-nls |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 make all |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 make install |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 cd .. |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 # and finally, libgcc |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 cd gcc-build |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 make all |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 make install |
9beb566ded04
starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 cd .. |