build.config: Add build config files for Pineapple target
Add msm.common and msm.gki build configs for the Pineapple target. Change-Id: I42f0d0911f6cda6d8d3fbae4dfab1f899341b25c Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
This commit is contained in:
parent
7db19373de
commit
c8b78ab025
239
build.config.msm.common
Normal file
239
build.config.msm.common
Normal file
@ -0,0 +1,239 @@
|
||||
# The following additional environment variables are considered when build.config.msm.common is
|
||||
# included:
|
||||
#
|
||||
# DT_OVERLAY_SUPPORT
|
||||
# If set, then create a dtbo.img
|
||||
# BUILD_VENDOR_DLKM
|
||||
# If set, then enables creation of vendor_dlkm.img using all modules
|
||||
# not part of the first-stage ramdisk
|
||||
# EXTRA_CONFIGS
|
||||
# All files in this list are sourced
|
||||
|
||||
CONFIG_DIR=arch/${ARCH}/configs
|
||||
|
||||
BRANCH=msm-kernel
|
||||
CONFIG_TARGET=msm.${MSM_ARCH}
|
||||
|
||||
################################################################################
|
||||
##
|
||||
function compile_external_dtc() {
|
||||
(
|
||||
OUT_DIR=${COMMON_OUT_DIR}/external/dtc
|
||||
[ "${SKIP_MRPROPER}" != "1" ] && rm -rf ${OUT_DIR}
|
||||
cd ${ROOT_DIR}/external/dtc
|
||||
DTC_MAKE_ARGS=("CC=${HOSTCC}" "AR=${AR}")
|
||||
DTC_MAKE_ARGS+=("LDFLAGS=${HOSTLDFLAGS} -fuse-ld=${LD##*.} --rtlib=compiler-rt")
|
||||
DTC_MAKE_ARGS+=("EXTRA_CFLAGS=${HOSTCFLAGS}")
|
||||
# PKG_CONFIG would pull from host environment to determine if libyaml and libpython are
|
||||
# available. We want a hermetic build that doesn't rely on host tools, so make dtc build think
|
||||
# none of these libraries are installed.
|
||||
DTC_MAKE_ARGS+=("PKG_CONFIG=false")
|
||||
make all install "${DTC_MAKE_ARGS[@]}" NO_PYTHON=1 PREFIX=${COMMON_OUT_DIR}/host
|
||||
)
|
||||
}
|
||||
append_cmd PRE_DEFCONFIG_CMDS 'compile_external_dtc'
|
||||
|
||||
################################################################################
|
||||
## DTB general support
|
||||
DTB_DIR=vendor/qcom
|
||||
DTC_OVERLAY_TEST_EXT=ufdt_apply_overlay
|
||||
# Force /__symbols__ generation for all DTB[O]s
|
||||
DTC_FLAGS="-@"
|
||||
MAKE_GOALS+=" dtbs"
|
||||
|
||||
function install_dtbs() {
|
||||
local INSTALL_DTBS_PATH="${COMMON_OUT_DIR}/dtb_staging"
|
||||
local dtb_types="${MSM_ARCH}-"
|
||||
if [ "${DT_OVERLAY_SUPPORT}" -eq "1" ]; then
|
||||
dtb_types="${dtb_types}overlays-"
|
||||
fi
|
||||
# Staging directory required because arch/$ARCH/arm64/boot/dts/**/*.dtb structure copied and
|
||||
# we want a flat directory with all the DTBs.
|
||||
rm -rf "${INSTALL_DTBS_PATH}"
|
||||
(cd ${KERNEL_DIR} && make "${TOOL_ARGS[@]}" O=${OUT_DIR} "${MAKE_ARGS[@]}" INSTALL_DTBS_PATH="${INSTALL_DTBS_PATH}" DTB_TYPES="${dtb_types}" dtbs_install)
|
||||
cp $(find ${INSTALL_DTBS_PATH} -type f \( -name "*.dtb" -o -name "*.dtbo" \)) ${DIST_DIR}
|
||||
}
|
||||
append_cmd DIST_CMDS 'install_dtbs'
|
||||
ADDITIONAL_HOST_TOOLS+=" install" # for scripts/Makefile.dtbinst
|
||||
|
||||
FILES+="
|
||||
.config
|
||||
Module.symvers
|
||||
"
|
||||
|
||||
################################################################################
|
||||
## Variant Selection
|
||||
if [ -z "${VARIANT}" ] || [ "${VARIANT}" == "default" ]; then
|
||||
VARIANT="${VARIANTS[0]}"
|
||||
fi
|
||||
|
||||
if [ ! -z $MSM_ARCH ]; then
|
||||
BRANCH+=-${MSM_ARCH}
|
||||
fi
|
||||
|
||||
if [ ! -z $VARIANT ]; then
|
||||
BRANCH+=-${VARIANT}
|
||||
fi
|
||||
|
||||
if ( for v in "${VARIANTS[@]}"; do if [ "${v}" = "${VARIANT}" ]; then exit 1; fi; done; exit 0 ) ; then
|
||||
echo "Unsupported variant '${VARIANT}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## defconfigs
|
||||
|
||||
# Helper function to let build.config files merge config fragments
|
||||
# Usage: append_cmd PRE_DEFCONFIG_CMDS 'merge_defconfig_fragment ${DEFCONFIG} ${fragment_config}'
|
||||
DEFCONFIG_FRAGMENTS=""
|
||||
function merge_defconfig_fragments() {
|
||||
if ( [ -z "${DEFCONFIG_FRAGMENTS}" ] ||
|
||||
[ "${DEFCONFIG_FRAGMENTS}" = "${DEFCONFIG}" ] ); then
|
||||
echo "No defconfig fragments for ${DEFCONFIG}"
|
||||
return
|
||||
fi
|
||||
local output=$(mktemp)
|
||||
KCONFIG_CONFIG=${KERNEL_DIR}/arch/${ARCH}/configs/${DEFCONFIG} \
|
||||
${KERNEL_DIR}/scripts/kconfig/merge_config.sh \
|
||||
-m -r -y ${DEFCONFIG_FRAGMENTS} | tee $output
|
||||
set +x
|
||||
if grep -q -E -e "Previous value: [^=]+=[ym]" $output; then
|
||||
echo "========================================================"
|
||||
echo "ERROR! Detected overridden config!"
|
||||
grep -C 1 -E -e "Previous value: [^=]+=[ym]" $output >&2
|
||||
rm $output
|
||||
exit 1
|
||||
fi
|
||||
local temp_config=$(mktemp)
|
||||
(cd ${KERNEL_DIR} && KCONFIG_CONFIG=${temp_config} make "${TOOL_ARGS[@]}" O=${OUT_DIR} "${MAKE_ARGS[@]}" ${DEFCONFIG}) 2>&1 | tee $output
|
||||
if grep -q -e "warning:" $output; then
|
||||
echo "========================================================"
|
||||
echo "ERROR! Treating config warnings as errors"
|
||||
grep -e "warning" $output >&2
|
||||
rm $output $temp_config
|
||||
exit 1
|
||||
fi
|
||||
rm $output $temp_config
|
||||
set -x
|
||||
|
||||
}
|
||||
append_cmd PRE_DEFCONFIG_CMDS "merge_defconfig_fragments"
|
||||
|
||||
function check_merged_defconfig() {
|
||||
if ( [ -z "${DEFCONFIG_FRAGMENTS}" ] ||
|
||||
[ "${DEFCONFIG_FRAGMENTS}" = "${DEFCONFIG}" ] ); then
|
||||
return
|
||||
fi
|
||||
local output=$(mktemp)
|
||||
${KERNEL_DIR}/scripts/diffconfig "${KERNEL_DIR}/arch/${ARCH}/configs/${DEFCONFIG}" ${OUT_DIR}/.config > $output
|
||||
set +x
|
||||
# Allow CONFIG_CMDLINE changes
|
||||
if grep -q -v -E -e "^\+" -e "^CMDLINE " $output; then
|
||||
echo "========================================================"
|
||||
echo "ERROR! Defconfig fragment did not apply as expected"
|
||||
grep -v -E -e "^\+" -e "^CMDLINE " $output
|
||||
rm $output
|
||||
exit 1
|
||||
fi
|
||||
rm $output
|
||||
set -x
|
||||
}
|
||||
append_cmd POST_DEFCONFIG_CMDS "check_merged_defconfig"
|
||||
|
||||
# Wrapper function around merge_defconfig_fragment to reduce repeated logic
|
||||
# Usage: apply_defconfig_fragment ${KERNEL_DIR}/cuttlefish.fragment cuttlefish-gki_defconfig
|
||||
function apply_defconfig_fragment() {
|
||||
FRAGMENT_CONFIG=$1
|
||||
if [ -z "${DEFCONFIG_FRAGMENTS}" ]; then
|
||||
DEFCONFIG_FRAGMENTS="${KERNEL_DIR}/arch/${ARCH}/configs/${DEFCONFIG}"
|
||||
fi
|
||||
DEFCONFIG_FRAGMENTS="${DEFCONFIG_FRAGMENTS} $1"
|
||||
DEFCONFIG="${2:-${DEFCONFIG}}"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## DLKMs
|
||||
if [ -e "${KERNEL_DIR}/modules.list.${CONFIG_TARGET}" ]; then
|
||||
MODULES_LIST=${KERNEL_DIR}/modules.list.${CONFIG_TARGET}
|
||||
fi
|
||||
if [ -e "${KERNEL_DIR}/modules.blocklist.${CONFIG_TARGET}" ]; then
|
||||
MODULES_BLOCKLIST="${KERNEL_DIR}/modules.blocklist.${CONFIG_TARGET}"
|
||||
VENDOR_DLKM_MODULES_BLOCKLIST="${KERNEL_DIR}/modules.blocklist.${CONFIG_TARGET}"
|
||||
fi
|
||||
|
||||
function prepare_vendor_dlkm() {
|
||||
if [ -z "${VENDOR_DLKM_MODULES_LIST}" ]; then
|
||||
local module_list_flag=
|
||||
if [ -e "${MODULES_LIST}" ]; then
|
||||
module_list_flag="-f ${MODULES_LIST}"
|
||||
else
|
||||
module_list_flag="-e ''"
|
||||
fi
|
||||
(cd "${MODULES_STAGING_DIR}/lib/modules/" && find -type f -name "*.ko" -printf "%f\n") | \
|
||||
grep -w -v ${module_list_flag} - > ${MODULES_STAGING_DIR}/vendor_dlkm.modules.load
|
||||
|
||||
VENDOR_DLKM_MODULES_LIST="${MODULES_STAGING_DIR}/vendor_dlkm.modules.load"
|
||||
fi
|
||||
|
||||
SUPER_IMAGE_CONTENTS+="${DIST_DIR}/vendor_dlkm.img"
|
||||
}
|
||||
if [ "${BUILD_VENDOR_DLKM}" == "1" ]; then
|
||||
append_cmd DIST_CMDS 'prepare_vendor_dlkm'
|
||||
if [ -e "${KERNEL_DIR}/modules.vendor_blocklist.${CONFIG_TARGET}" ]; then
|
||||
VENDOR_DLKM_MODULES_BLOCKLIST="${KERNEL_DIR}/modules.vendor_blocklist.${CONFIG_TARGET}"
|
||||
fi
|
||||
fi
|
||||
|
||||
KERNEL_BINARY=Image
|
||||
|
||||
################################################################################
|
||||
## DT Overlay
|
||||
LIBUFDT_PREBUILTS_BIN=tools/libufdt/utils/src
|
||||
function make_dtbo_img() {
|
||||
mkdir -p ${DIST_DIR}/
|
||||
mkdtboimg.py create ${DIST_DIR}/dtbo.img --page_size=${PAGE_SIZE} ${DIST_DIR}/*.dtbo
|
||||
}
|
||||
if [ ! -z $DT_OVERLAY_SUPPORT ] && [ ! $DT_OVERLAY_SUPPORT -eq "0" ]; then
|
||||
append_cmd DIST_CMDS 'make_dtbo_img'
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## Cating all the DTBs and create a dtb.img
|
||||
function make_dtb_img() {
|
||||
mkdir -p ${DIST_DIR}/
|
||||
mkdtboimg.py create ${DIST_DIR}/${MSM_ARCH}-dtb.img --page_size=${PAGE_SIZE} ${DIST_DIR}/*.dtb
|
||||
}
|
||||
if [ ! -z $DTB_IMG_CREATE ] && [ ! $DTB_IMG_CREATE -eq "0" ]; then
|
||||
append_cmd DIST_CMDS 'make_dtb_img'
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## Miscellaneous
|
||||
if [ -n "${EXTRA_CONFIGS}" ]; then
|
||||
for extra_config in "${EXTRA_CONFIGS}"
|
||||
do
|
||||
. ${extra_config}
|
||||
done
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
## Copy prebuilt files to ${COMMON_OUT_DIR}/host/bin to be used by CI tools
|
||||
DIST_BINS="""
|
||||
build/android/merge_dtbs.py
|
||||
build/build-tools/path/linux-x86/ufdt_apply_overlay
|
||||
"""
|
||||
function copy_dist_bins() (
|
||||
set +x
|
||||
set -e
|
||||
mkdir -p ${COMMON_OUT_DIR}/host/bin
|
||||
echo "Copying binaries to host/bin"
|
||||
for FILE in $(ls -1 ${DIST_BINS}); do
|
||||
if [ -f ${ROOT_DIR}/${FILE} ]; then
|
||||
echo " $FILE"
|
||||
cp -p ${ROOT_DIR}/${FILE} ${COMMON_OUT_DIR}/host/bin/
|
||||
else
|
||||
echo " $FILE is not a file, skipping"
|
||||
fi
|
||||
done
|
||||
)
|
||||
append_cmd DIST_CMDS 'copy_dist_bins'
|
45
build.config.msm.gki
Normal file
45
build.config.msm.gki
Normal file
@ -0,0 +1,45 @@
|
||||
################################################################################
|
||||
# Common MSM configuration for building GKI-based kernels
|
||||
DEFCONFIG="gki_defconfig"
|
||||
|
||||
# Configuration options to build images for MSM targets
|
||||
# Must be included AFTER build.config.msm.<target>
|
||||
|
||||
# boot image macros
|
||||
BUILD_BOOT_IMG=1
|
||||
BUILD_INITRAMFS=1
|
||||
|
||||
ABI_DEFINITION=android/abi_gki_aarch64.xml
|
||||
KMI_SYMBOL_LIST=android/abi_gki_aarch64_qcom
|
||||
KMI_SYMBOL_LIST_MODULE_GROUPING=0
|
||||
KMI_SYMBOL_LIST_ADD_ONLY=1
|
||||
KMI_ENFORCED=1
|
||||
|
||||
MAKE_GOALS="modules dtbs"
|
||||
GKI_BUILD_CONFIG=common/build.config.gki.aarch64
|
||||
GKI_TRIM_NONLISTED_KMI=0
|
||||
GKI_KMI_SYMBOL_LIST_STRICT_MODE=0
|
||||
GKI_SKIP_IF_VERSION_MATCHES=1
|
||||
GKI_SKIP_CP_KERNEL_HDR=1
|
||||
|
||||
function build_defconfig_fragments() {
|
||||
if [[ "${VARIANT}" =~ ^(gki|consolidate)$ ]]; then
|
||||
apply_defconfig_fragment ${KERNEL_DIR}/arch/${ARCH}/configs/vendor/${MSM_ARCH}_GKI.config vendor/${MSM_ARCH}-gki_defconfig
|
||||
if [ "${VARIANT}" = gki ]; then
|
||||
return
|
||||
fi
|
||||
GKI_BUILD_CONFIG=common/build.config.gki-debug.aarch64
|
||||
GKI_GKI_BUILD_CONFIG_FRAGMENT=msm-kernel/build.config.gki_consolidate.aarch64
|
||||
# ABI comparison isn't applicable on consolidate variant
|
||||
unset ABI_DEFINITION
|
||||
apply_defconfig_fragment ${KERNEL_DIR}/arch/${ARCH}/configs/consolidate.fragment consolidate_defconfig
|
||||
apply_defconfig_fragment ${KERNEL_DIR}/arch/${ARCH}/configs/vendor/${MSM_ARCH}_consolidate.config vendor/${MSM_ARCH}-consolidate_defconfig
|
||||
elif [ "${VARIANT}" = gki-ack ]; then
|
||||
# In gki-only, then using ACK's GKI config directly
|
||||
. ${KERNEL_DIR}/build.config.gki
|
||||
else
|
||||
echo "Variant '${VARIANT}' unsupported by gki"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
build_defconfig_fragments
|
Loading…
Reference in New Issue
Block a user