kernel/config: merge moto fragment configs

Kernel configs compose of several parts.These parts will be merged into
	one final file such as "holi-qgki-debug_defconfig".
    The rule of Moto-product-config files from high order is:
      product debug config
      platform debug config,
      product config
      platform config

    Here is an example of product "denver" based on 4350
    platform (holi):

    1. factory build config list with order:
    factory-holi-denver.config
    factory-holi.config
    moto-holi-denver.config
    moto-holi.config

    2. userdebug build config list with order:
    debug-holi-denver.config
    debug-holi.config
    moto-holi-denver.config
    moto-holi.config

    3. user version config list with order:
    moto-holi-denver.config
    moto-holi.config

Change-Id: Ie7512300581337ae6768bdfa618613a797f3c10f
Signed-off-by: weimh1 <weimh1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1769363
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
weimh1 2020-10-08 20:21:23 +08:00 • committed by Xiaojun Ji
commit dee1ae4006
9 changed files with 185 additions and 1 deletions

View file

@ -0,0 +1,78 @@
#!/bin/bash
# Copyright (c) 2020, Motorola. All rights reserved.
# Script to merge all Moto kernel config
usage() {
echo "Usage: $0 <input_platform_name> $1<required defconfig>"
echo "For example: $0 holi $1 qgki_defconfig"
echo "Note: The output is all valid moto kernel config files"
exit 1
}
if [ "$#" -ne 2 ]; then
echo "Error: Invalid number of arguments"
usage
fi
#echo "framgement_moto: TARGET_PRODUCT=${TARGET_PRODUCT} TARGET_BUILD_VARIANT=${TARGET_BUILD_VARIANT}"
TARGET_PRODUCT_NAME=${TARGET_PRODUCT%%_*}
TARGET_PRODUCT_TYPE=${TARGET_PRODUCT#*_}
LOCAL_PLATFORM_NAME=${1}
REQUIRED_DEFCONFIG=${2}
echo "moto framgement config: LOCAL_PLATFORM_NAME=${LOCAL_PLATFORM_NAME} TARGET_PRODUCT_NAME=$TARGET_PRODUCT_NAME TARGET_PRODUCT_TYPE=$TARGET_PRODUCT_TYPE"
#skip msi products
if [ $TARGET_PRODUCT_NAME == "msi" ]; then
echo "This is msi, skip moto config fragements"
exit 0
fi
MOTO_CONFIG_DIR=$CONFIGS_DIR/ext_config
export MOTO_REQUIRED_CONFIG=""
# merge factory config or userdebug config
if [ $TARGET_PRODUCT_TYPE == "factory" ]; then
if [ -e $MOTO_CONFIG_DIR/factory-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/factory-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config"
fi
if [ -e $MOTO_CONFIG_DIR/factory-${LOCAL_PLATFORM_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/factory-${LOCAL_PLATFORM_NAME}.config"
fi
elif [ $TARGET_BUILD_VARIANT == "userdebug" ] && [ $REQUIRED_DEFCONFIG != ${LOCAL_PLATFORM_NAME}-gki_defconfig ]; then
if [ -e $MOTO_CONFIG_DIR/debug-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/debug-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config"
fi
if [ -e $MOTO_CONFIG_DIR/debug-${LOCAL_PLATFORM_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/debug-${LOCAL_PLATFORM_NAME}.config"
fi
if [ -e $MOTO_CONFIG_DIR/${LOCAL_PLATFORM_NAME}_debug.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/${LOCAL_PLATFORM_NAME}_debug.config"
if [ -e $MOTO_CONFIG_DIR/${LOCAL_PLATFORM_NAME}_consolidate.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/${LOCAL_PLATFORM_NAME}_consolidate.config"
fi
fi
fi
#merge moto product config
if [ -e $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}-${TARGET_PRODUCT_NAME}.config"
fi
#merge moto platform config
if [ -e $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}.config"
fi
#merge moto platform config that depended on -QGKI.config
if [ $REQUIRED_DEFCONFIG != ${LOCAL_PLATFORM_NAME}-gki_defconfig ]; then
if [ -e $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}-depQGKI.config ]; then
MOTO_REQUIRED_CONFIG+=" $MOTO_CONFIG_DIR/moto-${LOCAL_PLATFORM_NAME}-depQGKI.config"
fi
fi
echo "require moto blend configs:$MOTO_REQUIRED_CONFIG"

View file

@ -55,6 +55,9 @@ fi
FINAL_DEFCONFIG_BLEND=""
source ${SCRIPTS_ROOT}/fragment_motoconfig.sh ${PLATFORM_NAME} ${REQUIRED_DEFCONFIG}
FINAL_DEFCONFIG_BLEND+=${MOTO_REQUIRED_CONFIG}
case "$REQUIRED_DEFCONFIG" in
${PLATFORM_NAME}-qgki-debug_defconfig )
FINAL_DEFCONFIG_BLEND+=" $QCOM_DEBUG_FRAG"