diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..2595d4b --- /dev/null +++ b/extract-files.py @@ -0,0 +1,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_fixups_user_type, +) + +from extract_utils.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'device/samsung/universal9830-common', + 'hardware/samsung_slsi-linaro/exynos', + 'hardware/samsung_slsi-linaro/graphics', + 'vendor/samsung/universal9830-common' +] + + +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 = { + 'libsecril-client': lib_fixup_vendor_suffix, +} + + +blob_fixups: blob_fixups_user_type = { + 'vendor/lib64/libexynoscamera3.so': blob_fixup() + .sig_replace('14 00 00 94 0A', '1F 20 03 D5 0A') + .sig_replace('A8 FF FF 97', '1F 20 03 D5') + .sig_replace('AB 02 20 36', '1F 20 03 D5'), + 'vendor/lib64/sensors.sensorhub.so': blob_fixup() + .add_needed('libutils-v32.so') + .binary_regex_replace(b'_ZN7android6Thread3runEPKcim', b'_ZN7utils326Thread3runEPKcim'), + 'vendor/firmware/wlan/qcom_cfg.ini': blob_fixup() + .regex_replace('swlan0', 'wlan1') + .regex_replace('gChannelBondingMode24GHz=0', 'gChannelBondingMode24GHz=1'), +} # fmt: skip + +module = ExtractUtilsModule( + 'r8s', + 'samsung', + blob_fixups=blob_fixups, + lib_fixups=lib_fixups, + namespace_imports=namespace_imports, +) + +if __name__ == '__main__': + utils = ExtractUtils.device_with_common(module, 'universal9830-common', module.vendor) + utils.run() diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index bd2c225..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project -# -# SPDX-License-Identifier: Apache-2.0 -# - -function blob_fixup() { - case "${1}" in - vendor/lib64/libexynoscamera3.so) - xxd -p "${2}" | tr -d \\n > "${2}".hex - # NOP SecCameraIPCtoRIL::enable m_sendRequest() - sed -i "s/140000940a000014/1f2003d50a000014/g" "${2}".hex - # NOP SecCameraIPCtoRIL::disable m_sendRequest() - sed -i "s/a8ffff970a000014/1f2003d50a000014/g" "${2}".hex - # enable RAW on all cameras - sed -i "s/ab022036/1f2003d5/g" "${2}".hex - xxd -r -p "${2}".hex > "${2}" - rm "${2}".hex - ;; - vendor/lib*/sensors.*.so) - "${PATCHELF}" --add-needed libutils-v32.so "${2}" - sed -i 's/_ZN7android6Thread3runEPKcim/_ZN7utils326Thread3runEPKcim/g' "${2}" - ;; - vendor/firmware/wlan/qcom_cfg.ini) - sed -i 's/swlan0/wlan1/g' "${2}" - sed -i 's/gChannelBondingMode24GHz=0/gChannelBondingMode24GHz=1/g' "${2}" - esac -} - -# If we're being sourced by the common script that we called, -# stop right here. No need to go down the rabbit hole. -if [ "${BASH_SOURCE[0]}" != "${0}" ]; then - return -fi - -set -e - -export DEVICE=r8s -export DEVICE_COMMON=universal9830-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/extract-files.sh" "$@" diff --git a/proprietary-files.txt b/proprietary-files.txt index d874072..6844645 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -4,11 +4,11 @@ # Audio vendor/etc/dolby/dax-default.xml vendor/etc/floating_feature.xml --vendor/lib/libfloatingfeature.so --vendor/lib/librecordalive.so --vendor/lib/lib_SamsungRec_07020.so --vendor/lib/libsecaudioinfo.so --vendor/lib/soundfx/libswdap.so +vendor/lib/libfloatingfeature.so +vendor/lib/librecordalive.so +vendor/lib/lib_SamsungRec_07020.so +vendor/lib/libsecaudioinfo.so +vendor/lib/soundfx/libswdap.so # Audio (Firmware) vendor/firmware/APBargeIn_AUDIO_SLSI.bin @@ -19,21 +19,21 @@ vendor/firmware/AP_AUDIO_SLSI.bin vendor/firmware/SoundBoosterParam.bin # Bluetooth --vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti +vendor/bin/hw/android.hardware.bluetooth@1.0-service-qti vendor/etc/init/android.hardware.bluetooth@1.0-service-qti.rc --vendor/lib/hw/android.hardware.bluetooth@1.0-impl-qti.so --vendor/lib64/hw/android.hardware.bluetooth@1.0-impl-qti.so --vendor/lib64/vendor.samsung.hardware.bluetooth.a2dp@1.0.so --vendor/lib/vendor.samsung.hardware.bluetooth.a2dp@1.0.so --vendor/lib64/vendor.samsung.hardware.bluetooth@2.0.so --vendor/lib/vendor.samsung.hardware.bluetooth@2.0.so +vendor/lib/hw/android.hardware.bluetooth@1.0-impl-qti.so +vendor/lib64/hw/android.hardware.bluetooth@1.0-impl-qti.so +vendor/lib64/vendor.samsung.hardware.bluetooth.a2dp@1.0.so +vendor/lib/vendor.samsung.hardware.bluetooth.a2dp@1.0.so +vendor/lib64/vendor.samsung.hardware.bluetooth@2.0.so +vendor/lib/vendor.samsung.hardware.bluetooth@2.0.so # Camera --vendor/lib64/hw/camera.exynos990.so --vendor/lib64/libexynoscamera3.so --vendor/lib64/libexynoscamera_bayergdc_plugin.so --vendor/lib64/libexynoscamera_fakemultiframe.so --vendor/lib64/libexynoscamera_vpl_plugin.so +vendor/lib64/hw/camera.exynos990.so +vendor/lib64/libexynoscamera3.so +vendor/lib64/libexynoscamera_bayergdc_plugin.so +vendor/lib64/libexynoscamera_fakemultiframe.so +vendor/lib64/libexynoscamera_vpl_plugin.so # Camera (Firmware) vendor/firmware/dual_cal_wide_swide.bin @@ -57,12 +57,12 @@ vendor/firmware/setfile_hi847.bin vendor/firmware/setfile_imx616.bin # GPS/GNSS --vendor/bin/hw/gpsd --vendor/lib64/libwrappergps.so +vendor/bin/hw/gpsd +vendor/lib64/libwrappergps.so # Hotword Enrollment --product/priv-app/HotwordEnrollmentOKGoogleEx2CORTEXM4/HotwordEnrollmentOKGoogleEx2CORTEXM4.apk --product/priv-app/HotwordEnrollmentXGoogleEx2CORTEXM4/HotwordEnrollmentXGoogleEx2CORTEXM4.apk +product/priv-app/HotwordEnrollmentOKGoogleEx2CORTEXM4/HotwordEnrollmentOKGoogleEx2CORTEXM4.apk +product/priv-app/HotwordEnrollmentXGoogleEx2CORTEXM4/HotwordEnrollmentXGoogleEx2CORTEXM4.apk # NFC vendor/etc/nfc/sec_s3nrn4v_hwreg.bin @@ -70,7 +70,7 @@ vendor/etc/nfc/sec_s3nrn4v_swreg.bin vendor/firmware/nfc/sec_s3nrn4v_firmware.bin # Sensors --vendor/lib64/sensors.sensorhub.so +vendor/lib64/sensors.sensorhub.so # Teegris Firmware vendor/tee/00000000-0000-0000-0000-000000534b4d @@ -99,5 +99,5 @@ vendor/firmware/qca6390/bdwlan.elf2 vendor/firmware/qca6390/m3.bin vendor/firmware/qca6390/regdb.bin vendor/firmware/wlan/qcom_cfg.ini --vendor/lib/libcld80211.so --vendor/lib64/libcld80211.so +vendor/lib/libcld80211.so +vendor/lib64/libcld80211.so diff --git a/setup-makefiles.py b/setup-makefiles.py new file mode 100755 index 0000000..32947cf --- /dev/null +++ b/setup-makefiles.py @@ -0,0 +1 @@ +#!./extract-files.py --regenerate_makefiles diff --git a/setup-makefiles.sh b/setup-makefiles.sh deleted file mode 100755 index 6c43b2b..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project -# -# SPDX-License-Identifier: Apache-2.0 -# - -set -e - -export DEVICE=r8s -export DEVICE_COMMON=universal9830-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"