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