commit | author | age
|
a07526
|
1 |
#!/bin/bash |
H |
2 |
set -e |
|
3 |
|
|
4 |
ARG_COMMIT=$1 |
|
5 |
DIFF_SUBSET="scripts/.diff_*" |
|
6 |
DIFF_DOC_ALL="scripts/.diff_all.txt" |
|
7 |
DIFF_DOC_FIXED="scripts/.diff_fixed.txt" |
|
8 |
LAST_SEVERITY= |
|
9 |
LAST_DOC= |
|
10 |
|
|
11 |
function check_doc() |
|
12 |
{ |
|
13 |
local TOP_SEVERITY LANGUAGE=$1 |
|
14 |
|
|
15 |
if [ "${LANGUAGE}" == "EN" ] ; then |
|
16 |
SVT_CRITIAL="critical" |
|
17 |
SVT_IMPORTANT="important" |
|
18 |
SVT_MODERATE="moderate" |
|
19 |
DOC=`git log ${ARG_COMMIT} -1 --name-only | sed -n "/_EN\.md/p"` |
|
20 |
else |
|
21 |
SVT_CRITIAL="紧急" |
|
22 |
SVT_IMPORTANT="重要" |
|
23 |
SVT_MODERATE="普通" |
|
24 |
DOC=`git log ${ARG_COMMIT} -1 --name-only | sed -n "/_CN\.md/p"` |
|
25 |
fi |
|
26 |
|
|
27 |
echo "Checking doc: ${DOC}" |
|
28 |
|
|
29 |
# check DOS encoding |
|
30 |
git show ${ARG_COMMIT} -1 ${DOC} | sed -n "/^+/p" > ${DIFF_DOC_ALL} |
|
31 |
git show ${ARG_COMMIT} -1 ${DOC} | sed -n "/^+/p" > ${DIFF_DOC_ALL}.dos |
|
32 |
dos2unix ${DIFF_DOC_ALL}.dos >/dev/null 2>&1 |
|
33 |
CSUM1=`md5sum ${DIFF_DOC_ALL} | awk '{ print $1 }'` |
|
34 |
CSUM2=`md5sum ${DIFF_DOC_ALL}.dos | awk '{ print $1 }'` |
|
35 |
if [ "${CSUM1}" != "${CSUM2}" ]; then |
|
36 |
echo "ERROR: ${DOC} is DOS encoding. Fix it by: 'dos2unix ${DOC}'" |
|
37 |
exit 1 |
|
38 |
fi |
|
39 |
|
|
40 |
TITLE=`sed -n "/^+## /p" ${DIFF_DOC_ALL} | tr -d " +#"` |
|
41 |
DATE=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $2 }'` |
|
42 |
YEAR=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $2 }' | awk -F "-" '{ print $1 }'` |
|
43 |
MON=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $2 }' | awk -F "-" '{ print $2 }'` |
|
44 |
FILE=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $3 }'` |
|
45 |
COMMIT=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $4 }'` |
|
46 |
SEVERITY=`sed -n "/^+| 20[0-9][0-9]-/p" ${DIFF_DOC_ALL} | tr -d " " | awk -F "|" '{ print $5 }'` |
|
47 |
END_LINE_3=`tail -n 3 ${DIFF_DOC_ALL} | sed -n '1p'` |
|
48 |
END_LINE_2=`tail -n 3 ${DIFF_DOC_ALL} | sed -n '2p'` |
|
49 |
END_LINE_1=`tail -n 3 ${DIFF_DOC_ALL} | sed -n '3p'` |
|
50 |
HOST_YEAR=`date +%Y` |
|
51 |
HOST_MON=`date +%m` |
|
52 |
# echo "### ${COMMIT}, ${SEVERITY}, ${TITLE}, ${FILE}" |
|
53 |
|
|
54 |
# check blank line after Heading 1 |
|
55 |
HEADING_1=`sed -n '1p' ${DOC}` |
|
56 |
if sed -n '2p' ${DOC} | grep -q [a-z,A-Z] ; then |
|
57 |
echo "ERROR: ${DOC}: Please add blank line after '${HEADING_1}'" |
|
58 |
exit 1 |
|
59 |
fi |
|
60 |
|
|
61 |
# check space |
|
62 |
if sed -n "/##/p" ${DOC} | grep -v '## [a-z,A-Z]' ; then |
|
63 |
echo "ERROR: ${DOC}: Please only 1 space between '#' and word" |
|
64 |
exit 1 |
|
65 |
fi |
|
66 |
|
|
67 |
# check new content location |
|
68 |
if ! git show ${ARG_COMMIT} -1 ${DOC} | grep -q 'Release Note' ; then |
|
69 |
echo "ERROR: ${DOC}: Please add new content at the top but not bottom" |
|
70 |
exit 1 |
|
71 |
fi |
|
72 |
|
|
73 |
# check title |
|
74 |
if grep -Eq '### WARN|### WARNING|### Warning|### warn|### warning' ${DIFF_DOC_ALL} ; then |
|
75 |
echo "ERROR: ${DOC}: Please use '### Warn'" |
|
76 |
exit 1 |
|
77 |
fi |
|
78 |
|
|
79 |
if grep -Eq '### NEW|### new' ${DIFF_DOC_ALL} ; then |
|
80 |
echo "ERROR: ${DOC}: Please use '### New'" |
|
81 |
exit 1 |
|
82 |
fi |
|
83 |
|
|
84 |
if grep -Eq '### FIXED|### fixed' ${DIFF_DOC_ALL} ; then |
|
85 |
echo "ERROR: ${DOC}: Please use '### Fixed'" |
|
86 |
exit 1 |
|
87 |
fi |
|
88 |
|
|
89 |
# check year/month |
|
90 |
if [ "${HOST_YEAR}" != "${YEAR}" ]; then |
|
91 |
echo "ERROR: ${DOC}: '${DATE}' is wrong, the year should be ${HOST_YEAR}" |
|
92 |
exit 1 |
|
93 |
fi |
|
94 |
|
|
95 |
if [ "${HOST_MON}" != "${MON}" ]; then |
|
96 |
echo "ERROR: ${DOC}: '${DATE}' is wrong, the month should be ${HOST_MON}" |
|
97 |
exit 1 |
|
98 |
fi |
|
99 |
|
|
100 |
# check TAB before index of 'New' body |
|
101 |
if grep -q $'\t[0-9]' ${DOC} ; then |
|
102 |
echo "ERROR: ${DOC}: Don't add TAB before index:" |
|
103 |
grep $'\t[0-9]' ${DOC} |
|
104 |
exit 1 |
|
105 |
fi |
|
106 |
|
|
107 |
# check upper case and line end |
|
108 |
if [ "${LANGUAGE}" == "EN" ] ; then |
|
109 |
if grep -q '^[0-9]\. [a-z]' ${DOC} ; then |
|
110 |
echo "ERROR: ${DOC}: Please use upper case of first word(i.e. \"1. add ..\" => \"1. Add ...\"):" |
|
111 |
grep '^[0-9]\. [a-z]' ${DOC} |
|
112 |
exit 1 |
|
113 |
fi |
|
114 |
|
|
115 |
# check end with '.' |
|
116 |
if sed -n '/^[0-9]\. [A-Z]/p' ${DOC} | grep -q '[^.]$' ; then |
|
117 |
echo "ERROR: ${DOC}: Please end line with '.'" |
|
118 |
grep '^[0-9]\. [A-Z]' ${DOC} | grep '[^.]$' |
|
119 |
exit 1 |
|
120 |
fi |
|
121 |
|
|
122 |
# check Chinese language |
|
123 |
if grep -P '[\x{4e00}-\x{9fa5}]' ${DOC} ; then |
|
124 |
echo "ERROR: ${DOC}: The Chinese language was found" |
|
125 |
exit 1 |
|
126 |
fi |
|
127 |
else |
|
128 |
# check end with '。' |
|
129 |
if sed -n '/^[0-9]\. /p' ${DOC} | grep -q '[^。]$' ; then |
|
130 |
echo "ERROR: ${DOC}: Please end line with '。'" |
|
131 |
grep '^[0-9]\. ' ${DOC} | grep '[^。]$' |
|
132 |
exit 1 |
|
133 |
fi |
|
134 |
fi |
|
135 |
|
|
136 |
# check space after index of 'New' body |
|
137 |
SUM1=`grep '^[0-9]\.' ${DOC} | wc -l` |
|
138 |
SUM2=`grep '^[0-9]\.[[:blank:]]' ${DOC} | wc -l` |
|
139 |
if [ "$SUM1" != "$SUM2" ]; then |
|
140 |
echo "ERROR: ${DOC}: Please add space after index (e.g: '1. ' but not '1.'):" |
|
141 |
grep '^+[0-9]\.' ${DIFF_DOC_ALL} |
|
142 |
exit 1 |
|
143 |
fi |
|
144 |
|
|
145 |
# check standalone file |
|
146 |
if ! echo ${FILE} | grep -Eq '\.bin|\.elf|\.img' ; then |
|
147 |
echo "ERROR: ${DOC}: '${FILE}' missing the file format suffix" |
|
148 |
exit 1 |
|
149 |
fi |
|
150 |
if ! echo ${FILE} | grep -q { ; then |
|
151 |
if ! git log ${ARG_COMMIT} -1 --name-only | grep -q ${FILE}; then |
|
152 |
echo "ERROR: ${DOC}: '${FILE}' is not updated in this patch" |
|
153 |
exit 1 |
|
154 |
fi |
|
155 |
fi |
|
156 |
|
|
157 |
# check title |
|
158 |
if [ "${TITLE}" != "${FILE}" ]; then |
|
159 |
echo "ERROR: ${DOC}: Title '${TITLE}' is not match with '${FILE}'" |
|
160 |
exit 1 |
|
161 |
fi |
|
162 |
|
|
163 |
# check commit |
|
164 |
COMMIT=${COMMIT//#/ } |
|
165 |
for LIST in ${COMMIT}; do |
|
166 |
CMT=`echo ${LIST} | cut -d : -f 2` |
|
167 |
if ! git log ${ARG_COMMIT} -1 | grep -q ${CMT} ; then |
|
168 |
echo "ERROR: ${DOC}: '${CMT}' is not match in commit message" |
|
169 |
exit 1 |
|
170 |
fi |
|
171 |
|
|
172 |
if ! echo ${FILE} | grep -q { ; then |
|
173 |
if echo ${FILE} | grep -Eq 'spl_|tpl_|bl31_|bl32_|tee_' ; then |
|
174 |
FILE_PATH=`find -name ${FILE}` |
|
175 |
if [ -z "${FILE_PATH}" ]; then |
|
176 |
echo "ERROR: ${DOC}: No ${FILE}" |
|
177 |
exit 1 |
|
178 |
fi |
|
179 |
if ! strings ${FILE_PATH} | grep -q ${CMT} ; then |
|
180 |
echo "ERROR: ${DOC}: ${FILE} is not build from '${CMT}'" |
|
181 |
exit 1 |
|
182 |
fi |
|
183 |
fi |
|
184 |
fi |
|
185 |
done |
|
186 |
|
|
187 |
# check severity |
|
188 |
if [ "${SEVERITY}" != "${SVT_CRITIAL}" -a "${SEVERITY}" != "${SVT_IMPORTANT}" -a "${SEVERITY}" != "${SVT_MODERATE}" ]; then |
|
189 |
echo "ERROR: ${DOC}: Unknown main severity: ${SEVERITY}" |
|
190 |
exit 1 |
|
191 |
fi |
|
192 |
|
|
193 |
# check horizontal line |
|
194 |
if [ "${END_LINE_2}" != "+------" ]; then |
|
195 |
echo "ERROR: ${DOC}: Please add horizontal line '------' at the last of new content" |
|
196 |
exit 1 |
|
197 |
fi |
|
198 |
if [ "${END_LINE_3}" != "+" ]; then |
|
199 |
echo "ERROR: ${DOC}: Please add blank line before horizontal line '------'" |
|
200 |
exit 1 |
|
201 |
fi |
|
202 |
if [ "${END_LINE_1}" != "+" ]; then |
|
203 |
echo "ERROR: ${DOC}: Please add blank line after horizontal line '------'" |
|
204 |
exit 1 |
|
205 |
fi |
|
206 |
|
|
207 |
# check 'Fixed' content |
|
208 |
if grep -q "^+### Fixed" ${DIFF_DOC_ALL} ; then |
|
209 |
awk -v RS='### Fixed' 'END{printf "%s", $0}' ${DIFF_DOC_ALL} > ${DIFF_DOC_FIXED} |
|
210 |
sed -i "/^$/d" ${DIFF_DOC_FIXED} |
|
211 |
sed -i "/Index/d" ${DIFF_DOC_FIXED} |
|
212 |
sed -i "/---/d" ${DIFF_DOC_FIXED} |
|
213 |
sed -i "/^+$/d" ${DIFF_DOC_FIXED} |
|
214 |
|
|
215 |
while read LINE |
|
216 |
do |
|
217 |
EACH_SEVERITY=`echo "${LINE}" | awk -F "|" '{ print $3 }' | tr -d " "` |
|
218 |
if [ "${EACH_SEVERITY}" != "${SVT_CRITIAL}" -a "${EACH_SEVERITY}" != "${SVT_IMPORTANT}" -a "${EACH_SEVERITY}" != "${SVT_MODERATE}" ]; then |
|
219 |
if [ -z "${EACH_SEVERITY}" ]; then |
|
220 |
echo "ERROR: ${DOC}: No severity found, please use Table to list what you '### Fixed'" |
|
221 |
else |
|
222 |
echo "ERROR: ${DOC}: Unknown severity: ${EACH_SEVERITY}" |
|
223 |
fi |
|
224 |
exit 1 |
|
225 |
fi |
|
226 |
|
|
227 |
# echo "## EACH: $EACH_SEVERITY" |
|
228 |
if [ -z "${TOP_SEVERITY}" ]; then |
|
229 |
TOP_SEVERITY="${EACH_SEVERITY}" |
|
230 |
elif [ "${TOP_SEVERITY}" == "${SVT_MODERATE}" ]; then |
|
231 |
if [ "${EACH_SEVERITY}" == "${SVT_CRITIAL}" -o "${EACH_SEVERITY}" == "${SVT_IMPORTANT}" ]; then |
|
232 |
TOP_SEVERITY="${EACH_SEVERITY}" |
|
233 |
fi |
|
234 |
elif [ "${TOP_SEVERITY}" == "${SVT_IMPORTANT}" ]; then |
|
235 |
if [ "${EACH_SEVERITY}" == "${SVT_CRITIAL}" ]; then |
|
236 |
TOP_SEVERITY="${EACH_SEVERITY}" |
|
237 |
fi |
|
238 |
fi |
|
239 |
done < ${DIFF_DOC_FIXED} |
|
240 |
|
|
241 |
if [ "${SEVERITY}" != "${TOP_SEVERITY}" ]; then |
|
242 |
echo "ERROR: ${DOC}: Top severity should be '${TOP_SEVERITY}' as it's the highest level of all sub severity" |
|
243 |
exit 1 |
|
244 |
fi |
|
245 |
|
|
246 |
# check top severity miss match |
|
247 |
if [ ! -z ${LAST_SEVERITY} ]; then |
|
248 |
if [ "${LAST_SEVERITY}" == "普通" -a "${TOP_SEVERITY}" != "moderate" ]; then |
|
249 |
MISS_MATCH="y" |
|
250 |
elif [ "${LAST_SEVERITY}" == "重要" -a "${TOP_SEVERITY}" != "important" ]; then |
|
251 |
MISS_MATCH="y" |
|
252 |
elif [ "${LAST_SEVERITY}" == "紧急" -a "${TOP_SEVERITY}" != "critical" ]; then |
|
253 |
MISS_MATCH="y" |
|
254 |
elif [ "${LAST_SEVERITY}" == "moderate" -a "${TOP_SEVERITY}" != "普通" ]; then |
|
255 |
MISS_MATCH="y" |
|
256 |
elif [ "${LAST_SEVERITY}" == "important" -a "${TOP_SEVERITY}" != "重要" ]; then |
|
257 |
MISS_MATCH="y" |
|
258 |
elif [ "${LAST_SEVERITY}" == "critical" -a "${TOP_SEVERITY}" != "紧急" ]; then |
|
259 |
MISS_MATCH="y" |
|
260 |
fi |
|
261 |
|
|
262 |
if [ "${MISS_MATCH}" == "y" ]; then |
|
263 |
echo "ERROR: ${DOC}: top Severity is '${SEVERITY}', while ${LAST_DOC}: top Severity is '${LAST_SEVERITY}'" |
|
264 |
echo " Available Severity types are: moderate(普通), important(重要), critical(紧急)" |
|
265 |
exit 1 |
|
266 |
fi |
|
267 |
fi |
|
268 |
|
|
269 |
LAST_SEVERITY="${SEVERITY}" |
|
270 |
LAST_DOC="${DOC}" |
|
271 |
fi |
|
272 |
} |
|
273 |
|
|
274 |
function check_docs() |
|
275 |
{ |
|
276 |
if git log ${ARG_COMMIT} -1 --name-only | sed -n '5p' | grep -Eq '^ Revert "' ; then |
|
277 |
return; |
|
278 |
fi |
|
279 |
|
|
280 |
if git log ${ARG_COMMIT} -1 --name-only | grep -Eq '\.bin|\.elf' ; then |
|
281 |
DOC_CN=`git log ${ARG_COMMIT} -1 --name-only | sed -n "/_CN\.md/p"` |
|
282 |
DOC_EN=`git log ${ARG_COMMIT} -1 --name-only | sed -n "/_EN\.md/p"` |
|
283 |
if [ -z "${DOC_CN}" -o -z "${DOC_EN}" ]; then |
|
284 |
echo "ERROR: Should update CN and EN Release-Note when .bin/elf changed" |
|
285 |
exit 1 |
|
286 |
fi |
|
287 |
|
|
288 |
NUM=`git log ${ARG_COMMIT} -1 --name-only | sed -n "/\.md/p" | wc -l` |
|
289 |
if [ ${NUM} -gt 2 ]; then |
|
290 |
echo "ERROR: More than 2 release note are updated" |
|
291 |
exit 1 |
|
292 |
fi |
|
293 |
|
|
294 |
if ! which dos2unix > /dev/null 2>&1 ; then |
|
295 |
echo "ERROR: No 'dos2unix'. Fix by: sudo apt-get install dos2unix" |
|
296 |
exit 1 |
|
297 |
fi |
|
298 |
|
|
299 |
check_doc CN |
|
300 |
check_doc EN |
|
301 |
fi |
|
302 |
|
|
303 |
rm -f ${DIFF_SUBSET} |
|
304 |
} |
|
305 |
|
|
306 |
function pack_loader_image() |
|
307 |
{ |
|
308 |
for FILE in `ls ./RKBOOT/*MINIALL*.ini` |
|
309 |
do |
|
310 |
if [ "${FILE}" = "./RKBOOT/RK302AMINIALL.ini" -o \ |
|
311 |
"${FILE}" = "./RKBOOT/RK30BMINIALL.ini" -o \ |
|
312 |
"${FILE}" = "./RKBOOT/RK30MINIALL.ini" -o \ |
|
313 |
"${FILE}" = "./RKBOOT/RK310BMINIALL.ini" ]; then |
|
314 |
continue; |
|
315 |
fi |
|
316 |
|
|
317 |
if grep -q '^PATH=img/' ${FILE}; then |
|
318 |
continue; |
|
319 |
fi |
|
320 |
|
|
321 |
echo "Pack loader: ${FILE}" |
|
322 |
./tools/boot_merger ${FILE} |
|
323 |
rm -f *loader*.bin *download*.bin *idblock*.img |
|
324 |
echo |
|
325 |
done |
|
326 |
} |
|
327 |
|
|
328 |
function pack_trust_image() |
|
329 |
{ |
|
330 |
# Pack 32-bit trust |
|
331 |
for FILE in `ls ./RKTRUST/*TOS*.ini` |
|
332 |
do |
|
333 |
if ! test -s ${FILE}; then |
|
334 |
continue; |
|
335 |
elif ! grep -q 'TOS' ${FILE}; then |
|
336 |
continue; |
|
337 |
elif grep -q '^PATH=img/' ${FILE}; then |
|
338 |
continue; |
|
339 |
fi |
|
340 |
|
|
341 |
echo "Pack trust: ${FILE}" |
|
342 |
# Parse orignal path |
|
343 |
TOS=`sed -n "/TOS=/s/TOS=//p" ${FILE}|tr -d '\r'` |
|
344 |
TOS_TA=`sed -n "/TOSTA=/s/TOSTA=//p" ${FILE}|tr -d '\r'` |
|
345 |
|
|
346 |
# replace "./tools/rk_tools/" with "./" to compatible legacy ini content of rkdevelop branch |
|
347 |
TOS=$(echo ${TOS} | sed "s/tools\/rk_tools\//\.\//g") |
|
348 |
TOS_TA=$(echo ${TOS_TA} | sed "s/tools\/rk_tools\//\.\//g") |
|
349 |
|
|
350 |
if [ x${TOS_TA} != x -a x${TOS} != x ]; then |
|
351 |
./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000 |
|
352 |
./tools/loaderimage --pack --trustos ${TOS_TA} ./trust_with_ta.img 0x68400000 |
|
353 |
elif [ ${TOS} ]; then |
|
354 |
./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000 |
|
355 |
elif [ ${TOS_TA} ]; then |
|
356 |
./tools/loaderimage --pack --trustos ${TOS_TA} ./trust.img 0x68400000 |
|
357 |
else |
|
358 |
exit 1 |
|
359 |
fi |
|
360 |
rm -f trust*.img |
|
361 |
echo |
|
362 |
done |
|
363 |
|
|
364 |
# Pack 64-bit trust |
|
365 |
for FILE in `ls ./RKTRUST/*TRUST*.ini` |
|
366 |
do |
|
367 |
if grep -q '^PATH=img/' ${FILE}; then |
|
368 |
continue; |
|
369 |
fi |
|
370 |
|
|
371 |
echo "Pack trust: ${FILE}" |
|
372 |
./tools/trust_merger ${FILE} |
|
373 |
rm -f trust*.img |
|
374 |
echo |
|
375 |
done |
|
376 |
} |
|
377 |
|
|
378 |
function check_dirty() |
|
379 |
{ |
|
380 |
for FILE in `find -name '*spl*.bin' -o -name '*tpl*.bin' -o -name '*usbplug*.bin' -o -name '*bl31*.elf' -o -name '*bl32*.bin'`; do |
|
381 |
echo "Checking clean: ${FILE}" |
|
382 |
if strings ${FILE} | grep '\-dirty ' ; then |
|
383 |
echo "ERROR: ${FILE} is dirty" |
|
384 |
exit 1 |
|
385 |
fi |
|
386 |
done |
|
387 |
} |
|
388 |
|
|
389 |
function check_stripped() |
|
390 |
{ |
|
391 |
for FILE in `find -name '*bl31*.elf'`; do |
|
392 |
echo "Checking strip: ${FILE}" |
|
393 |
INFO=`file ${FILE}` |
|
394 |
if echo ${INFO} | grep -q "not stripped" ; then |
|
395 |
echo "ERROR: ${FILE} is not stripped" |
|
396 |
exit 1 |
|
397 |
fi |
|
398 |
done |
|
399 |
} |
|
400 |
|
|
401 |
function check_mode() |
|
402 |
{ |
|
403 |
echo "Checking file mode..." |
|
404 |
if git whatchanged ${ARG_COMMIT} -1 --oneline | sed -n '/RKBOOT\//p; /RKTRUST\//p; /bin\//p; /doc\//p;' | awk '{ print $2 }' | grep -q 755 ; then |
|
405 |
git whatchanged ${ARG_COMMIT} -1 --oneline | sed -n '/RKBOOT\//p; /RKTRUST\//p; /bin\//p; /doc\//p;' | grep 755 |
|
406 |
echo "ERROR: Set 644 file permission but not 755." |
|
407 |
exit 1 |
|
408 |
fi |
|
409 |
} |
|
410 |
|
|
411 |
function check_version() |
|
412 |
{ |
|
413 |
echo "Checking fwver..." |
|
414 |
git whatchanged -1 --name-only | sed -n '/bin\//p' | sed -n '/ddr/p; /tpl/p; /spl/p; /bl31/p; /bl32/p; /tee/p;' | while read FILE; do |
|
415 |
if ! test -f ${FILE}; then |
|
416 |
continue |
|
417 |
fi |
|
418 |
|
|
419 |
NAME_VER=`echo ${FILE} | grep -o 'v[0-9][.][0-9][0-9]'` |
|
420 |
# ignore version < v1.00 |
|
421 |
if [[ "${NAME_VER}" == *v0.* ]]; then |
|
422 |
continue |
|
423 |
fi |
|
424 |
|
|
425 |
if ! strings ${FILE} | grep -q 'fwver: ' ; then |
|
426 |
echo "ERROR: ${FILE}: No \"fwver: \" string found in binary" |
|
427 |
exit 1 |
|
428 |
fi |
|
429 |
FW_VER=`strings ${FILE} | grep -o 'fwver: v[1-9][.][0-9][0-9]' | awk '{ print $2 }'` |
|
430 |
if [ "${NAME_VER}" != "${FW_VER}" ] ; then |
|
431 |
echo "ERROR: ${FILE}: file version is ${NAME_VER}, but fw version is ${FW_VER}." |
|
432 |
exit 1 |
|
433 |
fi |
|
434 |
done |
|
435 |
} |
|
436 |
|
|
437 |
function finish() |
|
438 |
{ |
|
439 |
echo "OK, everything is nice." |
|
440 |
echo |
|
441 |
} |
|
442 |
|
|
443 |
check_mode |
|
444 |
check_version |
|
445 |
check_docs |
|
446 |
check_dirty |
|
447 |
check_stripped |
|
448 |
pack_loader_image |
|
449 |
pack_trust_image |
|
450 |
finish |