From 75259ed52f520bd22eecd3d72b8ca3f29b6957fe Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Sun, 3 Nov 2024 07:33:51 +0200 Subject: [PATCH] berlin: Switch to python extract-utils Change-Id: Ida4b83459d9739ac880b26a91df974e1db8423e9 --- extract-files.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++ extract-files.sh | 40 ------------------------------------- setup-makefiles.py | 1 + setup-makefiles.sh | 22 --------------------- 4 files changed, 50 insertions(+), 62 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..3a0da08 --- /dev/null +++ b/extract-files.py @@ -0,0 +1,49 @@ +#!/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_star import extract_star_firmware + +from extract_utils.fixups_lib import ( + lib_fixup_vendorcompat, + lib_fixups_user_type, + libs_proto_3_9_1, +) +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'vendor/motorola/sm7325-common', + 'hardware/qcom-caf/sm8350', + 'hardware/qcom-caf/wlan', + 'vendor/qcom/opensource/commonsys-intf/display', + 'vendor/qcom/opensource/commonsys/display', + 'vendor/qcom/opensource/dataservices', + 'vendor/qcom/opensource/display', +] + +lib_fixups: lib_fixups_user_type = { + libs_proto_3_9_1: lib_fixup_vendorcompat, +} + +extract_fns: extract_fns_user_type = { + r'(bootloader|radio)\.img': extract_star_firmware, +} + +module = ExtractUtilsModule( + 'berlin', + 'motorola', + lib_fixups=lib_fixups, + namespace_imports=namespace_imports, + extract_fns=extract_fns, + add_firmware_proprietary_file=True, +) + +if __name__ == '__main__': + utils = ExtractUtils.device_with_common(module, 'sm7325-common', module.vendor) + utils.run() diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index a71ed57..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2016 The CyanogenMod Project -# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project -# -# SPDX-License-Identifier: Apache-2.0 -# - -function blob_fixup() { - case "${1}" in - vendor/lib/libmot_chi_desktop_helper.so | vendor/lib64/libmot_chi_desktop_helper.so) - [ "$2" = "" ] && return 0 - grep -q "libgui_shim_vendor.so" "${2}" || "${PATCHELF}" --add-needed "libgui_shim_vendor.so" "${2}" - ;; - *) - return 1 - ;; - esac - - return 0 -} - -function blob_fixup_dry() { - blob_fixup "$1" "" -} - -# 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=berlin -export DEVICE_COMMON=sm7325-common -export VENDOR=motorola -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 c9f5157..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,22 +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=berlin -export DEVICE_COMMON=sm7325-common -export VENDOR=motorola -export VENDOR_COMMON=${VENDOR} - -"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"