-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc_buildenv
290 lines (254 loc) · 8.12 KB
/
.bashrc_buildenv
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# Use find to ignore symlinks
sgrep ()
{
local repo_ign="-name .git -o -name .svn"
find . \( -type d -a \( $repo_ign \) \) -prune -o -type f -exec grep -H --color $@ {} \;
}
MAKE=/usr/bin/make
if [ -e /usr/bin/colormake ]; then
# https://github.com/pagekite/Colormake
MAKE=/usr/bin/colormake;
complete -o filenames -F _make colormake
fi
# Compile using 4 cores, if failed remake with 1 core to show errors
makej4 ()
{
time $MAKE -j 7 "$@" || (echo "FAILED" && $MAKE "$@")
}
alias make=makej4
# http://linuxdeveloper.blogspot.com/2012/10/building-linux-kernel-clean-way.html
# $cd linux-3.6
# $make distclean
# $make defconfig O=`kb`
# $make O=`kb`
pb ()
{
local P="$HOME/projects/build/$(basename "$(pwd)")"
local branch="_$(git branch)" || branch=''
P=$P$branch
mkdir -p "$P"
echo "$P"
}
export EDITOR=vim
function isFedora()
{
[ -e /etc/redhat-release ]
return $?
}
function setMakeDefAM335x()
{
DEFCONFIGS="mityarm-335x-devkit_defconfig mitysom-335x-devkit_defconfig singlecore-omap2plus_defconfig omap2plus_defconfig"
for defconfig in $DEFCONFIGS;
do
if [ -e "arch/arm/configs/$defconfig" ]
then
echo Defconfig - "$defconfig" >&2;
echo "$defconfig"
return
fi
done
echo "No suitable defconfig found"
}
function setMakeAliases()
{
local prefix=$1
local defconfig=$2
alias makearm="make ARCH=arm CROSS_COMPILE=$prefix"
export CCACHE_DIR="$HOME/local/.ccache_$prefix"
export CCACHE_TEMPDIR="/dev/shm"
#export PATH="/usr/lib/ccache:$PATH"
alias makeu='makearm uImage'
alias makez='makearm zImage'
alias makedef="makearm $defconfig"
alias makemod='makearm modules && makearm INSTALL_MOD_PATH=$PWD/ARM modules_install'
alias makemenu="/usr/bin/make ARCH=arm CROSS_COMPILE=$prefix menuconfig"
alias maked='makearm dtbs'
}
function buildenv()
{
local tt=$1
if [ ! -z "$TARGET_SYS" ]
then
echo "Target sys already set..."
tt=""
fi
case "$tt" in
l138|L138|oe2008)
echo Setting up CL MityOMAP-L138 Build environment...
. /usr/local/angstrom/arm/environment-setup
setMakeAliases arm-angstrom-linux-gnueabi- industrialio_defconfig
;;
ipnc)
echo Setting up IPNC Build environment...
. /export/space/jcormier/TI_IPNC_RDK_DM36x_V5.1.0/Source/dvsdk_ipnctools/linux-devkit/environment-setup
alias makearm="make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi-"
export CCACHE_DIR="$HOME/local/.ccache_arm-arago-linux-gneuabi"
export CCACHE_TEMPDIR="/dev/shm"
export PATH="/usr/lib/ccache:$PATH"
alias makemenu='/usr/bin/make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- menuconfig'
;;
oe2012)
echo Setting up CL MityOMAP-L138 OE 2012 Build environment...
. /usr/local/oecore-i686/environment-setup-armv5te-angstrom-linux-gnueabi
setMakeAliases arm-angstrom-linux-gnueabi- industrialio_defconfig
#cd /usr/lib/ccache
#sudo ln -s ../../bin/ccache arm-angstrom-linux-gnueabi-cpp
#sudo ln -s ../../bin/ccache arm-angstrom-linux-gnueabi-g++
#sudo ln -s ../../bin/ccache arm-angstrom-linux-gnueabi-gcc
;;
am335x|AM335X)
isFedora && { echo "TI toolchain doesn't work in fedora"; return; }
echo Setting up CL MityARM-AM335X Build environment...
#. /usr/local/ti-sdk-am335x-evm/linux-devkit/environment-setup
#. /usr/local/ti-sdk-am335x-evm-05.07.00.00/linux-devkit/environment-setup
local toolchain=/usr/local/ti-sdk-am335x-evm-05.03.02.00/linux-devkit/environment-setup
if [ ! -d $toolchain ] # if doesn't exist
then
toolchain=/net/mitydsp/export/space/ti-sdk-am335x-evm-05.03.02.00/linux-devkit/environment-setup
fi
. $toolchain
setMakeAliases arm-arago-linux-gnueabi- mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
;;
am335x_new)
isFedora && { echo "TI toolchain doesn't work in fedora"; return; }
echo "Setting up (08.00.00.00) CL MityARM-AM335X Build environment..."
local toolchain=/opt/ti-sdk-am335x-evm-08.00.00.00/linux-devkit/environment-setup
if [ ! -d $toolchain ] # if doesn't exist
then
toolchain=/net/mitydsp/export/space/ti-sdk-am335x-evm-08.00.00.00/linux-devkit/environment-setup
fi
# Dont source toolchain for kernel
#. $toolchain
export PATH=/opt/ti-sdk-am335x-evm-08.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin:$PATH
setMakeAliases arm-linux-gnueabihf- mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
alias makedef2='makearm singlecore-omap2plus_defconfig'
#cd /usr/lib/ccache
#sudo ln -s ../../bin/ccache arm-linux-gnueabihf-cpp
#sudo ln -s ../../bin/ccache arm-linux-gnueabihf-g++
#sudo ln -s ../../bin/ccache arm-linux-gnueabihf-gcc
;;
yocto)
echo Setting up MityARM-AM335X yocto build environment
local toolchain=/export/space/jcormier/mitysom-335x_20160113/sysroots/i686-clsdk-linux
if [ ! -d "$toolchain" ] # if doesn't exist
then
toolchain=/net/mitydsp/export/space/timesys/mityarm335x/toolchain/
fi
export PATH=$toolchain/usr/bin:$toolchain/usr/bin/arm-criticallink-linux-gnueabi:$PATH
#. $toolchain/../../environment-setup-cortexa8t2hf-vfp-neon-criticallink-linux-gnueabi
setMakeAliases arm-criticallink-linux-gnueabi- mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
alias makedef2='makearm omap2plus_defconfig'
;;
timesys)
echo Setting up MityARM-AM335X Timesys build environment
local toolchain=$HOME/timesys/mityarm_335x/toolchain
if [ ! -d "$toolchain" ] # if doesn't exist
then
toolchain=/net/mitydsp/export/space/timesys/mityarm335x/toolchain/
fi
export PATH=$toolchain/ccache:$toolchain/bin:$PATH
setMakeAliases armv7l-timesys-linux-gnueabi- mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
alias makeu2='makearm uImage modules LOADADDR=0x80008000'
alias makedef2='makearm omap2plus_defconfig'
;;
timesys_distcc)
echo Setting up MityARM-AM335X Timesys distcc build environment
toolchain=/net/mitydsp/export/space/timesys/mityarm335x/toolchain/
export PATH=$toolchain/ccache:$toolchain/bin:$PATH
setMakeAliases "distcc $toolchain/bin/armv7l-timesys-linux-gnueabi-" mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
alias makeu2='makearm uImage modules LOADADDR=0x80008000'
alias makedef2='makearm omap2plus_defconfig'
;;
linaro)
echo Setting up MityARM-AM335X Linaro build environment
local toolchain=/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf
#if [ ! -d "$toolchain" ] # if doesn't exist
#then
# toolchain=/net/mitydsp/export/space/timesys/mityarm335x/toolchain/
#fi
export PATH=$toolchain/bin:$PATH
setMakeAliases arm-linux-gnueabihf- mityarm-335x-devkit_defconfig
alias makedef='makearm $(setMakeDefAM335x)'
alias makedef2='makearm omap2plus_defconfig'
;;
android)
# Launch android studio - studio.sh
# http://developer.android.com/sdk/index.html
# Launch intellij - idea.sh
# https://www.jetbrains.com/idea/help/basics-and-installation.html
export PATH=~/local/android-studio/bin:~/local/idea-IC-141.1532.4/bin:$PATH
export JAVA_HOME=/etc/alternatives/java_sdk
;;
socfpga|5csx)
/opt/altera/14.1/embedded/embedded_command_shell.sh
alias eclipse="/usr/bin/eclipse"
;;
vanilla)
echo Clearing make alias
alias make='time make'
MAKE=/usr/bin/make
export QMAKESPEC=""
;;
*)
echo "Toolchain TARGET_SYS = $TARGET_SYS"
;;
esac
}
isMounted()
{
local mountPT=$1
mountpoint -q "$mountPT"
return $?
}
waitForMount()
{
local mountPT=$1
while ! isMounted "$mountPT"; do
sleep .5
done
}
if [ -d /media/jcormier ]
then
mountDir=/media/jcormier
else
mountDir=/media
fi
waitForSD()
{
echo Insert SD Card;
waitForMount "$mountDir/boot" &&
waitForMount "$mountDir/rootfs" &&
waitForMount "$mountDir/START_HERE"
sleep .5
}
umountSD()
{
# Try unmounting 3 times before erroring out
waitTime=1
umount "$mountDir"/* ||
(sleep $waitTime; umount $mountDir/*) ||
(sleep $waitTime; umount $mountDir/*) ||
return 1
return 0
}
copyUImage()
{
waitForSD &&
cp -v arch/arm/boot/uImage "$mountDir/boot/" &&
umountSD;
mount | grep media
}
copyMLO()
{
waitForSD &&
cp -v MLO u-boot.img "$mountDir/boot/" &&
umountSD;
mount | grep media
}
alias cpuimage='copyUImage'
alias cpmlo='copyMLO'