-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathextract-files.py
executable file
·99 lines (90 loc) · 2.77 KB
/
extract-files.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/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_remove_arch_suffix,
lib_fixup_remove_proto_version_suffix,
lib_fixup_vendorcompat,
lib_fixups_user_type,
libs_clang_rt_ubsan,
libs_proto_3_9_1,
libs_proto_21_12,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
"device/nubia/TP1803",
"hardware/qcom-caf/sm8150",
"hardware/qcom-caf/wlan",
"vendor/qcom/opensource/dataservices",
"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 = {
libs_clang_rt_ubsan: lib_fixup_remove_arch_suffix,
libs_proto_3_9_1: lib_fixup_vendorcompat,
libs_proto_21_12: lib_fixup_remove_proto_version_suffix,
(
'libprotobuf-cpp-lite',
'libprotobuf-cpp-full',
): lib_fixup_vendorcompat,
(
): lib_fixup_vendor_suffix,
(
'libOmxCore',
'libgrallocutils',
'libwpa_client',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'system_ext/lib64/lib-imsvideocodec.so': blob_fixup()
.add_needed('libgui_shim.so'),
(
'vendor/bin/dspservice',
'vendor/bin/vppservice',
'vendor/lib64/lib-imsrcs-v2.so',
'vendor/lib/libOmxVpp.so',
'vendor/lib/libvppclient.so',
): blob_fixup()
.remove_needed('libhwbinder.so'),
'vendor/lib64/hw/camera.qcom.so': blob_fixup()
.add_needed('libcomparetf2.so')
.replace_needed('libc++.so', 'libc++-v28.so')
.replace_needed('libsnsapi.so', 'libsnsapi-v28.so'),
(
'vendor/lib64/camera/components/com.qti.camx.chiiqutils.so',
'vendor/lib64/camera/components/com.qti.node.eisv2.so',
'vendor/lib64/camera/components/com.qti.node.eisv3.so',
'vendor/lib64/libcamera_nn_stub.so',
): blob_fixup()
.replace_needed('libsnsapi.so', 'libsnsapi-v28.so'),
(
'vendor/lib64/libwvhidl.so',
'vendor/lib64/mediadrm/libwvdrmengine.so',
): blob_fixup()
.add_needed('libcrypto_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'TP1803',
'nubia',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
check_elf=True,
add_firmware_proprietary_file=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()