redfin: Sync extract scripts with templates

Change-Id: I83561b9064f7f27af90e21ac72a9c76e1dad8fad
This commit is contained in:
Michael Bestas
2024-08-28 10:36:32 +03:00
parent eb15efd9f9
commit 976d3aa4e5
7 changed files with 1548 additions and 1632 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
#
@@ -17,6 +16,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}"
@@ -27,24 +30,31 @@ source "${HELPER}"
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
ONLY_FIRMWARE=
KANG=
SECTION=
CARRIER_SKIP_FILES=()
VENDOR_SKIP_FILES=()
while [ "${#}" -gt 0 ]; do
case "${1}" in
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
-k | --kang )
KANG="--kang"
;;
-s | --section )
SECTION="${2}"; shift
CLEAN_VENDOR=false
;;
* )
SRC="${1}"
;;
--only-firmware)
ONLY_FIRMWARE=true
;;
-n | --no-cleanup)
CLEAN_VENDOR=false
;;
-k | --kang)
KANG="--kang"
;;
-s | --section)
SECTION="${2}"
shift
CLEAN_VENDOR=false
;;
*)
SRC="${1}"
;;
esac
shift
done
@@ -55,14 +65,24 @@ fi
function blob_fixup() {
case "${1}" in
product/etc/felica/common.cfg)
sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}"
;;
# Fix typo in qcrilmsgtunnel whitelist
product/etc/sysconfig/nexus.xml)
sed -i 's/qulacomm/qualcomm/' "${2}"
;;
product/etc/felica/common.cfg)
[ "$2" = "" ] && return 0
sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}"
;;
# Fix typo in qcrilmsgtunnel whitelist
product/etc/sysconfig/nexus.xml)
sed -i 's/qulacomm/qualcomm/' "${2}"
;;
*)
return 1
;;
esac
return 0
}
function blob_fixup_dry() {
blob_fixup "$1" ""
}
function prepare_firmware() {
@@ -74,9 +94,37 @@ function prepare_firmware() {
# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}"
extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}"
if [ -z "${ONLY_FIRMWARE}" ]; then
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
generate_prop_list_from_image "product.img" "${MY_DIR}/proprietary-files-carriersettings.txt" CARRIER_SKIP_FILES carriersettings
extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}"
readarray -t VENDOR_SKIP_FILES < <(cat "${MY_DIR}/skip-files-vendor.txt" | sed -E "/^[[:blank:]]*(#|$)/d")
VENDOR_TXT="${MY_DIR}/proprietary-files-vendor.txt"
generate_prop_list_from_image "vendor.img" "${VENDOR_TXT}" VENDOR_SKIP_FILES
set_presigned "vendor/app/adreno_graphics_driver/adreno_graphics_driver.apk" "${VENDOR_TXT}"
set_required "vendor/app/CneApp/CneApp.apk" "CneApp.libvndfwk_detect_jni.qti_symlink" "${VENDOR_TXT}"
set_symlink "vendor/lib/egl/libEGL_adreno.so" "vendor/lib/libEGL_adreno.so" "${VENDOR_TXT}"
set_symlink "vendor/lib/egl/libGLESv2_adreno.so" "vendor/lib/libGLESv2_adreno.so" "${VENDOR_TXT}"
set_symlink "vendor/lib/egl/libq3dtools_adreno.so" "vendor/lib/libq3dtools_adreno.so" "${VENDOR_TXT}"
set_symlink "vendor/lib64/egl/libEGL_adreno.so" "vendor/lib64/libEGL_adreno.so" "${VENDOR_TXT}"
set_symlink "vendor/lib64/egl/libGLESv2_adreno.so" "vendor/lib64/libGLESv2_adreno.so" "${VENDOR_TXT}"
set_symlink "vendor/lib64/egl/libq3dtools_adreno.so" "vendor/lib64/libq3dtools_adreno.so" "${VENDOR_TXT}"
set_as_module "vendor/lib/libadsprpc.so" "${VENDOR_TXT}"
set_as_module "vendor/lib/libfastcvopt.so" "${VENDOR_TXT}"
set_as_module "vendor/lib/libMpeg4SwEncoder.so" "${VENDOR_TXT}"
set_as_module "vendor/lib64/libadsprpc.so" "${VENDOR_TXT}"
set_as_module "vendor/lib64/libfastcvopt.so" "${VENDOR_TXT}"
set_as_module "vendor/lib64/libMpeg4SwEncoder.so" "${VENDOR_TXT}"
set_as_module "vendor/lib64/libthermalclient.so" "${VENDOR_TXT}"
extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi
if [ -z "${SECTION}" ]; then
extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}"

View File

@@ -1,4 +1,4 @@
# All blobs are extracted from Google factory images for each new ASB
# All blobs below are extracted from the release mentioned in proprietary-files.txt
product/etc/CarrierSettings/1and1_de.pb
product/etc/CarrierSettings/2degrees_nz.pb
product/etc/CarrierSettings/a1_at.pb

View File

@@ -1,4 +1,4 @@
# All blobs are extracted from Google factory images for each new ASB
# All blobs below are extracted from the release mentioned in proprietary-files.txt
vendor/app/CACertService/CACertService.apk
vendor/app/CneApp/CneApp.apk;REQUIRED=CneApp.libvndfwk_detect_jni.qti_symlink
vendor/app/IWlanService/IWlanService.apk

View File

@@ -1,47 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2019-2023 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
ANDROID_ROOT="${MY_DIR}/../../.."
HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"
_input_image="${1}"
_output_file="${2}"
if [ -z "${_input_image}" ]; then
echo "No input image supplied"
exit 1
fi
if [ -z "${_output_file}" ]; then
echo "No output filename supplied"
exit 1
fi
CARRIER_SKIP_FILES=()
# Initialize the helper
setup_vendor_deps "${ANDROID_ROOT}"
generate_prop_list_from_image "${_input_image}" "${_output_file}" CARRIER_SKIP_FILES carriersettings
function header() {
sed -i "1s/^/${1}\n/" "${_output_file}"
}
header "# All blobs are extracted from Google factory images for each new ASB"

File diff suppressed because it is too large Load Diff

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
#

1470
skip-files-vendor.txt Normal file

File diff suppressed because it is too large Load Diff