-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathsync.sh
executable file
·251 lines (223 loc) · 6.48 KB
/
sync.sh
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
#!/bin/bash
BASE=$(cd $(dirname $0);pwd)
source ${BASE}/scripts-common/sync-common.sh
unset TGTS skip_patch
skip_patch=false
# overwrite remote MIRROR in sync-common.sh if local mirror exists
if [ -d /opt/aosp/.mirror/platform/manifest.git ]; then
MIRROR="/opt/aosp/.mirror/platform/manifest.git"
else
echo "No local mirrors"
fi
##########################################################
##########################################################
while [ "$1" != "" ]; do
case $1 in
-bm | --base-manifest)
# overwrite base_manifest in sync-common.sh
shift
base_manifest=$1
echo "Use pinned manifest: $1"
sync_linaro=false
echo "Force sync_linaro=false"
;;
-d) # overwrite dbg in helpers
echo "Print debug"
dbg=true
;;
-ip | --install-packages)
# overwrite install_pkg in sync-common.sh
echo "Install deps"
install_pkg=true
;;
-j) # set build parallellism
# overwrite CPUS in helpers
shift
echo "Num threads: $1"
CPUS=$1
;;
-nl | --nolinaro)
# overwrite sync_linaro in sync-common.sh
echo "Skip local manifests sync"
sync_linaro=false
;;
--ref) # sync referencing an existing source tree (forest)
# overwrite REF in sync-common.sh
shift
echo "set --reference $1"
REF=$1
;;
-sp | -skip-patch)
echo "Patches will NOT be applied"
skip_patch=true
;;
-s | -sync-target)
echo "Adding sync target: $1"
TGTS=(${TGTS[@]} $1)
;;
-t) # overwrite board in sync-common.sh
# default is hikey
# no other eg atm
shift
echo "board=$1"
board=$1
;;
-u) # overwrite MIRROR in sync-common.sh
# default remote is https://android.googlesource.com/platform/manifest
# default local above overwrites default remote
# specify your own here using -u
shift
echo "export MIRROR=$1"
export MIRROR=$1
;;
-v) # overwrite version in sync-common.sh
# default is master
# eg o or p
shift
echo "version=$1"
version=$1
;;
-wv) #overwrite wv in helpers
echo "wv build"
wv=true
;;
-zfs) #overwrite zfs_clone in sync-common.sh
echo "src dir is a zfs clone"
zfs_clone=true
;;
*) # default adds to target list without shift
echo "Adding sync target by default: $1"
TGTS=(${TGTS[@]} $1)
;;
esac
shift
done
# check conflicting args
# no need since we force sync_linaro=false if pinned-manifest specified!
#if $sync_linaro && [[ "${base_manifest}" = "pinned-manifest"* ]]; then
# echo "Cannot use both local and pinned manifest at the same time!"
# exit 1
#fi
if [ "${base_manifest}" != "default.xml" ] && [[ "${base_manifest}" != "pinned-manifest"* ]]; then
echo "Please specify a valid pinned-manifest_YYYYMMDD-HHMM.xml from archive/!"
exit 1
fi
if [ X"$TGTS" != X"" ]; then
echo "sync targets: ${TGTS[@]}"
fi
main
if [ X"$TGTS" != X"" ]; then
echo "Patches NOT applied when syncing specific target(s) only!"
exit
fi
#if not stable manifest
if [ "$skip_patch" = false ] || [ "${base_manifest}" != "pinned-manifest-stable"* ]; then
if [[ "${base_manifest}" != "pinned-manifest"* ]]; then
${BASE}/sync-projects.sh -j ${CPUS} -d \
android-patchsets \
android-build-configs \
build/make \
device/linaro/hikey \
device/linaro/bootloader/edk2 \
frameworks/av \
frameworks/base \
frameworks/native \
system/sepolicy \
system/core \
system/netd \
system/bt \
system/libvintf \
packages/inputmethods/LatinIME \
prebuilts/clang/host/linux-x86 \
hardware/interfaces \
external/libdrm \
frameworks/opt/net/ethernet \
system/connectivity/wificond \
bootable/recovery \
libcore \
test/vts \
external/optee_test \
external/optee_client \
external/optee_examples \
optee/optee_os \
optee/l-loader \
device/linaro/kmgk
if [ "$version" = "master" ] || [ "$version" = "p" ]; then
echo "unshallow 4.14 kernel"
${BASE}/sync-projects.sh -j ${CPUS} -d kernel/linaro/hisilicon-4.14
elif [ "$version" = "o" ]; then
echo "unshallow 4.9 kernel"
${BASE}/sync-projects.sh -j ${CPUS} -d kernel/linaro/hisilicon
else
echo "unknown kernel version!"
fi
#if [ "$board" = "hikey960" ]; then
# echo "unshallow hikey960 bootloader repos"
# ${BASE}/sync-projects.sh -j ${CPUS} -d \
# optee/edk2
#fi
if [ "$wv" = true ]; then
echo "unshallow wv repos"
${BASE}/sync-projects.sh -j ${CPUS} -d \
external/optee-widevine-ref \
vendor/widevine
#vendor/widevine \
#ExoPlayer
fi
fi
#end if not pinned manifest
if [ "$dbg" = true ]; then
echo "set OPTEE_OS_DBG and OPTEE_CLN_DBG to y"
export OPTEE_OS_DBG=y
export OPTEE_CLN_DBG=y
fi
# apply local patches before
if [ -f "SWG-PATCHSETS-BEFORE" ]; then
echo "applying patchset: SWG-PATCHSETS-BEFORE"
func_apply_patch SWG-PATCHSETS-BEFORE
fi
if [ "$dbg" = true ]; then
echo ""
echo "CI builds have debugs disabled. Enable them here."
for i in $(find android-patchsets/ -name swg-mods*); do
sed -i '/^#apply.* 17632/s/^#//' $i
sed -i '/^#apply.* 18328/s/^#//' $i
sed -i '/^#apply.* 18457/s/^#//' $i
sed -i '/^#apply.* 20096/s/^#//' $i
sed -i '/#curl_am_optee.* a581c9bb/s/#//' $i
sed -i '/^#curl_am_optee.* cf7c607f/s/^#//' $i
done
fi
cd android-patchsets
git apply ../382.patch
# 'apply' better even if the changes are not committed
# cos if committed via 'am' then the 'stray' sha might be saved to the
# pinned-manifest!
# 'stray' in the sense that it's not living in any branches or tags
#git am ../382.patch
cd -
for i in ${PATCHSETS}; do
echo ""
echo ""
echo "applying patchset: $i"
func_apply_patch $i
done
# apply local patches after
if [ -f "SWG-PATCHSETS-AFTER" ]; then
echo "applying patchset: SWG-PATCHSETS-AFTER"
func_apply_patch SWG-PATCHSETS-AFTER
fi
fi
#end if not stable manifest
if [ "$install_pkg" = true ]; then
echo ""
echo ""
echo "Installing dep pkgs before build"
install_packages
fi
echo ""
echo ""
echo "Sync done!"
echo "Please make sure there are no errors before building!"
#./build.sh -j ${CPUS} -v ${version} -t {board}
exit