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
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 The CyanogenMod Project
|
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||||
# Copyright (C) 2017-2020 The LineageOS Project
|
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -14,6 +13,10 @@ if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
|
|||||||
|
|
||||||
ANDROID_ROOT="${MY_DIR}/../../.."
|
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"
|
HELPER="${ANDROID_ROOT}/tools/extract-utils/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}"
|
||||||
@ -25,31 +28,36 @@ source "${HELPER}"
|
|||||||
CLEAN_VENDOR=true
|
CLEAN_VENDOR=true
|
||||||
|
|
||||||
ONLY_COMMON=
|
ONLY_COMMON=
|
||||||
|
ONLY_FIRMWARE=
|
||||||
ONLY_TARGET=
|
ONLY_TARGET=
|
||||||
KANG=
|
KANG=
|
||||||
SECTION=
|
SECTION=
|
||||||
|
|
||||||
while [ "${#}" -gt 0 ]; do
|
while [ "${#}" -gt 0 ]; do
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
--only-common )
|
--only-common)
|
||||||
ONLY_COMMON=true
|
ONLY_COMMON=true
|
||||||
;;
|
;;
|
||||||
--only-target )
|
--only-firmware)
|
||||||
ONLY_TARGET=true
|
ONLY_FIRMWARE=true
|
||||||
;;
|
;;
|
||||||
-n | --no-cleanup )
|
--only-target)
|
||||||
CLEAN_VENDOR=false
|
ONLY_TARGET=true
|
||||||
;;
|
;;
|
||||||
-k | --kang )
|
-n | --no-cleanup)
|
||||||
KANG="--kang"
|
CLEAN_VENDOR=false
|
||||||
;;
|
;;
|
||||||
-s | --section )
|
-k | --kang)
|
||||||
SECTION="${2}"; shift
|
KANG="--kang"
|
||||||
CLEAN_VENDOR=false
|
;;
|
||||||
;;
|
-s | --section)
|
||||||
* )
|
SECTION="${2}"
|
||||||
SRC="${1}"
|
shift
|
||||||
;;
|
CLEAN_VENDOR=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
SRC="${1}"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
@ -60,22 +68,37 @@ fi
|
|||||||
|
|
||||||
function blob_fixup() {
|
function blob_fixup() {
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
|
*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
esac
|
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
|
# 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}"
|
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||||
fi
|
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
|
# 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}"
|
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
|
fi
|
||||||
|
|
||||||
"${MY_DIR}/setup-makefiles.sh"
|
"${MY_DIR}/setup-makefiles.sh"
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016 The CyanogenMod Project
|
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||||
# Copyright (C) 2017-2020 The LineageOS Project
|
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -22,26 +21,31 @@ fi
|
|||||||
source "${HELPER}"
|
source "${HELPER}"
|
||||||
|
|
||||||
# Initialize the helper for common
|
# 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
|
# Warning headers and guards
|
||||||
write_headers "courbet davinci phoenix surya sweet toco violet"
|
write_headers "courbet davinci phoenix surya sweet toco violet"
|
||||||
|
|
||||||
# The standard common blobs
|
# The standard common blobs
|
||||||
write_makefiles "${MY_DIR}/proprietary-files.txt" true
|
write_makefiles "${MY_DIR}/proprietary-files.txt"
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
write_footers
|
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
|
# Reinitialize the helper for device
|
||||||
|
source "${MY_DIR}/../../${VENDOR}/${DEVICE}/setup-makefiles.sh"
|
||||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
|
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false
|
||||||
|
|
||||||
# Warning headers and guards
|
# Warning headers and guards
|
||||||
write_headers
|
write_headers
|
||||||
|
|
||||||
# The standard device blobs
|
# 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
|
# Finish
|
||||||
write_footers
|
write_footers
|
||||||
|
Loading…
Reference in New Issue
Block a user