Michael Bestas | 8e00f31 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 1 | #!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3 |
| 2 | # |
| 3 | # SPDX-FileCopyrightText: 2024 The LineageOS Project |
| 4 | # SPDX-License-Identifier: Apache-2.0 |
| 5 | # |
| 6 | |
| 7 | from extract_utils.fixups_blob import ( |
| 8 | blob_fixup, |
| 9 | blob_fixups_user_type, |
| 10 | ) |
| 11 | from extract_utils.fixups_lib import ( |
| 12 | lib_fixup_remove, |
| 13 | lib_fixups, |
| 14 | lib_fixups_user_type, |
| 15 | ) |
| 16 | from extract_utils.main import ( |
| 17 | ExtractUtils, |
| 18 | ExtractUtilsModule, |
| 19 | ) |
| 20 | |
| 21 | namespace_imports = [ |
| 22 | 'device/shift/axolotl', |
| 23 | 'hardware/qcom-caf/sdm845', |
| 24 | 'hardware/qcom-caf/wlan', |
| 25 | 'vendor/qcom/opensource/dataservices', |
| 26 | 'vendor/qcom/opensource/display', |
| 27 | ] |
| 28 | |
| 29 | |
| 30 | def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs): |
| 31 | return f'{lib}_{partition}' if partition == 'vendor' else None |
| 32 | |
| 33 | |
| 34 | lib_fixups: lib_fixups_user_type = { |
| 35 | **lib_fixups, |
| 36 | ( |
| 37 | 'com.qualcomm.qti.ant@1.0', |
| 38 | 'com.qualcomm.qti.dpm.api@1.0', |
| 39 | 'vendor.qti.hardware.fm@1.0', |
| 40 | ): lib_fixup_vendor_suffix, |
| 41 | ( |
| 42 | 'libOmxCore', |
| 43 | 'libril', |
| 44 | 'libwpa_client', |
| 45 | ): lib_fixup_remove, |
| 46 | } |
| 47 | |
| 48 | blob_fixups: blob_fixups_user_type = { |
| 49 | 'odm/lib64/hw/fingerprint.sdm845.so': blob_fixup() |
| 50 | .fix_soname(), |
| 51 | 'system_ext/lib64/lib-imsvideocodec.so': blob_fixup() |
| 52 | .add_needed('libgui_shim.so') |
| 53 | .add_needed('libui_shim.so'), |
Michael Bestas | 333558b | 2024-09-11 00:04:13 +0300 | [diff] [blame] | 54 | ('vendor/lib/libwvhidl@1.3.so', 'vendor/lib64/libwvhidl@1.3.so'): blob_fixup() |
| 55 | .add_needed('libcrypto_shim.so'), |
Michael Bestas | 8e00f31 | 2024-11-03 07:33:51 +0200 | [diff] [blame] | 56 | 'vendor/lib64/hw/camera.qcom.so': blob_fixup() |
| 57 | .add_needed('libcomparetf2_shim.so'), |
| 58 | 'vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so': blob_fixup() |
| 59 | .replace_needed('libhidlbase.so', 'ibhidlbase-v32.so'), |
| 60 | } # fmt: skip |
| 61 | |
| 62 | module = ExtractUtilsModule( |
| 63 | 'axolotl', |
| 64 | 'shift', |
| 65 | blob_fixups=blob_fixups, |
| 66 | lib_fixups=lib_fixups, |
| 67 | namespace_imports=namespace_imports, |
| 68 | add_firmware_proprietary_file=True, |
| 69 | ) |
| 70 | |
| 71 | module.add_proprietary_file('proprietary-files-widevine.txt') |
| 72 | |
| 73 | if __name__ == '__main__': |
| 74 | utils = ExtractUtils.device(module) |
| 75 | utils.run() |