annotate toolchain/build+install.sh @ 64:a481d648278a

fc-loadtool: "quick program" command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 28 Jun 2013 04:49:09 +0000
parents 53b8d61c16a0
children ebe258a85813
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
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
47
53b8d61c16a0 toolchain: -mthumb-interwork multilib enabled, matching OsmocomBB's version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 0
diff changeset
50 # patch gcc as needed
53b8d61c16a0 toolchain: -mthumb-interwork multilib enabled, matching OsmocomBB's version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 0
diff changeset
51 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
52
0
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 # 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
54 # 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
55 # happens to be present already
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 PATH=$2/bin:$PATH
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 export PATH
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 mkdir -p gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 cd gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 ../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
62 --enable-interwork --enable-multilib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 --with-cpu=arm7tdmi --with-float=soft \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 --enable-languages=c --with-newlib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 --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
66 --with-system-zlib --disable-shared \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 --disable-nls
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 make all-gcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 make install-gcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 cd ..
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 # now we can build newlib
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73 mkdir newlib-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 cd newlib-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 ../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
76 --enable-interwork --enable-multilib \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 --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
78 --disable-newlib-supplied-syscalls \
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 --disable-nls
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80 make all
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 make install
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 cd ..
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 # and finally, libgcc
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 cd gcc-build
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 make all
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 make install
9beb566ded04 starting with the toolchain for building our loadagent
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 cd ..