sm6150-common: Sync extract scripts with templates
Change-Id: I98a36854c5a0c0390592911bb2558b34eff77efc
This commit is contained in:
parent
e091c0a9a5
commit
190cfed1aa
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2016 The CyanogenMod Project
|
||||
# Copyright (C) 2017-2020 The LineageOS Project
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
@ -14,6 +13,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
|
||||
|
||||
ANDROID_ROOT="${MY_DIR}/../../.."
|
||||
|
||||
# If XML files don't have comments before the XML header, use this flag
|
||||
# Can still be used with broken XML files by using blob_fixup
|
||||
export TARGET_DISABLE_XML_FIXING=true
|
||||
|
||||
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
|
||||
if [ ! -f "${HELPER}" ]; then
|
||||
echo "Unable to find helper script at ${HELPER}"
|
||||
@ -25,29 +28,34 @@ source "${HELPER}"
|
||||
CLEAN_VENDOR=true
|
||||
|
||||
ONLY_COMMON=
|
||||
ONLY_FIRMWARE=
|
||||
ONLY_TARGET=
|
||||
KANG=
|
||||
SECTION=
|
||||
|
||||
while [ "${#}" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--only-common )
|
||||
--only-common)
|
||||
ONLY_COMMON=true
|
||||
;;
|
||||
--only-target )
|
||||
--only-firmware)
|
||||
ONLY_FIRMWARE=true
|
||||
;;
|
||||
--only-target)
|
||||
ONLY_TARGET=true
|
||||
;;
|
||||
-n | --no-cleanup )
|
||||
-n | --no-cleanup)
|
||||
CLEAN_VENDOR=false
|
||||
;;
|
||||
-k | --kang )
|
||||
-k | --kang)
|
||||
KANG="--kang"
|
||||
;;
|
||||
-s | --section )
|
||||
SECTION="${2}"; shift
|
||||
-s | --section)
|
||||
SECTION="${2}"
|
||||
shift
|
||||
CLEAN_VENDOR=false
|
||||
;;
|
||||
* )
|
||||
*)
|
||||
SRC="${1}"
|
||||
;;
|
||||
esac
|
||||
@ -60,22 +68,37 @@ fi
|
||||
|
||||
function blob_fixup() {
|
||||
case "${1}" in
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ -z "${ONLY_TARGET}" ]; then
|
||||
function blob_fixup_dry() {
|
||||
blob_fixup "$1" ""
|
||||
}
|
||||
|
||||
if [ -z "${ONLY_FIRMWARE}" ] && [ -z "${ONLY_TARGET}" ]; then
|
||||
# Initialize the helper for common device
|
||||
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
|
||||
setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
|
||||
|
||||
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
fi
|
||||
|
||||
if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
|
||||
if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
|
||||
# Reinitialize the helper for device
|
||||
source "${MY_DIR}/../${DEVICE}/extract-files.sh"
|
||||
source "${MY_DIR}/../../${VENDOR}/${DEVICE}/extract-files.sh"
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
|
||||
|
||||
extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
if [ -z "${ONLY_FIRMWARE}" ]; then
|
||||
extract "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
fi
|
||||
|
||||
if [ -z "${SECTION}" ] && [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
|
||||
extract_firmware "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" "${SRC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
"${MY_DIR}/setup-makefiles.sh"
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2016 The CyanogenMod Project
|
||||
# Copyright (C) 2017-2020 The LineageOS Project
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
@ -22,26 +21,31 @@ fi
|
||||
source "${HELPER}"
|
||||
|
||||
# Initialize the helper for common
|
||||
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true
|
||||
setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true
|
||||
|
||||
# Warning headers and guards
|
||||
write_headers "courbet davinci phoenix surya sweet toco violet"
|
||||
|
||||
# The standard common blobs
|
||||
write_makefiles "${MY_DIR}/proprietary-files.txt" true
|
||||
write_makefiles "${MY_DIR}/proprietary-files.txt"
|
||||
|
||||
# Finish
|
||||
write_footers
|
||||
|
||||
if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
|
||||
if [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then
|
||||
# Reinitialize the helper for device
|
||||
source "${MY_DIR}/../../${VENDOR}/${DEVICE}/setup-makefiles.sh"
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
|
||||
|
||||
# Warning headers and guards
|
||||
write_headers
|
||||
|
||||
# The standard device blobs
|
||||
write_makefiles "${MY_DIR}/../${DEVICE}/proprietary-files.txt" true
|
||||
write_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt"
|
||||
|
||||
if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
|
||||
append_firmware_calls_to_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt"
|
||||
fi
|
||||
|
||||
# Finish
|
||||
write_footers
|
||||
|
Loading…
Reference in New Issue
Block a user