kane: Switch to py extract

Change-Id: I3d4bea635c390d8e682f878f86dee66f362ab52e
This commit is contained in:
Nolen Johnson
2024-11-21 14:05:04 -05:00
parent 45115fecac
commit ce61eeb71c
4 changed files with 77 additions and 70 deletions

76
extract-files.py Executable file
View File

@@ -0,0 +1,76 @@
#!/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.fixups_lib import (
lib_fixup_remove,
lib_fixup_vendorcompat,
lib_fixups,
lib_fixups_user_type,
libs_proto_3_9_1,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
'vendor/motorola/exynos9610-common',
'device/motorola/exynos9610-common',
'hardware/samsung_slsi-linaro/graphics',
]
libs_add_vendor_suffix = (
'libhwjpeg',
)
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
return f'{lib}_{partition}' if partition == 'vendor' else None
libs_remove = (
'libandroidicu',
'libcsc',
'libexynosutils',
'libexynosv4l2',
'libGrallocWrapper',
)
lib_fixups: lib_fixups_user_type = {
libs_proto_3_9_1: lib_fixup_vendorcompat,
libs_add_vendor_suffix: lib_fixup_vendor_suffix,
libs_remove: lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'vendor/lib/libaudioproxy.so': blob_fixup()
.patchelf_version('0_18')
.add_needed('libaudioproxy_shim.so'),
('vendor/lib/sensors.chub.so', 'vendor/lib64/sensors.chub.so', 'vendor/lib/hw/sensors.kane_sprout.so', 'vendor/lib64/hw/sensors.kane_sprout.so'): blob_fixup()
.patchelf_version('0_18')
.replace_needed('libutils.so', 'libutils-v32.so'),
('vendor/lib/libril_sitril.so', 'vendor/lib64/libril_sitril.so'): blob_fixup()
.patchelf_version('0_18')
.remove_needed('libhidltransport.so')
.remove_needed('libhwbinder.so'),
} # fmt: skip
module = ExtractUtilsModule(
'kane',
'motorola',
namespace_imports=namespace_imports,
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
add_firmware_proprietary_file=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device_with_common(module, 'exynos9610-common', module.vendor)
utils.run()

View File

@@ -1,54 +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
# Missing libaudioproxy symbols
vendor/lib/libaudioproxy.so)
[ "$2" = "" ] && return 0
for LIBAUDIOPROXY_SHIM in $(grep -L "libaudioproxy_shim.so" "${2}"); do
"${PATCHELF}" --add-needed "libaudioproxy_shim.so" "${LIBAUDIOPROXY_SHIM}"
done
;;
# Missing libutils symbols
vendor/lib*/sensors.chub.so|vendor/lib*/hw/sensors.kane_sprout.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --replace-needed "libutils.so" "libutils-v32.so" "${2}"
;;
# Remove libhidltransport/libhwbinder dependencies
vendor/lib*/libril_sitril.so)
[ "$2" = "" ] && return 0
"${PATCHELF}" --remove-needed "libhidltransport.so" "${2}"
"${PATCHELF}" --remove-needed "libhwbinder.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=kane
export DEVICE_COMMON=exynos9610-common
export VENDOR=motorola
export VENDOR_COMMON=${VENDOR}
"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/extract-files.sh" "$@"

1
setup-makefiles.py Executable file
View File

@@ -0,0 +1 @@
#!./extract-files.py --regenerate_makefiles

View File

@@ -1,16 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
export DEVICE=kane
export DEVICE_COMMON=exynos9610-common
export VENDOR=motorola
export VENDOR_COMMON=${VENDOR}
"./../../${VENDOR_COMMON}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"