22
22
ARCH=" $( uname -m) "
23
23
OS=" $( uname -s) "
24
24
25
- function verify_md5() {
26
- [[ $# -ne 2 ]] \
27
- && { echo " [${FUNCNAME[0]} ] Invalid number of args, expecting 2, but got $# " ; exit 1; }
28
- local ref_checksum=" ${1} "
29
- local file=" ${2} "
30
25
31
- if [[ " ${OS} " == " Darwin" ]]; then
32
- local file_checksum=" $( md5 -q $file ) "
33
- else
34
- local file_checksum=" $( md5sum $file | awk ' {print $1}' ) "
35
- fi
36
- if [[ ${ref_checksum} != ${file_checksum} ]]; then
37
- echo " Mismatched MD5 checksum for file: ${file} . Expecting ${ref_checksum} but got ${file_checksum} . Exiting."
38
- exit 1
39
- fi
40
- }
41
26
42
27
# #######
43
28
# ## Hardcoded constants
44
29
# #######
45
30
script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
31
+ et_dir=$( realpath $script_dir /../..)
46
32
47
33
if [[ " ${ARCH} " == " x86_64" ]]; then
48
34
# FVPs
@@ -140,7 +126,7 @@ function setup_fvp() {
140
126
curl --output " FVP_${fvp} .tgz" " ${fvp_url} "
141
127
md5_variable=${fvp} _md5_checksum
142
128
fvp_md5_checksum=${! md5_variable}
143
- verify_md5 ${fvp_md5_checksum} FVP_${fvp} .tgz
129
+ verify_md5 ${fvp_md5_checksum} FVP_${fvp} .tgz || exit 1
144
130
fi
145
131
146
132
echo " [${FUNCNAME[0]} ] Installing FVP ${fvp} ..."
@@ -181,7 +167,7 @@ function setup_toolchain() {
181
167
if [[ ! -e " ${toolchain_dir} .tar.xz" ]]; then
182
168
echo " [${FUNCNAME[0]} ] Downloading toolchain ..."
183
169
curl --output " ${toolchain_dir} .tar.xz" " ${toolchain_url} "
184
- verify_md5 ${toolchain_md5_checksum} " ${toolchain_dir} .tar.xz"
170
+ verify_md5 ${toolchain_md5_checksum} " ${toolchain_dir} .tar.xz" || exit 1
185
171
fi
186
172
187
173
echo " [${FUNCNAME[0]} ] Installing toolchain ..."
@@ -207,20 +193,6 @@ function setup_ethos_u() {
207
193
echo " [${FUNCNAME[0]} ] Done @ $( git describe --all --long 3> /dev/null) in ${root_dir} /ethos-u dir."
208
194
}
209
195
210
- function patch_repo() {
211
- # This is a temporary hack until it finds a better home in one for the ARM Ml repos
212
- name=" $( basename $repo_dir ) "
213
- echo -e " [${FUNCNAME[0]} ] Preparing ${name} ..."
214
- cd $repo_dir
215
- git fetch
216
- git reset --hard ${base_rev}
217
-
218
- patch_dir=${script_dir} /ethos-u-setup/${name} /patches/
219
- [[ -e ${patch_dir} && $( ls -A ${patch_dir} ) ]] && \
220
- git am -3 ${patch_dir} /* .patch
221
-
222
- echo -e " [${FUNCNAME[0]} ] Patched ${name} @ $( git describe --all --long 2> /dev/null) in ${repo_dir} dir.\n"
223
- }
224
196
225
197
function setup_tosa_reference_model() {
226
198
@@ -258,6 +230,9 @@ echo "[main] Using root dir ${root_dir}"
258
230
setup_path_script=" ${root_dir} /setup_path.sh"
259
231
echo " " > " ${setup_path_script} "
260
232
233
+ # Import utils
234
+ source $et_dir /backends/arm/scripts/utils.sh
235
+
261
236
# Setup toolchain
262
237
setup_toolchain
263
238
@@ -267,7 +242,8 @@ setup_ethos_u
267
242
# Patch the ethos-u dev environment to include executorch application
268
243
repo_dir=" ${root_dir} /ethos-u/core_platform"
269
244
base_rev=b728c774158248ba2cad8e78a515809e1eb9b77f
270
- patch_repo
245
+ patch_dir=${script_dir} /ethos-u-setup/
246
+ patch_repo $repo_dir $base_rev $patch_dir
271
247
272
248
# Setup the tosa_reference_model
273
249
setup_tosa_reference_model
0 commit comments