-
Notifications
You must be signed in to change notification settings - Fork 42
/
extract-files.py
123 lines (114 loc) · 4.07 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
#!/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/sm8450-common',
'hardware/qcom-caf/sm8450',
'hardware/qcom-caf/wlan',
'hardware/xiaomi',
'vendor/qcom/opensource/commonsys/display',
'vendor/qcom/opensource/commonsys-intf/display',
'vendor/qcom/opensource/dataservices',
]
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,
(
): lib_fixup_vendor_suffix,
(
'libagm',
'libar-pal',
'libpalclient',
'libwpa_client',
): lib_fixup_remove,
}
blob_fixups: blob_fixups_user_type = {
'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'),
'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/bin/hw/android.hardware.security.keymint-service-qti',
'vendor/lib64/libqtikeymint.so',
): blob_fixup()
.replace_needed(
'android.hardware.security.keymint-V1-ndk_platform.so',
'android.hardware.security.keymint-V1-ndk.so',
)
.replace_needed(
'android.hardware.security.secureclock-V1-ndk_platform.so',
'android.hardware.security.secureclock-V1-ndk.so',
)
.replace_needed(
'android.hardware.security.sharedsecret-V1-ndk_platform.so',
'android.hardware.security.sharedsecret-V1-ndk.so',
)
.add_needed('android.hardware.security.rkp-V1-ndk.so'),
'vendor/bin/qcc-trd': blob_fixup()
.replace_needed(
'libgrpc++_unsecure.so', 'libgrpc++_unsecure_prebuilt.so'
),
'vendor/etc/media_codecs_c2_audio.xml': blob_fixup()
.regex_replace('.+media_codecs_dolby_audio.+\n', ''),
(
'vendor/etc/media_codecs_cape.xml',
'vendor/etc/media_codecs_diwali_v0.xml',
'vendor/etc/media_codecs_diwali_v1.xml',
'vendor/etc/media_codecs_diwali_v2.xml',
'vendor/etc/media_codecs_taro.xml',
'vendor/etc/media_codecs_ukee.xml',
): blob_fixup()
.regex_replace('.+media_codecs_(google_audio|google_c2|google_telephony|vendor_audio).+\n', ''),
'vendor/etc/seccomp_policy/[email protected]': blob_fixup()
.add_line_if_missing('gettid: 1'),
'vendor/etc/seccomp_policy/c2audio.vendor.ext-arm64.policy': blob_fixup()
.add_line_if_missing('setsockopt: 1'),
'vendor/etc/seccomp_policy/wfdhdcphalservice.policy': blob_fixup()
.add_line_if_missing('gettid: 1'),
'vendor/etc/vintf/manifest/c2_manifest_vendor.xml': blob_fixup()
.regex_replace('.+dolby.+\n', ''),
'vendor/lib64/vendor.libdpmframework.so': blob_fixup()
.add_needed('libhidlbase_shim.so'),
} # fmt: skip
module = ExtractUtilsModule(
'sm8450-common',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
check_elf=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device(module)
utils.run()