make.sh: support fit secure image build with args

Such as:
    ./make.sh rk3399 --rollback-index-uboot 12 --rollback-index-boot 22
    ./make.sh --rollback-index-uboot 12 --rollback-index-boot 22

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ifd3d564bc860af215860471a327f752305501123
This commit is contained in:
Joseph Chen 2020-04-20 17:48:57 +08:00 committed by Jianhong Chen
parent 4b4c68413a
commit f9afd3dc76
1 changed files with 20 additions and 6 deletions

22
make.sh
View File

@ -10,6 +10,7 @@ BOARD=$1
SUBCMD=$1 SUBCMD=$1
FUNCADDR=$1 FUNCADDR=$1
FILE=$2 FILE=$2
ARGS=$*
JOB=`sed -n "N;/processor/p" /proc/cpuinfo|wc -l` JOB=`sed -n "N;/processor/p" /proc/cpuinfo|wc -l`
SUPPORT_LIST=`ls configs/*[r,p][x,v,k][0-9][0-9]*_defconfig` SUPPORT_LIST=`ls configs/*[r,p][x,v,k][0-9][0-9]*_defconfig`
@ -147,7 +148,7 @@ function prepare()
{ {
case $BOARD in case $BOARD in
# Parse from exit .config # Parse from exit .config
''|elf*|loader*|spl*|itb|debug*|trust|uboot|map|sym|env|EXT_DTB=*|fit*|nopack) ''|elf*|loader*|spl*|itb|debug*|trust|uboot|map|sym|env|EXT_DTB=*|fit*|nopack|--rollback-index*)
if [ ! -f .config ]; then if [ ! -f .config ]; then
echo echo
echo "ERROR: No .config" echo "ERROR: No .config"
@ -166,7 +167,7 @@ function prepare()
;; ;;
#Subcmd #Subcmd
''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*|fit*|nopack) ''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*|fit*|nopack|--rollback-index*)
;; ;;
*) *)
@ -180,6 +181,8 @@ function prepare()
else else
echo "make for ${BOARD}_defconfig by -j${JOB}" echo "make for ${BOARD}_defconfig by -j${JOB}"
make ${BOARD}_defconfig ${OPTION} make ${BOARD}_defconfig ${OPTION}
# Skip 1st args
ARGS=`echo $ARGS | awk '{ $1=""; print $0 }'`
fi fi
;; ;;
esac esac
@ -234,8 +237,14 @@ function select_toolchain()
function sub_commands() function sub_commands()
{ {
# skip "--" parameter, such as "--rollback-index-..."
if [[ "$SUBCMD" != "--*" ]]; then
cmd=${SUBCMD%-*} cmd=${SUBCMD%-*}
opt=${SUBCMD#*-} opt=${SUBCMD#*-}
else
cmd=$SUBCMD
fi
elf=u-boot elf=u-boot
map=u-boot.map map=u-boot.map
sym=u-boot.sym sym=u-boot.sym
@ -313,6 +322,11 @@ function sub_commands()
exit 0 exit 0
;; ;;
--rollback-index*)
pack_fit_image $ARGS
exit 0
;;
EXT_DTB=*) EXT_DTB=*)
OPTION=${SUBCMD} OPTION=${SUBCMD}
;; ;;
@ -696,7 +710,7 @@ function pack_trust_image()
function pack_fit_image() function pack_fit_image()
{ {
if grep -q '^CONFIG_FIT_SIGNATURE=y' .config ; then if grep -q '^CONFIG_FIT_SIGNATURE=y' .config ; then
./scripts/fit-vboot.sh ./scripts/fit-vboot.sh $*
else else
./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild ./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild
ls uboot.img trust*.img >/dev/null 2>&1 && rm uboot.img trust*.img -rf ls uboot.img trust*.img >/dev/null 2>&1 && rm uboot.img trust*.img -rf
@ -712,7 +726,7 @@ function pack_images()
pack_trust_image pack_trust_image
pack_loader_image pack_loader_image
elif [ "$PACK_FORMAT" = "fit" ]; then elif [ "$PACK_FORMAT" = "fit" ]; then
pack_fit_image pack_fit_image $ARGS
fi fi
fi fi
} }