From 24a8c2d6fa68671a8f68be1065554f4b97f7775a Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Fri, 16 Nov 2018 10:09:58 +0800 Subject: [PATCH] scripts: add checkpatch.sh Usage: ./scripts/checkpatch.sh Change-Id: Id6694f5fba3dcd6a6b4ad8d9de46b71b20cd0d18 Signed-off-by: Joseph Chen --- scripts/checkpatch.sh | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 scripts/checkpatch.sh diff --git a/scripts/checkpatch.sh b/scripts/checkpatch.sh new file mode 100755 index 00000000..c12c3326 --- /dev/null +++ b/scripts/checkpatch.sh @@ -0,0 +1,84 @@ +#!/bin/bash +set -e +BIN_PATH_FIXUP="--replace tools/rk_tools/ ./" + +pack_loader_image() +{ + local files ini + + files=`ls ./RKBOOT/*MINIALL*.ini` + for ini in $files + do + if [ -f "$ini" ]; then + # Ignore unused + if [ "$ini" = "./RKBOOT/RK302AMINIALL.ini" -o \ + "$ini" = "./RKBOOT/RK30BMINIALL.ini" -o \ + "$ini" = "./RKBOOT/RK30MINIALL.ini" -o \ + "$ini" = "./RKBOOT/RK310BMINIALL.ini" ]; then + continue; + fi + + echo "pack Input: $ini" + ./tools/boot_merger ${BIN_PATH_FIXUP} $ini + rm *loader*.bin + echo + fi + done +} + +pack_trust_image() +{ + local files ini TOS TOS_TA + +# Pack 32-bit trust + files=`ls ./RKTRUST/*TOS*.ini` + for ini in $files + do + if [ -f "$ini" ]; then + echo "pack Input: $ini" + + # Parse orignal path + TOS=`sed -n "/TOS=/s/TOS=//p" $ini|tr -d '\r'` + TOS_TA=`sed -n "/TOSTA=/s/TOSTA=//p" $ini|tr -d '\r'` + + # replace "./tools/rk_tools/" with "./" to compatible legacy ini content of rkdevelop branch + TOS=$(echo ${TOS} | sed "s/tools\/rk_tools\//\.\//g") + TOS_TA=$(echo ${TOS_TA} | sed "s/tools\/rk_tools\//\.\//g") + + if [ x$TOS_TA != x -a x$TOS != x ]; then + ./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000 + ./tools/loaderimage --pack --trustos ${TOS_TA} ./trust_with_ta.img 0x68400000 + elif [ $TOS ]; then + ./tools/loaderimage --pack --trustos ${TOS} ./trust.img 0x68400000 + elif [ $TOS_TA ]; then + ./tools/loaderimage --pack --trustos ${TOS_TA} ./trust.img 0x68400000 + else + exit 1 + fi + rm trust*.img + echo + fi + done + +# Pack 64-bit trust + files=`ls ./RKTRUST/*TRUST*.ini` + for ini in $files + do + if [ -f "$ini" ]; then + echo "pack Input: $ini" + ./tools/trust_merger ${BIN_PATH_FIXUP} $ini + rm trust*.img + echo + fi + done +} + +finish() +{ + echo "Packing loader and trust successfully." + echo +} + +pack_loader_image +pack_trust_image +finish