xref: /rkbin/scripts/checkpatch.sh (revision fab41a51f7fd7279f5a1eae37dadee6a788048a2)
1#!/bin/bash
2set -e
3
4pack_loader_image()
5{
6	local files ini
7
8	files=`ls ./RKBOOT/*MINIALL*.ini`
9	for ini in $files
10	do
11		if [ -f "$ini" ]; then
12			# Ignore unused
13			if [ "$ini" = "./RKBOOT/RK302AMINIALL.ini" -o \
14				 "$ini" = "./RKBOOT/RK30BMINIALL.ini" -o \
15				 "$ini" = "./RKBOOT/RK30MINIALL.ini" -o \
16				 "$ini" = "./RKBOOT/RK310BMINIALL.ini" ]; then
17				continue;
18			fi
19
20			echo "pack Input: $ini"
21			./tools/boot_merger $ini
22			rm *loader*.bin
23			echo
24		fi
25	done
26}
27
28pack_trust_image()
29{
30	local files ini TOS TOS_TA
31
32# Pack 32-bit trust
33	files=`ls ./RKTRUST/*TOS*.ini`
34	for ini in $files
35	do
36		if [ -f "$ini" ]; then
37			echo "pack Input: $ini"
38
39			# Parse orignal path
40			TOS=`sed -n "/TOS=/s/TOS=//p" $ini|tr -d '\r'`
41			TOS_TA=`sed -n "/TOSTA=/s/TOSTA=//p" $ini|tr -d '\r'`
42
43			# replace "./tools/rk_tools/" with "./" to compatible legacy ini content of rkdevelop branch
44			TOS=$(echo ${TOS} | sed "s/tools\/rk_tools\//\.\//g")
45			TOS_TA=$(echo ${TOS_TA} | sed "s/tools\/rk_tools\//\.\//g")
46
47			if [ x$TOS_TA != x -a x$TOS != x ]; then
48				./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000
49				./tools/loaderimage --pack --trustos ${TOS_TA} ./trust_with_ta.img 0x68400000
50			elif [ $TOS ]; then
51				./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000
52			elif [ $TOS_TA ]; then
53				./tools/loaderimage --pack --trustos ${TOS_TA} ./trust.img 0x68400000
54			else
55				exit 1
56			fi
57			rm trust*.img
58			echo
59		fi
60	done
61
62# Pack 64-bit trust
63	files=`ls ./RKTRUST/*TRUST*.ini`
64	for ini in $files
65	do
66		if [ -f "$ini" ]; then
67			echo "pack Input: $ini"
68			./tools/trust_merger $ini
69			rm trust*.img
70			echo
71		fi
72	done
73}
74
75finish()
76{
77	echo "Packing loader and trust successfully."
78	echo
79}
80
81pack_loader_image
82pack_trust_image
83finish
84