mirror of
https://github.com/Evolution-X-Devices/device_google_redfin
synced 2026-01-27 14:26:37 +00:00
redfin: switch to python extract-utils
Change-Id: Ia2d6a0235d9343d7de0ef69d4197cac7f276af84
This commit is contained in:
committed by
Michael Bestas
parent
01e9149ea6
commit
3a85247c27
13
extract-files.py
Executable file
13
extract-files.py
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
MY_DIR="$(cd "$(dirname "${0}")"; pwd -P)"
|
||||
|
||||
pushd "${MY_DIR}/redfin"
|
||||
./extract-files.py $@
|
||||
popd
|
||||
121
extract-files.sh
121
extract-files.sh
@@ -1,121 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
DEVICE=redfin
|
||||
VENDOR=google
|
||||
|
||||
# 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}/../../.."
|
||||
|
||||
export TARGET_ENABLE_CHECKELF=true
|
||||
|
||||
# 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}"
|
||||
exit 1
|
||||
fi
|
||||
source "${HELPER}"
|
||||
|
||||
# Default to sanitizing the vendor folder before extraction
|
||||
CLEAN_VENDOR=true
|
||||
|
||||
ONLY_FIRMWARE=
|
||||
KANG=
|
||||
SECTION=
|
||||
|
||||
while [ "${#}" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--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
|
||||
|
||||
if [ -z "${SRC}" ]; then
|
||||
SRC="adb"
|
||||
fi
|
||||
|
||||
function blob_fixup() {
|
||||
case "${1}" in
|
||||
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)
|
||||
[ "$2" = "" ] && return 0
|
||||
sed -i 's/qulacomm/qualcomm/' "${2}"
|
||||
;;
|
||||
system_ext/priv-app/HbmSVManager/HbmSVManager.apk)
|
||||
[ "$2" = "" ] && return 0
|
||||
apktool_patch "${2}" "${MY_DIR}/blob-patches/HbmSVManager.patch" -r
|
||||
;;
|
||||
vendor/bin/hw/android.hardware.rebootescrow-service.citadel | \
|
||||
vendor/lib64/android.hardware.keymaster@4.1-impl.nos.so)
|
||||
[ "$2" = "" ] && return 0
|
||||
"${PATCHELF}" --add-needed "libcrypto_shim.so" "${2}"
|
||||
;;
|
||||
vendor/lib64/libgooglecamerahal.so)
|
||||
[ "$2" = "" ] && return 0
|
||||
"${PATCHELF}" --add-needed "libmeminfo_shim.so" "${2}"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function blob_fixup_dry() {
|
||||
blob_fixup "$1" ""
|
||||
}
|
||||
|
||||
function prepare_firmware() {
|
||||
if [ "${SRC}" != "adb" ]; then
|
||||
bash "${ANDROID_ROOT}"/lineage/scripts/pixel/prepare-firmware.sh "${DEVICE}" "${SRC}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the helper
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
|
||||
|
||||
if [ -z "${ONLY_FIRMWARE}" ]; then
|
||||
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}"
|
||||
fi
|
||||
|
||||
if [ -z "${SECTION}" ]; then
|
||||
extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}"
|
||||
fi
|
||||
|
||||
"${MY_DIR}/setup-makefiles.sh"
|
||||
88
redfin/extract-files.py
Executable file
88
redfin/extract-files.py
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env -S PYTHONPATH=../../../../tools/extract-utils python3
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from extract_utils.extract import extract_fns_user_type
|
||||
from extract_utils.extract_pixel import (
|
||||
extract_pixel_factory_image,
|
||||
extract_pixel_firmware,
|
||||
pixel_factory_image_regex,
|
||||
pixel_firmware_regex,
|
||||
)
|
||||
from extract_utils.fixups_blob import (
|
||||
blob_fixup,
|
||||
blob_fixups_user_type,
|
||||
)
|
||||
from extract_utils.fixups_lib import (
|
||||
lib_fixup_remove,
|
||||
lib_fixups,
|
||||
lib_fixups_user_type,
|
||||
)
|
||||
from extract_utils.main import (
|
||||
ExtractUtils,
|
||||
ExtractUtilsModule,
|
||||
)
|
||||
|
||||
namespace_imports = [
|
||||
'hardware/google/interfaces',
|
||||
'hardware/google/pixel',
|
||||
'hardware/qcom/sm7250/display',
|
||||
'hardware/qcom/sm7250/gps',
|
||||
'hardware/qcom/wlan/legacy',
|
||||
'vendor/qcom/opensource/display',
|
||||
]
|
||||
|
||||
|
||||
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
|
||||
return f'{lib}_{partition}' if partition == 'vendor' else None
|
||||
|
||||
|
||||
lib_fixups: lib_fixups_user_type = {
|
||||
**lib_fixups,
|
||||
(
|
||||
'vendor.qti.hardware.tui_comm@1.0',
|
||||
'vendor.qti.imsrtpservice@3.0',
|
||||
): lib_fixup_vendor_suffix,
|
||||
'libwpa_client': lib_fixup_remove,
|
||||
}
|
||||
|
||||
blob_fixups: blob_fixups_user_type = {
|
||||
'product/etc/felica/common.cfg': blob_fixup()
|
||||
.patch_file('osaifu-keitai.patch'),
|
||||
'product/etc/sysconfig/nexus.xml': blob_fixup()
|
||||
.regex_replace('qulacomm', 'qualcomm'),
|
||||
'system_ext/priv-app/HbmSVManager/HbmSVManager.apk': blob_fixup()
|
||||
.apktool_patch('HbmSVManager.patch', '-r'),
|
||||
(
|
||||
'vendor/bin/hw/android.hardware.rebootescrow-service.citadel',
|
||||
'vendor/lib64/android.hardware.keymaster@4.1-impl.nos.so',
|
||||
): blob_fixup()
|
||||
.add_needed('libcrypto_shim.so'),
|
||||
'vendor/lib64/libgooglecamerahal.so': blob_fixup()
|
||||
.add_needed('libmeminfo_shim.so'),
|
||||
} # fmt: skip
|
||||
|
||||
extract_fns: extract_fns_user_type = {
|
||||
pixel_factory_image_regex: extract_pixel_factory_image,
|
||||
pixel_firmware_regex: extract_pixel_firmware,
|
||||
}
|
||||
|
||||
module = ExtractUtilsModule(
|
||||
'redfin',
|
||||
'google',
|
||||
device_rel_path='device/google/redfin/redfin',
|
||||
blob_fixups=blob_fixups,
|
||||
lib_fixups=lib_fixups,
|
||||
namespace_imports=namespace_imports,
|
||||
add_firmware_proprietary_file=True,
|
||||
extract_fns=extract_fns,
|
||||
)
|
||||
|
||||
module.add_proprietary_file('proprietary-files-carriersettings.txt')
|
||||
module.add_proprietary_file('proprietary-files-vendor.txt')
|
||||
|
||||
if __name__ == '__main__':
|
||||
utils = ExtractUtils.device(module)
|
||||
utils.run()
|
||||
24
redfin/osaifu-keitai.patch
Normal file
24
redfin/osaifu-keitai.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From aab255f2807cfc460c0dce40decd5554d49c0076 Mon Sep 17 00:00:00 2001
|
||||
From: jabashque <jabashque@gmail.com>
|
||||
Date: Mon, 5 Feb 2024 21:36:03 +0000
|
||||
Subject: [PATCH 1/1] Enable Osaifu-Keitai on non-Japanese SKUs
|
||||
|
||||
---
|
||||
common.cfg | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/common.cfg b/common.cfg
|
||||
index 3b78765..00f53cb 100644
|
||||
--- a/common.cfg
|
||||
+++ b/common.cfg
|
||||
@@ -11,6 +11,5 @@
|
||||
02030001,0
|
||||
02030002,0
|
||||
02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end
|
||||
-00000014,content://com.google.android.pixelnfc.provider.DeviceInfoContentProvider/isJapanSku
|
||||
-00000015,is_japan_sku
|
||||
00000016,0001
|
||||
+00000018,1
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@@ -1009,7 +1009,7 @@ vendor/lib/vendor.qti.hardware.soter@1.0.so
|
||||
vendor/lib/vendor.qti.hardware.trustedui@1.0.so
|
||||
vendor/lib/vendor.qti.hardware.trustedui@1.1.so
|
||||
vendor/lib/vendor.qti.hardware.trustedui@1.2.so
|
||||
vendor/lib/vendor.qti.hardware.tui_comm@1.0.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib/vendor.qti.hardware.tui_comm@1.0.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib/vendor.qti.hardware.wifidisplaysession@1.0.so
|
||||
vendor/lib/vendor.qti.hardware.wigig.netperftuner@1.0.so
|
||||
vendor/lib/vendor.qti.ims.callcapability@1.0.so
|
||||
@@ -1021,7 +1021,7 @@ vendor/lib/vendor.qti.ims.rcsconfig@1.1.so
|
||||
vendor/lib/vendor.qti.ims.rcsconfig@2.0.so
|
||||
vendor/lib/vendor.qti.ims.rcsconfig@2.1.so
|
||||
vendor/lib/vendor.qti.imsrtpservice@3.0-service-Impl.so
|
||||
vendor/lib/vendor.qti.imsrtpservice@3.0.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib/vendor.qti.imsrtpservice@3.0.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib/vendor.qti.latency@2.0.so
|
||||
vendor/lib/vendor.qti.latency@2.1.so
|
||||
vendor/lib/vendor.qti.latency@2.2.so
|
||||
@@ -1621,7 +1621,7 @@ vendor/lib64/vendor.qti.hardware.soter@1.0.so
|
||||
vendor/lib64/vendor.qti.hardware.trustedui@1.0.so
|
||||
vendor/lib64/vendor.qti.hardware.trustedui@1.1.so
|
||||
vendor/lib64/vendor.qti.hardware.trustedui@1.2.so
|
||||
vendor/lib64/vendor.qti.hardware.tui_comm@1.0.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib64/vendor.qti.hardware.tui_comm@1.0.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib64/vendor.qti.hardware.vpp@1.1.so
|
||||
vendor/lib64/vendor.qti.hardware.vpp@1.2.so
|
||||
vendor/lib64/vendor.qti.hardware.wifidisplaysession@1.0.so
|
||||
@@ -1635,7 +1635,7 @@ vendor/lib64/vendor.qti.ims.rcsconfig@1.1.so
|
||||
vendor/lib64/vendor.qti.ims.rcsconfig@2.0.so
|
||||
vendor/lib64/vendor.qti.ims.rcsconfig@2.1.so
|
||||
vendor/lib64/vendor.qti.imsrtpservice@3.0-service-Impl.so
|
||||
vendor/lib64/vendor.qti.imsrtpservice@3.0.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib64/vendor.qti.imsrtpservice@3.0.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib64/vendor.qti.latency@2.0.so
|
||||
vendor/lib64/vendor.qti.latency@2.1.so
|
||||
vendor/lib64/vendor.qti.latency@2.2.so
|
||||
1
redfin/setup-makefiles.py
Executable file
1
redfin/setup-makefiles.py
Executable file
@@ -0,0 +1 @@
|
||||
#!./extract-files.py --regenerate_makefiles
|
||||
13
setup-makefiles.py
Executable file
13
setup-makefiles.py
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
MY_DIR="$(cd "$(dirname "${0}")"; pwd -P)"
|
||||
|
||||
pushd "${MY_DIR}/redfin"
|
||||
./setup-makefiles.py
|
||||
popd
|
||||
@@ -1,79 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
DEVICE=redfin
|
||||
VENDOR=google
|
||||
|
||||
# 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}/../../.."
|
||||
|
||||
export TARGET_ENABLE_CHECKELF=true
|
||||
|
||||
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}"
|
||||
|
||||
function vendor_imports() {
|
||||
cat <<EOF >>"$1"
|
||||
"device/google/redfin",
|
||||
"hardware/google/interfaces",
|
||||
"hardware/google/pixel",
|
||||
"hardware/qcom/sm7250/display",
|
||||
"hardware/qcom/sm7250/gps",
|
||||
"hardware/qcom/wlan/legacy",
|
||||
"vendor/qcom/opensource/display"
|
||||
EOF
|
||||
}
|
||||
|
||||
function lib_to_package_fixup_vendor_variants() {
|
||||
if [ "$2" != "vendor" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
vendor.qti.hardware.tui_comm@1.0 | \
|
||||
vendor.qti.imsrtpservice@3.0)
|
||||
echo "$1-vendor"
|
||||
;;
|
||||
libprotobuf-cpp-lite-21.12)
|
||||
echo "libprotobuf-cpp-lite"
|
||||
;;
|
||||
libwpa_client) ;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function lib_to_package_fixup() {
|
||||
lib_to_package_fixup_clang_rt_ubsan_standalone "$1" ||
|
||||
lib_to_package_fixup_proto_3_9_1 "$1" ||
|
||||
lib_to_package_fixup_vendor_variants "$@"
|
||||
}
|
||||
|
||||
# Initialize the helper
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"
|
||||
|
||||
# Warning headers and guards
|
||||
write_headers
|
||||
|
||||
write_makefiles "${MY_DIR}/proprietary-files.txt"
|
||||
write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt"
|
||||
write_makefiles "${MY_DIR}/proprietary-files-vendor.txt"
|
||||
|
||||
append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt"
|
||||
|
||||
# Finish
|
||||
write_footers
|
||||
Reference in New Issue
Block a user