-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract-files.py
executable file
·97 lines (88 loc) · 3.76 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
#!/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/oneplus/dre',
'hardware/oplus',
'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',
]
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
return f'{lib}_vendor' if partition in ['odm', 'vendor'] else None
lib_fixups: lib_fixups_user_type = {
**lib_fixups,
(
'libmmosal',
): lib_fixup_vendor_suffix,
(
'libOmxCore',
'libwpa_client',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'odm/etc/init/[email protected]': blob_fixup()
.regex_replace('writepid /dev/cpuset/foreground/tasks', 'task_profiles ProcessCapacityHigh'),
('odm/lib64/libCOppLceTonemapAPI.so', 'odm/lib64/libaps_frame_registration.so'): blob_fixup()
.replace_needed('libstdc++.so', 'libstdc++_vendor.so'),
('odm/lib64/libwvhidl.so','odm/lib64/mediadrm/libwvdrmengine.so'): blob_fixup()
.add_needed('libcrypto_shim.so'),
'product/etc/sysconfig/com.android.hotwordenrollment.common.util.xml': blob_fixup()
.regex_replace('/my_product', '/product'),
'system_ext/lib/libwfdmmsrc_system.so': blob_fixup()
.add_needed('libgui_shim.so'),
'system_ext/lib/libwfdservice.so': blob_fixup()
.replace_needed('android.media.audio.common.types-V2-cpp.so', 'android.media.audio.common.types-V3-cpp.so'),
'system_ext/lib64/libwfdnative.so': blob_fixup()
.replace_needed('[email protected]', 'libhidlbase.so')
.add_needed('libinput_shim.so'),
'vendor/bin/init.kernel.post_boot-blair.sh': blob_fixup()
.patch_file('blob-patches/init-post-boot-blair.patch'),
'vendor/bin/init.kernel.post_boot-holi.sh': blob_fixup()
.patch_file('blob-patches/init-post-boot-holi.patch'),
'vendor/etc/init/[email protected]': blob_fixup()
.regex_replace('writepid /dev/cpuset/foreground/tasks', 'task_profiles ProcessCapacityHigh'),
'vendor/etc/libnfc-nci.conf': blob_fixup()
.regex_replace('NFC_DEBUG_ENABLED=1', 'NFC_DEBUG_ENABLED=0'),
'vendor/etc/media_holi/video_system_specs.json': blob_fixup()
.regex_replace('"max_retry_alloc_output_timeout": 2000,', '"max_retry_alloc_output_timeout": 0,'),
('vendor/etc/media_codecs.xml', 'vendor/etc/media_codecs_blair.xml', 'vendor/etc/media_codecs_blair_lite.xml', 'vendor/etc/media_codecs_holi.xml'): blob_fixup()
.regex_replace('.*media_codecs_(google_audio|google_c2|google_telephony|vendor_audio).*\n', ''),
'vendor/etc/msm_irqbalance.conf': blob_fixup()
.regex_replace('IGNORED_IRQ=19,21,38$', 'IGNORED_IRQ=19,21,38,209,218'),
'vendor/lib64/hw/com.qti.chi.override.so': blob_fixup()
.add_needed('libcamera_metadata_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'dre',
'oneplus',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()