make.sh: parse RKCHIP from .config

this makes RKCHIP non relative about build command,
but we have to do special fixup for rk3326 and rk3126
board defconfig, because they contain px30 and rk3128
in the .config file.

Change-Id: Ia1974f2c8961b0a698d32f45effa4ddfe4177b0b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-06-25 14:49:06 +08:00
parent dda95de751
commit d443b7d532
1 changed files with 29 additions and 25 deletions

54
make.sh
View File

@ -2,8 +2,6 @@
set -e
BOARD=$1
SUBCMD=$2
RKCHIP=$(echo ${BOARD##*-} | tr '[a-z]' '[A-Z]')
ORG_RKCHIP=$RKCHIP
JOB=`sed -n "N;/processor/p" /proc/cpuinfo|wc -l`
SUPPORT_LIST=`ls configs/*-[r,p][x,v,k][0-9][0-9]*_defconfig`
@ -20,6 +18,9 @@ TOOLCHAIN_ARM32=../prebuilts/gcc/linux-x86/arm/gcc-linaro-6.3.1-2017.05-x86_64_a
TOOLCHAIN_ARM64=../prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin
########################################### User not touch #############################################
# Declare global INI file searching index name for every chip, update in fixup_platform_configure()
RKCHIP=
# Declare global rkbin RKTOOLS and rkbin repository path, updated in prepare()
RKTOOLS=
RKBIN=
@ -42,7 +43,7 @@ PLATFORM_AARCH32=
prepare()
{
local absolute_path cmd count
local absolute_path cmd
# Assign output directory
cmd=${SUBCMD%=*}
@ -73,23 +74,6 @@ prepare()
exit 1
fi
# Get RKCHIP from exist .config file
if [ "$RKCHIP" = '' ]; then
count=`grep -c '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config`
RKCHIP=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config`
if [ $count -gt 1 ]; then
echo "Find $count SoC in .config file:"
echo "$RKCHIP"
echo
echo "I'm confused, please compile with [board], like: ./make.sh [board]"
exit 1
else
RKCHIP=${RKCHIP%=*}
RKCHIP=${RKCHIP##*_}
ORG_RKCHIP=$RKCHIP
fi
fi
# Initialize RKBIN and RKTOOLS
if [ -d ${RKBIN_TOOLS} ]; then
absolute_path=$(cd `dirname ${RKBIN_TOOLS}`; pwd)
@ -183,9 +167,29 @@ sub_commands()
# 4. fixup ARM64 cpu boot with AArch32
fixup_platform_configure()
{
# <1> Fixup chip name for searching trust/loader ini files
if [ "$RKCHIP" = 'RK3228' -o "$RKCHIP" = 'RK3229' ]; then
RKCHIP=RK322X
local count plat
# <1> Get RKCHIP for searching trust/loader ini files
count=`grep -c '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config`
RKCHIP=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config`
if [ $count -eq 1 ]; then
RKCHIP=${RKCHIP%=*}
RKCHIP=${RKCHIP##*_}
elif [ $count -gt 1 ]; then
# Is RK3126 ?
plat=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config | sed -n "/CONFIG_ROCKCHIP_RK3126=y/p"`
if [ "$plat" = 'CONFIG_ROCKCHIP_RK3126=y' ]; then
RKCHIP=RK3126
fi
# Is RK3326 ?
plat=`grep '^CONFIG_ROCKCHIP_[R,P][X,V,K][0-9][0-9]' ${OUTDIR}/.config | sed -n "/CONFIG_ROCKCHIP_RK3326=y/p"`
if [ "$plat" = 'CONFIG_ROCKCHIP_RK3326=y' ]; then
RKCHIP=RK3326
fi
else
echo "Can't get Rockchip SoC definition in .config"
exit 1
fi
# <2> Fixup rsa/sha pack mode for platforms
@ -310,9 +314,9 @@ finish()
{
echo
if [ "$BOARD" = '' ]; then
echo "Platform ${ORG_RKCHIP}${PLATFORM_AARCH32} is build OK, with exist .config"
echo "Platform ${RKCHIP}${PLATFORM_AARCH32} is build OK, with exist .config"
else
echo "Platform ${ORG_RKCHIP}${PLATFORM_AARCH32} is build OK, with new .config(make ${BOARD}_defconfig)"
echo "Platform ${RKCHIP}${PLATFORM_AARCH32} is build OK, with new .config(make ${BOARD}_defconfig)"
fi
}