sm8350-common: Sync extract scripts with templates

Change-Id: I98a36854c5a0c0390592911bb2558b34eff77efc
This commit is contained in:
Michael Bestas 2024-08-27 22:05:28 +03:00 committed by Arian
parent 3969a26b43
commit 33ad994764
2 changed files with 56 additions and 39 deletions

View File

@ -1,8 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2023 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}"
@ -48,7 +51,8 @@ while [ "${#}" -gt 0 ]; do
KANG="--kang"
;;
-s | --section)
SECTION="${2}"; shift
SECTION="${2}"
shift
CLEAN_VENDOR=false
;;
*)
@ -65,41 +69,54 @@ fi
function blob_fixup() {
case "${1}" in
system_ext/lib64/libwfdnative.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "android.hidl.base@1.0.so" "${2}"
;;
vendor/etc/media_lahaina/video_system_specs.json \
|vendor/etc/media_shima_v1/video_system_specs.json \
|vendor/etc/media_yupik_v1/video_system_specs.json)
[ "$2" = "" ] && return 0
sed -i "/max_retry_alloc_output_timeout/ s/10000/0/" "${2}"
;;
vendor/etc/vintf/manifest/c2_manifest_vendor.xml)
[ "$2" = "" ] && return 0
sed -ni '/ozoaudio/!p' "${2}"
sed -ni '/dolby/!p' "${2}"
;;
vendor/lib64/android.hardware.secure_element@1.0-impl.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "android.hidl.base@1.0.so" "${2}"
;;
*)
return 1
;;
esac
return 0
}
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}"
if [ -z "${ONLY_FIRMWARE}" ]; then
extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
extract "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi
if [ -f "${MY_DIR}/../${DEVICE}/proprietary-firmware.txt" ]; then
extract_firmware "${MY_DIR}/../${DEVICE}/proprietary-firmware.txt" "${SRC}"
if [ -z "${SECTION}" ] && [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then
extract_firmware "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" "${SRC}"
fi
fi

View File

@ -1,8 +1,7 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2023 The LineageOS Project
#
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
@ -22,7 +21,7 @@ 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 "haydn lisa mars odin redwood renoir star venus"
@ -33,18 +32,19 @@ write_makefiles "${MY_DIR}/proprietary-files.txt" true
# 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" true
if [ -f "${MY_DIR}/../${DEVICE}/proprietary-firmware.txt" ]; then
append_firmware_calls_to_makefiles "${MY_DIR}/../${DEVICE}/proprietary-firmware.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