From 8302d5327002f0dc2669f6b9d8043b81f2ed3930 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Tue, 15 Oct 2024 22:11:44 +0200 Subject: [PATCH] lemonadep: Switch to py extract utils Change-Id: I5618bf10c107df579a540e2393b222128961e670 --- extract-files.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++ extract-files.sh | 21 ------------------- setup-makefiles.py | 1 + setup-makefiles.sh | 21 ------------------- 4 files changed, 52 insertions(+), 42 deletions(-) create mode 100755 extract-files.py delete mode 100755 extract-files.sh create mode 100755 setup-makefiles.py delete mode 100755 setup-makefiles.sh diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..739acbd --- /dev/null +++ b/extract-files.py @@ -0,0 +1,51 @@ +#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 +# +# SPDX-FileCopyrightText: 2024 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 +# + +from extract_utils.fixups_blob import ( + blob_fixup, + blob_fixups_user_type, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'vendor/oneplus/sm8350-common', +] + +blob_fixups: blob_fixups_user_type = { + 'odm/etc/camera/CameraHWConfiguration.config': blob_fixup() + .regex_replace('SystemCamera = 0; 0; 1; 1; 1; 1', 'SystemCamera = 0; 0; 0; 0; 0; 1'), + ('odm/lib/liblvimfs_wrapper.so', 'odm/lib64/libCOppLceTonemapAPI.so', 'odm/lib64/libaps_frame_registration.so', 'vendor/lib64/libalsc.so'): blob_fixup() + .replace_needed('libstdc++.so', 'libstdc++_vendor.so'), + 'vendor/etc/libnfc-nci.conf': blob_fixup() + .regex_replace('NFC_DEBUG_ENABLED=1', 'NFC_DEBUG_ENABLED=0'), + 'vendor/etc/libnfc-nxp.conf': blob_fixup() + .regex_replace('(NXPLOG_.*_LOGLEVEL)=0x03', '\\1=0x02') + .regex_replace('NFC_DEBUG_ENABLED=1', 'NFC_DEBUG_ENABLED=0'), + 'vendor/lib/hw/audio.primary.lahaina.so': blob_fixup() + .replace_needed('/vendor/lib/liba2dpoffload.so', '/odm/lib/liba2dpoffload.so') + .replace_needed('/vendor/lib/libssrec.so', '/odm/lib/libssrec.so'), + 'vendor/lib/libgui1_vendor.so': blob_fixup() + .replace_needed('libui.so', 'libui-v30.so'), + 'vendor/lib64/vendor.qti.hardware.camera.postproc@1.0-service-impl.so': blob_fixup() + .sig_replace('27 0B 00 94', '1F 20 03 D5'), +} # fmt: skip + +module = ExtractUtilsModule( + 'lemonadep', + 'oneplus', + namespace_imports=namespace_imports, + blob_fixups=blob_fixups, + add_firmware_proprietary_file=True, +) + +if __name__ == '__main__': + utils = ExtractUtils.device_with_common( + module, 'sm8350-common', module.vendor + ) + utils.run() diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index db9a8d7..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -# If we're being sourced by the common script that we called, -# stop right here. No need to go down the rabbit hole. -if [ "${BASH_SOURCE[0]}" != "${0}" ]; then - return -fi - -set -e - -export DEVICE=lemonadep -export DEVICE_COMMON=sm8350-common -export VENDOR=oneplus -export VENDOR_COMMON=${VENDOR} - -"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/extract-files.sh" "$@" diff --git a/setup-makefiles.py b/setup-makefiles.py new file mode 100755 index 0000000..32947cf --- /dev/null +++ b/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/setup-makefiles.sh b/setup-makefiles.sh deleted file mode 100755 index d66f68f..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# SPDX-License-Identifier: Apache-2.0 -# - -# If we're being sourced by the common script that we called, -# stop right here. No need to go down the rabbit hole. -if [ "${BASH_SOURCE[0]}" != "${0}" ]; then - return -fi - -set -e - -export DEVICE=lemonadep -export DEVICE_COMMON=sm8350-common -export VENDOR=oneplus -export VENDOR_COMMON=${VENDOR} - -"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"