annotate toolchain/build+install.sh @ 221:842c9fd828fd

gsm-fw: TMFFS integrated
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 07 Jan 2014 03:51:09 +0000
parents ebe258a85813
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
83
ebe258a85813 toolchain: binutils patch to emit the "short" form of Thumb->ARM call veneers
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 47
diff changeset
36 # apply patches
ebe258a85813 toolchain: binutils patch to emit the "short" form of Thumb->ARM call veneers
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 47
diff changeset
37 patch binutils-2.21.1/bfd/elf32-arm.c < binutils-patches/elf32-arm.patch
0
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 mkdir -p binutils-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 cd binutils-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 ../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
41 make all
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 make install
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 cd ..
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 # 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
46 # will be pointed to newlib headers
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 gcc_version=4.5.4
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 newlib_version=2.0.0
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 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
50 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
51
47
53b8d61c16a0 toolchain: -mthumb-interwork multilib enabled, matching OsmocomBB's version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 0
diff changeset
52 # patch gcc as needed
53b8d61c16a0 toolchain: -mthumb-interwork multilib enabled, matching OsmocomBB's version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 0
diff changeset
53 cp t-arm-elf gcc-${gcc_version}/gcc/config/arm
53b8d61c16a0 toolchain: -mthumb-interwork multilib enabled, matching OsmocomBB's version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 0
diff changeset
54
0
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 # 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
56 # 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
57 # happens to be present already
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 PATH=$2/bin:$PATH
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 export PATH
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 mkdir -p gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 cd gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 ../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
64 --enable-interwork --enable-multilib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 --with-cpu=arm7tdmi --with-float=soft \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 --enable-languages=c --with-newlib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 --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
68 --with-system-zlib --disable-shared \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 --disable-nls
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 make all-gcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 make install-gcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 cd ..
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 # now we can build newlib
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 mkdir newlib-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 cd newlib-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 ../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
78 --enable-interwork --enable-multilib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 --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
80 --disable-newlib-supplied-syscalls \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 --disable-nls
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 make all
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 make install
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 cd ..
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 # and finally, libgcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 cd gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 make all
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 make install
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90 cd ..