forked from clarencelol/device_xiaomi_miatoll
-
Notifications
You must be signed in to change notification settings - Fork 8
/
extract-files.py
executable file
·133 lines (124 loc) · 5.22 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/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/miatoll',
'hardware/qcom-caf/common/libqti-perfd-client',
'hardware/qcom-caf/sm8150',
'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,
(
'com.qualcomm.qti.dpm.api@1.0',
'com.qualcomm.qti.imscmservice@2.0',
'com.qualcomm.qti.imscmservice@2.1',
'com.qualcomm.qti.imscmservice@2.2',
'com.qualcomm.qti.uceservice@2.0',
'com.qualcomm.qti.uceservice@2.1',
'com.qualcomm.qti.uceservice@2.2',
'com.qualcomm.qti.uceservice@2.3',
'libmmosal',
'vendor.qti.hardware.data.cne.internal.api@1.0',
'vendor.qti.hardware.data.cne.internal.constants@1.0',
'vendor.qti.hardware.data.cne.internal.server@1.0',
'vendor.qti.hardware.data.connection@1.0',
'vendor.qti.hardware.data.connection@1.1',
'vendor.qti.hardware.data.dynamicdds@1.0',
'vendor.qti.hardware.data.iwlan@1.0',
'vendor.qti.hardware.data.qmi@1.0',
'vendor.qti.hardware.fm@1.0',
'vendor.qti.hardware.wifidisplaysession@1.0',
'vendor.qti.ims.callcapability@1.0',
'vendor.qti.ims.callinfo@1.0',
'vendor.qti.ims.factory@1.0',
'vendor.qti.ims.factory@1.1',
'vendor.qti.ims.rcsconfig@1.0',
'vendor.qti.ims.rcsconfig@1.1',
'vendor.qti.ims.rcsconfig@2.0',
'vendor.qti.ims.rcsconfig@2.1',
'vendor.qti.imsrtpservice@3.0',
): lib_fixup_vendor_suffix,
(
'libOmxCore',
'libwpa_client',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'system_ext/etc/init/wfdservice.rc': blob_fixup()
.regex_replace('(start|stop) wfdservice\n', '\\1 wfdservice64\n'),
'system_ext/lib64/libwfdmmsrc_system.so': blob_fixup()
.add_needed('libgui_shim.so'),
'system_ext/lib64/libwfdnative.so': blob_fixup()
.add_needed('libbinder_shim.so')
.add_needed('libinput_shim.so')
.remove_needed('android.hidl.base@1.0.so'),
'system_ext/lib64/libwfdservice.so': blob_fixup()
.replace_needed('android.media.audio.common.types-V2-cpp.so', 'android.media.audio.common.types-V4-cpp.so'),
'vendor/etc/camera/camxoverridesettings.txt': blob_fixup()
.regex_replace('0x10082', '0')
.regex_replace('0x1F', '0x0'),
'vendor/etc/init/android.hardware.keymaster@4.0-service-qti.rc': blob_fixup()
.regex_replace('4\\.0', '4.1'),
'vendor/lib64/camera/components/com.qti.node.watermark.so': blob_fixup()
.add_needed('libpiex_shim.so'),
'vendor/lib64/hw/consumerir.atoll.so': blob_fixup()
.fix_soname(),
'vendor/lib64/hw/fingerprint.fpc.default.so': blob_fixup()
.sig_replace('30 00 00 90 11 3a 42 f9', '30 00 00 90 1f 20 03 d5'),
'vendor/lib64/hw/fingerprint.goodix.default.so': blob_fixup()
.fix_soname(),
'vendor/lib64/android.hardware.camera.provider@2.4-legacy.so': blob_fixup()
.add_needed('libcamera_provider_shim.so'),
('vendor/lib64/libVDSuperPhotoAPI.so', 'vendor/lib64/libhvx_interface.so', 'vendor/lib64/libmialgo_rfs.so', 'vendor/lib64/libsnpe_dsp_domains_v2.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_handle64_close')
.clear_symbol_version('remote_handle64_invoke')
.clear_symbol_version('remote_handle64_open')
.clear_symbol_version('remote_register_buf_attr')
.clear_symbol_version('remote_register_dma_handle'),
('vendor/lib64/libalAILDC.so', 'vendor/lib64/libalLDC.so', 'vendor/lib64/libalhLDC.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/libgoodixhwfingerprint.so': blob_fixup()
.replace_needed('libvendor.goodix.hardware.biometrics.fingerprint@2.1.so', 'vendor.goodix.hardware.biometrics.fingerprint@2.1.so'),
'vendor/lib64/libwvhidl.so': blob_fixup()
.add_needed('libcrypto_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'miatoll',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()