-
Notifications
You must be signed in to change notification settings - Fork 3
/
arm-eabi-all-4.9
241 lines (196 loc) · 7.82 KB
/
arm-eabi-all-4.9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#!/bin/bash
# Copyright (C) 2015 Joe Maples
# Copyright (C) 2015 The SaberMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This scripts is to build all of my arm-eabi toolchains and upload them to GitHub.
#
export SET_SM_GCC_VERSION=4.9.3 && export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' && export DATE=`date +%Y-%m-%d` && export target_cpu=cortex_a15 && export TARGET_CPU_VARIANT=krait;
JOBS="$(cat /proc/cpuinfo | grep -c processor)";
OPT_JOBS=$(bc <<< "($JOBS-1)*2")
MAKE_FLAGS="-j$OPT_JOBS";
############################################################
############################################################
##### #####
##### TUNEABLE VARIABLES #####
##### #####
############################################################
############################################################
export CPU=cortex_a15;
export FPU=neon-vfpv4;
export linaro_dir=~/linaro/build;
export sm_dir=~/sm/build-scripts;
###################
## END TUNEABLES ##
###################
build linaro(){
cd $linaro_dir;
echo "Building Linaro";
export GIT_FETCH="git fetch https://git.linaro.org/toolchain/gcc.git linaro-4.9-branch";
export SET_CLOOG_VERSION=current && export SET_ISL_VERSION=current
export GCC=Linaro;
export VERSION=Linaro;
build; &> /dev/null
}
build linaromod(){
cd $sm_dir;
echo "Building LinaroMod";
export GIT_FETCH="git fetch https://git.linaro.org/toolchain/gcc.git linaro-4.9-branch";
export SET_CLOOG_VERSION=0.18.3 && export SET_ISL_VERSION=0.14;
export GCC=Linaro;
export VERSION=LinaroMod;
export GCC2=SaberMod;
build; &> /dev/null
}
build sabernaro(){
cd $linaro_dir;
echo "Building SaberNaro";
export GIT_FETCH="git fetch https://github.com/SaberMod/GCC_SaberMod $SET_SM_GCC_VERSION";
export SET_CLOOG_VERSION=current && export SET_ISL_VERSION=current;
export GCC=SaberMod;
export GCC2=Linaro;
export VERSION=SaberNaro;
build; &> /dev/null
}
build(){
# Attempt to speed up compilation by linking everything to /tmp filesystem
# Also find toolchain root
if [ -e /tmp/$VERSION ];
then
rm -rf /tmp/$VERSION;
fi;
cd ../;
export TOOLCHAIN_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
cd /tmp && ln -s $TOOLCHAIN_ROOT /tmp/$VERSION && cd /tmp/$VERSION;
export TOOLCHAIN_ROOT_SYMBOLIC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# Make sure gcc is on the right remote branch 4.9.x
cd $TOOLCHAIN_ROOT_SYMBOLIC/gcc/gcc-$GCC && rm -rf * && git reset --hard && $GIT_FETCH && git checkout FETCH_HEAD && cd $TOOLCHAIN_ROOT_SYMBOLIC/build;
# Build PATH
export BUILD_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# Try to parallelize the build for faster performance.
export JOBS="$(cat /proc/cpuinfo | grep -c processor)";
# Make a clean build
if [ -e Makefile ];
then
make $MAKE_FLAGS clean;
make $MAKE_FLAGS distclean;
fi;
# Remove all untracked files and directories in git
if [ -d gmp-gnu ];
then
rm -rf gmp-gnu;
fi;
export PREFIX_PATH=~/hyper/$VERSION-arm-eabi-4.9-$DATE;
export PREFIX=--prefix=$PREFIX_PATH;
if [ -d "$PREFIX_PATH" ];
then
rm -rf $PREFIX_PATH;
mkdir -p $PREFIX_PATH;
else
mkdir -p $PREFIX_PATH;
fi;
export GCC_INSTALLED=$PREFIX_PATH/bin/arm-eabi-gcc;
# sysroot
cd $TOOLCHAIN_ROOT_SYMBOLIC/sysroot && rm -rf * && git reset --hard && git fetch sm gcc-4.9 && git checkout FETCH_HEAD && cd $BUILD_PATH;
export SYSROOT_SRC_PATH=$TOOLCHAIN_ROOT_SYMBOLIC/sysroot/arch-arm;
export SYSROOT_DEST_PATH=$PREFIX_PATH/arch-arm;
cp -R $SYSROOT_SRC_PATH -f $SYSROOT_DEST_PATH;
export SYSROOT=--with-sysroot=$SYSROOT_DEST_PATH;
# Build and install cloog, isl and osl libraries into the toolchain sysroot environment.
# GMP
cd $TOOLCHAIN_ROOT_SYMBOLIC/gmp/gmp-gnu;
export GMP_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
# CLOOG
export CLOOG_PREFIX_PATH=$SYSROOT_DEST_PATH/usr;
export CLOOG_PREFIX=--prefix=$CLOOG_PREFIX_PATH;
# Cloog Build Configuration
cd $TOOLCHAIN_ROOT_SYMBOLIC/cloog/cloog-$SET_CLOOG_VERSION && ./configure $CLOOG_PREFIX --with-isl=bundled --with-osl=bundled --with-gmp=system;
make $MAKE_FLAGS;
make install;
# cleanup
make $MAKE_FLAGS clean;
make $MAKE_FLAGS distclean;
# untracked files
rm -rf cloog-isl-uninstalled.pc cloog-isl-uninstalled.sh cloog-isl.pc cloog-isl.pc.in doc/gitversion.texi version.h isl/gitversion.h isl/include/isl/stdint.h isl/isl-uninstalled.pc isl/isl-uninstalled.sh isl/isl.pc isl/isl.pc.in;
git reset --hard;
# make libs available for ld
export SYSROOT_LIB_PATH=$SYSROOT_DEST_PATH/usr/lib;
export LD_LIBRARY_PATH=$SYSROOT_LIB_PATH;
export CLOOG_INSTALLED=$SYSROOT_LIB_PATH/libcloog-isl.so.4
export SET_TARGET_BUILD=CLOOG;
cd $BUILD_PATH;
# Did we make it?
if [ -e $CLOOG_INSTALLED ];
then
# Make a system link for older version of libisl using the newer version for older systems
cd $SYSROOT_LIB_PATH && ln -s libisl.so.13.1.0 libisl.so.10 && cd $BUILD_PATH;
./build-success;
sleep 5;
# GCC Build Configuration
./configure $PREFIX $SYSROOT --host=x86_64-linux-gnu --build=x86_64-linux-gnu --target=arm-eabi --program-transform-name='s&^&arm-eabi-&' --with-gcc-version=$GCC --with-pkgversion='Hyper-$VERSION-4.9.x_arm-graphite' --with-binutils-version=android --with-gmp-version=gnu --with-mpfr-version=gnu --with-mpc-version=gnu --with-gdb-version=android --with-cloog-version=$SET_CLOOG_VERSION --with-isl-version=$SET_ISL_VERSION --enable-graphite=yes --enable-plugins --enable-threads --enable-ld=default --disable-option-checking --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-bootstrap "--enable-eh-frame-hdr-for-static" --with-cpu=$CPU --with-tune=$CPU --with-fpu=$FPU;
# Build the toolchain
make $MAKE_FLAGS;
# Install the toolchain (twice)
make install && make install;
export SET_TARGET_BUILD=GCC;
# Did we make it?
if [ -e $GCC_INSTALLED ];
then
./build-success;
cp $sm_dir/.gitignore $PREFIX_PATH/.gitignore
else
./build-failed;
fi;
else
./build-failed;
fi;
cd ~;
}
changelog(){
#!/bin/sh
export Changelog=Changelog.txt
if [ -f $Changelog ];
then
rm -f $Changelog
fi
touch $Changelog
# Print something to build output
echo ${bldppl}"Generating changelog..."${txtrst}
for i in $(seq 5);
do
export After_Date=`date --date="10 days ago" +%m-%d-%Y`
k=$(expr $i - 1)
export Until_Date=`date --date="0 days ago" +%m-%d-%Y`
# Line with after --- until was too long for a small ListView
echo '====================' >> $Changelog;
echo " "$Until_Date >> $Changelog;
echo '====================' >> $Changelog;
echo >> $Changelog;
# Cycle through every repo to find commits between 2 dates
repo forall -pc 'git log --oneline --after=$After_Date --until=$Until_Date' >> $Changelog
echo >> $Changelog;
done
sed -i 's/project/ */g' $Changelog
cp $Changelog $PREFIX_PATH/
}
upload(){
echo "Uploading Build";
# Add README
cd $PREFIX_PATH;
touch README.mkdn;
echo " $VERSION ARM-EABI 4.9
----------------------
This toolchain was built using $GCC GCC, but in a $GCC2 build environment (linaro binutils, gdb, cloog, etc.) with the exception of using the latest ISL. This is built opposite of my LinaroMod toolchain." >> README.mkdn;
git init && git add -A && git commit -m "Update build to $DATE" -s && git push -f https://github.com/hyper-toolchains/$VERSION-arm-eabi-4.9.git master; &> /dev/null
}