-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract-files.py
executable file
·93 lines (84 loc) · 3.46 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
#!/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_fixups,
lib_fixups_user_type,
)
from extract_utils.main import (
ExtractUtils,
ExtractUtilsModule,
)
namespace_imports = [
'device/xiaomi/gauguin',
'hardware/qcom-caf/common/libqti-perfd-client',
'hardware/qcom-caf/sm8250',
'hardware/qcom-caf/wlan',
'hardware/xiaomi',
'vendor/qcom/opensource/commonsys/display',
'vendor/qcom/opensource/commonsys-intf/display',
'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 = {
**lib_fixups,
(
'libmmosal',
): lib_fixup_vendor_suffix,
('libwpa_client'): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'vendor/etc/init/init.batterysecret.rc': blob_fixup()
.regex_replace(' +seclabel u:r:batterysecret:s0\n', ''),
'vendor/etc/init/init.mi_thermald.rc': blob_fixup()
.regex_replace(' +seclabel u:r:mi_thermald:s0\n', ''),
'vendor/etc/seccomp_policy/[email protected]': blob_fixup()
.add_line_if_missing('gettid: 1'),
'vendor/lib64/camera/components/com.mi.node.watermark.so': blob_fixup()
.add_needed('libpiex_shim.so'),
('vendor/lib64/libarcsoft_hta.so', 'vendor/lib64/libarcsoft_hdrplus_hvx_stub.so', 'vendor/lib64/libarcsoft_super_night_raw.so', 'vendor/lib64/libmialgo_rfs.so', 'vendor/lib64/libMIAIHDRhvx_interface.so'): blob_fixup()
.clear_symbol_version('remote_handle_close')
.clear_symbol_version('remote_handle_invoke')
.clear_symbol_version('remote_handle_open')
.clear_symbol_version('remote_register_buf_attr')
.clear_symbol_version('remote_register_buf')
.clear_symbol_version('rpcmem_alloc')
.clear_symbol_version('rpcmem_free')
.clear_symbol_version('rpcmem_to_fd'),
('vendor/lib64/libalhLDC.so', 'vendor/lib64/libalLDC.so'): blob_fixup()
.clear_symbol_version('AHardwareBuffer_allocate')
.clear_symbol_version('AHardwareBuffer_describe')
.clear_symbol_version('AHardwareBuffer_lock')
.clear_symbol_version('AHardwareBuffer_release')
.clear_symbol_version('AHardwareBuffer_unlock'),
'vendor/lib64/[email protected]': blob_fixup()
.sig_replace('E7 09 00 94', '1F 20 03 D5'),
('vendor/lib64/hw/camera.qcom.so', 'vendor/lib64/libFaceDetectpp-0.5.2.so', 'vendor/lib64/libfacedet.so'): blob_fixup()
.replace_needed('libmegface.so', 'libfacedet.so')
.replace_needed('libMegviiFacepp-0.5.2.so', 'libFaceDetectpp-0.5.2.so')
.replace_needed('megviifacepp_0_5_2_model', 'facedetectpp_0_5_2_model'),
'vendor/lib64/libwvhidl.so': blob_fixup()
.add_needed('libcrypto_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'gauguin',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()