sdm660: Add wayne-common inherit support for extractor

Change-Id: I83ab37d6cd12aef4f6a8dc3822efc1856163e304
This commit is contained in:
Stylogey 2020-05-29 15:08:44 +02:00 committed by OdSazib
parent 0c78ca689f
commit b1bdd12940
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69
2 changed files with 53 additions and 42 deletions

View file

@ -21,12 +21,16 @@ DEVICE_COMMON=sdm660-common
VENDOR=xiaomi VENDOR=xiaomi
# Load extract_utils and do some sanity checks # Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}" COMMON_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi if [[ ! -d "$COMMON_DIR" ]]; then COMMON_DIR="$PWD"; fi
LINEAGE_ROOT="$MY_DIR"/../../.. if [[ -z "$DEVICE_DIR" ]]; then
DEVICE_DIR="${COMMON_DIR}/../${DEVICE}"
fi
HELPER="$LINEAGE_ROOT"/vendor/carbon/build/tools/extract_utils.sh ROOT="$COMMON_DIR"/../../..
HELPER="$ROOT"/vendor/carbon/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER" echo "Unable to find helper script at $HELPER"
exit 1 exit 1
@ -34,17 +38,17 @@ fi
. "$HELPER" . "$HELPER"
# Default to sanitizing the vendor folder before extraction # Default to sanitizing the vendor folder before extraction
clean_vendor=true CLEAN_VENDOR=true
ONLY_COMMON= ONLY_COMMON=false
ONLY_DEVICE= ONLY_DEVICE=false
while [ "${#}" -gt 0 ]; do while [ "${#}" -gt 0 ]; do
case "${1}" in case "${1}" in
-o | --only-common ) -o | --only-common )
ONLY_COMMON=false ONLY_COMMON=true
;; ;;
-d | --only-device ) -d | --only-device )
ONLY_DEVICE=false ONLY_DEVICE=true
;; ;;
-n | --no-cleanup ) -n | --no-cleanup )
CLEAN_VENDOR=false CLEAN_VENDOR=false
@ -54,7 +58,6 @@ while [ "${#}" -gt 0 ]; do
;; ;;
-s | --section ) -s | --section )
SECTION="${2}"; shift SECTION="${2}"; shift
clean_vendor=false
CLEAN_VENDOR=false CLEAN_VENDOR=false
;; ;;
* ) * )
@ -91,18 +94,18 @@ function blob_fixup() {
} }
# Initialize the common helper # Initialize the common helper
setup_vendor "$DEVICE_COMMON" "$VENDOR" "$LINEAGE_ROOT" true $clean_vendor setup_vendor "$DEVICE_COMMON" "$VENDOR" "$ROOT" true $CLEAN_VENDOR
if [ -z "${ONLY_DEVICE}" ] && [ -s "${MY_DIR}/proprietary-files.txt" ]; then if [[ "$ONLY_DEVICE" = "false" ]] && [[ -s "${COMMON_DIR}"/proprietary-files.txt ]]; then
extract "$MY_DIR"/proprietary-files.txt "$SRC" \ extract "$COMMON_DIR"/proprietary-files.txt "$SRC" "${KANG}" --section "${SECTION}"
"${KANG}" --section "${SECTION}"
fi fi
if [[ "$ONLY_COMMON" = "false" ]] && [[ -s "${DEVICE_DIR}"/proprietary-files.txt ]]; then
if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then if [[ ! "$IS_COMMON" = "true" ]]; then
IS_COMMON=false
fi
# Reinitialize the helper for device # Reinitialize the helper for device
setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false "$CLEAN_VENDOR" setup_vendor "$DEVICE" "$VENDOR" "$ROOT" "$IS_COMMON" "$CLEAN_VENDOR"
extract "$MY_DIR"/../$DEVICE/proprietary-files.txt "$SRC" \ extract "${DEVICE_DIR}"/proprietary-files.txt "$SRC" "${KANG}" --section "${SECTION}"
"${KANG}" --section "${SECTION}"
fi fi
"$MY_DIR"/setup-makefiles.sh "$COMMON_DIR"/setup-makefiles.sh

View file

@ -18,17 +18,22 @@
set -e set -e
DEVICE_COMMON=sdm660-common DEVICE_COMMON=sdm660-common
GUARDED_DEVICES_COMMON="twolip jasmine_sprout wayne clover lavender platina jason whyred"
VENDOR=xiaomi VENDOR=xiaomi
INITIAL_COPYRIGHT_YEAR=2018 INITIAL_COPYRIGHT_YEAR=2018
# Load extract_utils and do some sanity checks # Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}" COMMON_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi if [[ ! -d "$COMMON_DIR" ]]; then COMMON_DIR="$PWD"; fi
LINEAGE_ROOT="$MY_DIR"/../../.. if [[ -z "$DEVICE_DIR" ]]; then
DEVICE_DIR="${COMMON_DIR}/../${DEVICE}"
fi
HELPER="$LINEAGE_ROOT"/vendor/carbon/build/tools/extract_utils.sh ROOT="$COMMON_DIR"/../../..
HELPER="$ROOT"/vendor/carbon/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER" echo "Unable to find helper script at $HELPER"
exit 1 exit 1
@ -36,27 +41,30 @@ fi
. "$HELPER" . "$HELPER"
# Initialize the common helper # Initialize the common helper
setup_vendor "$DEVICE_COMMON" "$VENDOR" "$LINEAGE_ROOT" true setup_vendor "$DEVICE_COMMON" "$VENDOR" "$ROOT" true
# Copyright headers and guards if ([[ "$ONLY_DEVICE" = "false" ]] || [[ -z "$ONLY_DEVICE" ]]) && [[ -s "${COMMON_DIR}"/proprietary-files.txt ]]; then
write_headers "twolip jasmine_sprout wayne clover lavender platina jason whyred" # Copyright headers and guards
write_headers "$GUARDED_DEVICES_COMMON"
write_makefiles "$MY_DIR"/proprietary-files.txt true # The common blobs
write_makefiles "$COMMON_DIR"/proprietary-files.txt true
# Finish # Finish
write_footers write_footers
fi
if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then if ([[ "$ONLY_COMMON" = "false" ]] || [[ -z "$ONLY_COMMON" ]]) && [[ -s "${DEVICE_DIR}"/proprietary-files.txt ]]; then
# Reinitialize the helper for device and write copyright headers and guards
DEVICE_COMMON="$DEVICE"
if [[ ! "$IS_COMMON" = "true" ]]; then
IS_COMMON=false
GUARDED_DEVICES=
fi
# Reinitialize the helper for device # Reinitialize the helper for device
INITIAL_COPYRIGHT_YEAR="$DEVICE_BRINGUP_YEAR" INITIAL_COPYRIGHT_YEAR="$DEVICE_BRINGUP_YEAR"
setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false setup_vendor "$DEVICE" "$VENDOR" "$ROOT" "$IS_COMMON" "$CLEAN_VENDOR"
# Copyright headers and guards # Copyright headers and guards
write_headers write_headers "$GUARDED_DEVICES"
# The standard device blobs # The standard device blobs
write_makefiles "$MY_DIR"/../$DEVICE/proprietary-files.txt true write_makefiles "${DEVICE_DIR}"/proprietary-files.txt true
# We are done! # We are done!
write_footers write_footers
fi fi