make.sh: fix the broken of px3se loader/trust packing

PX3SE loader/trust packing was broken since
  d443b7d make.sh: parse RKCHIP from .config

This fixs px3se building with previous commit. And since we're
here, detecting the variant gracefully.

Change-Id: I5c7f5385a4cfd0d6beba842bd4766b77d8f67d88
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
This commit is contained in:
Shunqian Zheng 2018-07-26 15:25:16 +08:00
parent f094cb2954
commit 596700d74b
1 changed files with 18 additions and 19 deletions

37
make.sh
View File

@ -288,28 +288,27 @@ select_chip_info()
local target_board item value local target_board item value
# Read RKCHIP firstly from .config # Read RKCHIP firstly from .config
count=`grep -c '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config` # The regular expression that matching:
RKCHIP=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config` # - PX30, PX3SE
# - RK????, RK????X
# - RV????
local chip_reg='^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9ESX]{2,5}'
count=`egrep -c ${chip_reg} ${OUTDIR}/.config`
# Obtain the matching only
RKCHIP=`egrep -o ${chip_reg} ${OUTDIR}/.config`
if [ $count -eq 1 ]; then if [ $count -eq 1 ]; then
RKCHIP=${RKCHIP%=*}
RKCHIP=${RKCHIP##*_} RKCHIP=${RKCHIP##*_}
elif [ $count -gt 1 ]; then elif [ $count -gt 1 ]; then
# Is RK3126 ? # Grep the RK CHIP variant
plat=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config | sed -n "/CONFIG_ROCKCHIP_RK3126=y/p"` grep '^CONFIG_ROCKCHIP_PX3SE=y' ${OUTDIR}/.config > /dev/null \
if [ "$plat" = 'CONFIG_ROCKCHIP_RK3126=y' ]; then && RKCHIP=PX3SE
RKCHIP=RK3126 grep '^CONFIG_ROCKCHIP_RK3126=y' ${OUTDIR}/.config >/dev/null \
fi && RKCHIP=RK3126
# Is RK3326 ? grep '^CONFIG_ROCKCHIP_RK3326=y' ${OUTDIR}/.config >/dev/null \
plat=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config | sed -n "/CONFIG_ROCKCHIP_RK3326=y/p"` && RKCHIP=RK3326
if [ "$plat" = 'CONFIG_ROCKCHIP_RK3326=y' ]; then grep '^CONFIG_ROCKCHIP_RK3128X=y' ${OUTDIR}/.config >/dev/null \
RKCHIP=RK3326 && RKCHIP=RK3128X
fi
# Is RK3128X ?
plat=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config | sed -n "/CONFIG_ROCKCHIP_RK3128X=y/p"`
if [ "$plat" = 'CONFIG_ROCKCHIP_RK3128X=y' ]; then
RKCHIP=RK3128X
fi
else else
echo "Can't get Rockchip SoC definition in .config" echo "Can't get Rockchip SoC definition in .config"
exit 1 exit 1
@ -463,7 +462,7 @@ pack_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")
if [ $TOS_TA -a $TOS ]; then if [ x$TOS_TA != x -a x$TOS != x ]; then
${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS} ./trust.img ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE} ${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS} ./trust.img ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE}
${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS_TA} ./trust_with_ta.img ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE} ${RKTOOLS}/loaderimage --pack --trustos ${RKBIN}/${TOS_TA} ./trust_with_ta.img ${TEE_LOAD_ADDR} ${PLATFORM_TRUST_IMG_SIZE}
echo "Both trust.img and trust_with_ta.img are ready" echo "Both trust.img and trust_with_ta.img are ready"