-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract-files.py
executable file
·61 lines (54 loc) · 2.12 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
#!/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 = [
'hardware/qcom-caf/sm8350',
'hardware/xiaomi',
'vendor/qcom/opensource/display',
'vendor/xiaomi/sm8350-common',
]
lib_fixups: lib_fixups_user_type = {
**lib_fixups,
}
blob_fixups: blob_fixups_user_type = {
'vendor/etc/camera/pureShot_parameter.xml': blob_fixup()
.regex_replace(r'=(\d+)>', r'="\1">'),
'vendor/lib64/[email protected]': blob_fixup()
.sig_replace('21 00 80 52 7c 00 00 94', '21 00 80 52 1F 20 03 D5'),
('vendor/lib64/hw/camera.qcom.so', 'vendor/lib64/libFaceDetectpp-0.5.2.so', 'vendor/lib64/libfacedet.so'): blob_fixup()
.binary_regex_replace(b'\x73\x74\x5F\x6C\x69\x63\x65\x6E\x73\x65\x2E\x6C\x69\x63', b'\x63\x61\x6D\x65\x72\x61\x5F\x63\x6E\x66\x2E\x74\x78\x74')
.binary_regex_replace(b'libmegface.so', b'libfacedet.so')
.binary_regex_replace(b'libMegviiFacepp-0.5.2.so', b'libFaceDetectpp-0.5.2.so')
.binary_regex_replace(b'megviifacepp_0_5_2_model', b'facedetectpp_0_5_2_model'),
('vendor/lib64/hw/camera.xiaomi.so', 'vendor/lib64/[email protected]', 'vendor/lib64/[email protected]_vendor.so'): blob_fixup()
.sig_replace('5e 07 00 94', '1F 20 03 D5')
.replace_needed('[email protected]', '[email protected]_vendor.so'),
}
module = ExtractUtilsModule(
'renoir',
'xiaomi',
blob_fixups=blob_fixups,
lib_fixups=lib_fixups,
namespace_imports=namespace_imports,
add_firmware_proprietary_file=True,
)
if __name__ == '__main__':
utils = ExtractUtils.device_with_common(
module, 'sm8350-common', module.vendor
)
utils.run()