2023-10-13 11:44:49 -07:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2016 The CyanogenMod Project
|
|
|
|
# Copyright (C) 2017-2020 The LineageOS Project
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-05-22 05:40:46 -07:00
|
|
|
DEVICE=LG8n
|
|
|
|
VENDOR=tecno
|
2023-10-13 11:44:49 -07:00
|
|
|
|
|
|
|
# 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}"
|
|
|
|
|
|
|
|
# Default to sanitizing the vendor folder before extraction
|
|
|
|
CLEAN_VENDOR=true
|
|
|
|
|
|
|
|
KANG=
|
|
|
|
SECTION=
|
|
|
|
|
|
|
|
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}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "${SRC}" ]; then
|
|
|
|
SRC="adb"
|
|
|
|
fi
|
|
|
|
|
2023-07-20 06:52:21 -07:00
|
|
|
function blob_fixup {
|
|
|
|
case "$1" in
|
2024-07-16 16:15:14 -07:00
|
|
|
vendor/bin/hw/android.hardware.vibrator-service.mediatek)
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.vibrator-V2-ndk_platform.so" "android.hardware.vibrator-V2-ndk.so" "$2"
|
|
|
|
;;
|
2024-07-16 16:16:56 -07:00
|
|
|
vendor/bin/hw/android.hardware.lights-service.mediatek)
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.light-V1-ndk_platform.so" "android.hardware.light-V1-ndk.so" "$2"
|
|
|
|
;;
|
2024-07-16 23:15:55 -07:00
|
|
|
vendor/lib*/libspeech_enh_lib.so|\
|
|
|
|
vendor/lib64/libwifi-hal-mtk.so|\
|
|
|
|
vendor/lib*/hw/power.mt6789.so|\
|
|
|
|
vendor/lib*/hw/sound_trigger.primary.mt6789.so|\
|
|
|
|
vendor/lib64/libnir_neon_driver_ndk.mtk.vndk.so)
|
|
|
|
"${PATCHELF}" --set-soname "$(basename "${1}")" "${2}"
|
|
|
|
;;
|
2024-07-16 16:28:11 -07:00
|
|
|
vendor/lib64/hw/audio.primary.mt6789.so)
|
|
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
|
|
|
;;
|
2024-07-16 16:25:30 -07:00
|
|
|
vendor/bin/hw/mt6789/camerahalserver)
|
|
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
2024-07-16 16:26:05 -07:00
|
|
|
"${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}"
|
|
|
|
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
|
2024-07-16 16:25:30 -07:00
|
|
|
;;
|
2024-07-16 17:27:20 -07:00
|
|
|
lib64/libsink.so)
|
|
|
|
"${PATCHELF}" --add-needed "libshim_sink.so" "$2"
|
|
|
|
;;
|
2023-07-24 03:08:23 -07:00
|
|
|
vendor/bin/hw/android.hardware.gnss-service.mediatek |\
|
|
|
|
vendor/lib64/hw/android.hardware.gnss-impl-mediatek.so)
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.gnss-V1-ndk_platform.so" "android.hardware.gnss-V1-ndk.so" "$2"
|
|
|
|
;;
|
2024-07-16 17:00:21 -07:00
|
|
|
vendor/etc/init/android.hardware.media.c2@1.2-mediatek.rc)
|
|
|
|
sed -i 's/@1.2-mediatek/@1.2-mediatek-64b/g' "${2}"
|
|
|
|
;;
|
2024-07-16 17:06:27 -07:00
|
|
|
vendor/bin/hw/android.hardware.media.c2@1.2-mediatek-64b)
|
|
|
|
"${PATCHELF}" --replace-needed "libavservices_minijail_vendor.so" "libavservices_minijail.so" "${2}"
|
|
|
|
;;
|
2024-07-16 17:07:12 -07:00
|
|
|
vendor/etc/init/android.hardware.neuralnetworks-shim-service-mtk.rc)
|
|
|
|
sed -i 's/start/enable/' "$2"
|
|
|
|
;;
|
2023-07-20 06:52:21 -07:00
|
|
|
vendor/lib*/hw/mt6789/vendor.mediatek.hardware.pq@2.15-impl.so)
|
|
|
|
"$PATCHELF" --replace-needed "libutils.so" "libutils-v32.so" "$2"
|
|
|
|
;;
|
2024-07-16 16:46:45 -07:00
|
|
|
vendor/bin/hw/vendor.mediatek.hardware.pq@2.2-service)
|
|
|
|
"${PATCHELF}" --replace-needed "libbinder.so" "libbinder-v31.so" "${2}"
|
|
|
|
"${PATCHELF}" --replace-needed "libhidlbase.so" "libhidlbase-v31.so" "${2}"
|
|
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v31.so" "${2}"
|
|
|
|
;;
|
2024-04-16 23:12:47 -07:00
|
|
|
vendor/bin/hw/vendor.mediatek.hardware.mtkpower@1.0-service)
|
|
|
|
"${PATCHELF}" --replace-needed "android.hardware.power-V2-ndk_platform.so" "android.hardware.power-V2-ndk.so" "${2}"
|
2024-07-25 07:59:32 -07:00
|
|
|
;;
|
2024-07-16 23:35:13 -07:00
|
|
|
vendor/lib*/hw/android.hardware.thermal@2.0-impl.so)
|
|
|
|
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
|
|
|
|
;;
|
2024-07-25 07:59:32 -07:00
|
|
|
vendor/bin/hw/android.hardware.security.keymint-service.trustonic)
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.security.keymint-V1-ndk_platform.so" "android.hardware.security.keymint-V1-ndk.so" "$2"
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.security.secureclock-V1-ndk_platform.so" "android.hardware.security.secureclock-V1-ndk.so" "$2"
|
|
|
|
"$PATCHELF" --replace-needed "android.hardware.security.sharedsecret-V1-ndk_platform.so" "android.hardware.security.sharedsecret-V1-ndk.so" "$2"
|
|
|
|
;;
|
2023-07-20 06:52:21 -07:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2023-10-13 11:44:49 -07:00
|
|
|
# Initialize the helper
|
|
|
|
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
|
|
|
|
|
|
|
|
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
|
|
|
|
|
|
|
"${MY_DIR}/setup-makefiles.sh"
|