make.sh: optimise fit

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I527656dbcd550c5520edb8e5a677854d9623cf55
This commit is contained in:
Joseph Chen 2020-04-08 19:30:43 +08:00
parent 75323eb827
commit 69b6e59094
1 changed files with 27 additions and 16 deletions

43
make.sh
View File

@ -152,7 +152,7 @@ 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=*) ''|elf*|loader*|spl*|itb|debug*|trust|uboot|map|sym|env|EXT_DTB=*|fit*)
if [ ! -f .config ]; then if [ ! -f .config ]; then
echo echo
echo "Build failed, Can't find .config" echo "Build failed, Can't find .config"
@ -171,7 +171,7 @@ prepare()
;; ;;
#Subcmd #Subcmd
''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*) ''|elf*|loader*|spl*|itb|debug*|trust*|uboot|map|sym|env|EXT_DTB=*|fit*)
;; ;;
*) *)
@ -207,6 +207,10 @@ prepare()
echo " 3. Download full release SDK repository" echo " 3. Download full release SDK repository"
exit 1 exit 1
fi fi
if grep -q '^CONFIG_ROCKCHIP_FIT_IMAGE_PACK=y' .config ; then
PACK_FORMAT="fit"
fi
} }
select_toolchain() select_toolchain()
@ -269,6 +273,11 @@ sub_commands()
exit 0 exit 0
;; ;;
fit)
./scripts/fit-vboot.sh $*
exit 0
;;
map) map)
cat ${map} | less cat ${map} | less
exit 0 exit 0
@ -604,12 +613,16 @@ pack_loader_image()
return; return;
fi fi
cd ${RKBIN} if [ "$PACK_FORMAT" = "rk" ]; then
cd ${RKBIN}
${RKTOOLS}/boot_merger ${BIN_PATH_FIXUP} $ini ${RKTOOLS}/boot_merger ${BIN_PATH_FIXUP} $ini
echo "pack loader okay! Input: $ini" cd - && mv ${RKBIN}/*_loader_*.bin ./
echo "pack loader okay! Input: $ini"
cd - && mv ${RKBIN}/*_loader_*.bin ./ else
./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild >/dev/null
file=`ls *loader*.bin`
echo "pack $file okay! Input: $ini"
fi
} }
pack_32bit_trust_image() pack_32bit_trust_image()
@ -646,14 +659,7 @@ pack_32bit_trust_image()
TOS=$(echo ${TOS} | sed "s/tools\/rk_tools\//\.\//g") TOS=$(echo ${TOS} | sed "s/tools\/rk_tools\//\.\//g")
TOS_TA=$(echo ${TOS_TA} | sed "s/tools\/rk_tools\//\.\//g") TOS_TA=$(echo ${TOS_TA} | sed "s/tools\/rk_tools\//\.\//g")
FORMAT=`sed -n "/FIT=/s/FIT=//p" ${ini} |tr -d '\r'` if [ "$PACK_FORMAT" = "rk" ]; then
if [ "$FORMAT" = "1" ]; then
PACK_FORMAT="fit"
./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild >/dev/null
ls uboot.img >/dev/null 2>&1 && rm uboot.img -rf
ls trust.img >/dev/null 2>&1 && rm trust.img -rf
echo "pack uboot.fit (with uboot trust) okay! Input: ${ini}"
else
if [ $TOS_TA ]; then if [ $TOS_TA ]; then
${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS_TA} ${TEE_OUTPUT} ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE} ${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS_TA} ${TEE_OUTPUT} ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE}
elif [ $TOS ]; then elif [ $TOS ]; then
@ -664,6 +670,11 @@ pack_32bit_trust_image()
fi fi
echo "pack trust okay! Input: ${ini}" echo "pack trust okay! Input: ${ini}"
else
./scripts/fit-vboot-uboot.sh --no-vboot --no-rebuild >/dev/null
ls uboot.img >/dev/null 2>&1 && rm uboot.img -rf
ls trust.img >/dev/null 2>&1 && rm trust.img -rf
echo "pack uboot.fit (with uboot trust) okay! Input: ${ini}"
fi fi
echo echo