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

View file

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