diff --git a/device.mk b/device.mk index dad2014..4096d8c 100644 --- a/device.mk +++ b/device.mk @@ -29,7 +29,3 @@ PRODUCT_COPY_FILES += \ # Overlays DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay - -# Shims -PRODUCT_PACKAGES += \ - libshim_sfpex diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..c2b8c67 --- /dev/null +++ b/extract-files.py @@ -0,0 +1,57 @@ +#!/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.main import ( + ExtractUtils, + ExtractUtilsModule, +) + +namespace_imports = [ + 'device/samsung/exynos9820-common', + 'hardware/samsung_slsi-linaro/exynos', + 'hardware/samsung_slsi-linaro/graphics', + 'vendor/samsung/exynos9820-common', +] + +blob_fixups: blob_fixups_user_type = { + ( + 'vendor/bin/vaultkeeperd', + 'vendor/lib64/libvkservice.so' + ): blob_fixup() + .binary_regex_replace(b'ro.factory.factory_binary', b'ro.vendor.factory_binary\x00'), + 'vendor/lib64/libexynoscamera3.so': blob_fixup() + .sig_replace('8B 02 20 36', '1F 20 03 D5'), + ( + 'vendor/lib/sensors.bio.so', + 'vendor/lib/sensors.sensorhub.so', + 'vendor/lib64/sensors.bio.so', + 'vendor/lib64/sensors.sensorhub.so', + ): blob_fixup() + .remove_needed('libhidltransport.so') + .add_needed('libutils-v32.so') + .binary_regex_replace(b'_ZN7android6Thread3runEPKcim', b'_ZN7utils326Thread3runEPKcim'), + 'vendor/lib64/libiu456_datapath_processor.so': blob_fixup() + .add_needed('libshim_sfpex.so') + .replace_needed('libOpenCL.so', 'libGLES_mali.so'), +} # fmt: skip + +module = ExtractUtilsModule( + 'd2x', + 'samsung', + namespace_imports=namespace_imports, + add_firmware_proprietary_file=True, + blob_fixups=blob_fixups, +) + +if __name__ == '__main__': + utils = ExtractUtils.device_with_common( + module, 'exynos9820-common', module.vendor + ) + utils.run() diff --git a/extract-files.sh b/extract-files.sh deleted file mode 100755 index bb1323d..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,41 +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/bin/vaultkeeperd|vendor/lib64/libvkservice.so) - sed -i 's/ro\.factory\.factory_binary/ro.vendor.factory_binary\x00/g' "${2}" - ;; - vendor/lib64/libexynoscamera3.so) - xxd -p "${2}" | sed "s/8b022036/1f2003d5/g" | xxd -r -p > "${2}".patched - mv "${2}".patched "${2}" - ;; - vendor/lib*/sensors.*.so) - "${PATCHELF}" --remove-needed libhidltransport.so "${2}" - "${PATCHELF}" --replace-needed libutils.so libutils-v32.so "${2}" - sed -i 's/_ZN7android6Thread3runEPKcim/_ZN7utils326Thread3runEPKcim/g' "${2}" - ;; - vendor/lib64/libiu456_datapath_processor.so) - "${PATCHELF}" --add-needed libshim_sfpex.so "${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=d2x -export DEVICE_COMMON=exynos9820-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/extract-files.sh" "$@" diff --git a/proprietary-files.txt b/proprietary-files.txt index 97cf3b1..bd489c3 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -2,7 +2,7 @@ ## Audio - Dolby Atmos vendor/etc/dolby/dax-default.xml --vendor/lib/soundfx/libswdap.so +vendor/lib/soundfx/libswdap.so ## Audio Firmware vendor/firmware/APBargeIn_AUDIO_SLSI.bin @@ -25,16 +25,13 @@ vendor/firmware/bcm4375B1_semco.hcd vendor/firmware/bcm4375B1_semco_sem.hcd ## Camera - from d2x - N976BXXS7GVB1 --vendor/lib64/hw/camera.exynos9825.so|eba7419002ab6da18526d76cdf180fd7bca89ded --vendor/lib64/libexynoscamera3.so|7816c732d95bcf861a4e96b80d87fb3ec570798e +vendor/lib64/hw/camera.exynos9825.so|eba7419002ab6da18526d76cdf180fd7bca89ded +vendor/lib64/libexynoscamera3.so|7816c732d95bcf861a4e96b80d87fb3ec570798e|7816c732d95bcf861a4e96b80d87fb3ec570798e ## Camera dependencies --vendor/lib/libTOFProc_interface.so --vendor/lib/libdatazip.so --vendor/lib/libiu456_datapath_processor.so --vendor/lib64/libTOFProc_interface.so --vendor/lib64/libdatazip.so --vendor/lib64/libiu456_datapath_processor.so +vendor/lib64/libTOFProc_interface.so +vendor/lib64/libdatazip.so +vendor/lib64/libiu456_datapath_processor.so ## Camera Firmware vendor/firmware/fimc_is_fw_mcu.bin @@ -45,10 +42,8 @@ vendor/firmware/fimc_is_rta.bin vendor/etc/media_codecs_performance.xml ## Fingerprint --vendor/lib/libbauthserver.so --vendor/lib/libbauthtzcommon.so --vendor/lib64/libbauthserver.so --vendor/lib64/libbauthtzcommon.so +vendor/lib64/libbauthserver.so +vendor/lib64/libbauthtzcommon.so ## Firmware vendor/firmware/CP_AUDIO_SLSI_SEA.bin @@ -88,20 +83,20 @@ vendor/firmware/txse3.bin vendor/firmware/vts.bin ## Gatekeeper --vendor/lib/hw/gatekeeper.exynos9825.so --vendor/lib64/hw/gatekeeper.exynos9825.so +vendor/lib/hw/gatekeeper.exynos9825.so +vendor/lib64/hw/gatekeeper.exynos9825.so ## GPS --vendor/bin/hw/gpsd --vendor/bin/hw/vendor.samsung.hardware.gnss@2.1-service +vendor/bin/hw/gpsd +vendor/bin/hw/vendor.samsung.hardware.gnss@2.1-service vendor/etc/gnss/gps.xml vendor/etc/init/init.gps.rc vendor/etc/init/vendor.samsung.hardware.gnss@2.1-service.rc --vendor/lib64/libwrappergps.so --vendor/lib64/vendor.samsung.hardware.gnss@2.1.so --vendor/lib64/hw/gps.default.so --vendor/lib64/hw/android.hardware.gnss@2.1-impl.so --vendor/lib64/hw/vendor.samsung.hardware.gnss@2.1-impl.so +vendor/lib64/libwrappergps.so +vendor/lib64/vendor.samsung.hardware.gnss@2.1.so +vendor/lib64/hw/gps.default.so;FIX_SONAME +vendor/lib64/hw/android.hardware.gnss@2.1-impl.so;FIX_SONAME +vendor/lib64/hw/vendor.samsung.hardware.gnss@2.1-impl.so ## NFC vendor/firmware/nfc/sec_s3nrn82_firmware.bin @@ -112,12 +107,12 @@ vendor/etc/plmn_se13.bin vendor/etc/init/init.baseband.rc ## Sensors --vendor/bin/hw/lhd +vendor/bin/hw/lhd vendor/etc/sensor/lhd.conf --vendor/lib/sensors.bio.so --vendor/lib/sensors.sensorhub.so --vendor/lib64/sensors.bio.so --vendor/lib64/sensors.sensorhub.so +vendor/lib/sensors.bio.so +vendor/lib/sensors.sensorhub.so +vendor/lib64/sensors.bio.so +vendor/lib64/sensors.sensorhub.so ## TEEGRIS Firmware vendor/tee/00000000-0000-0000-0000-000000534b4d @@ -130,11 +125,11 @@ vendor/tee/00000000-0000-0000-0000-657365447276 vendor/tee/driver/00000000-0000-0000-0000-53626f786476 ## VaultKeeper --vendor/bin/vaultkeeperd +vendor/bin/vaultkeeperd vendor/etc/init/vaultkeeper_common.rc --vendor/lib64/libstork_shared.so --vendor/lib64/libvkmanager_vendor.so --vendor/lib64/libvkservice.so +vendor/lib64/libstork_shared.so +vendor/lib64/libvkmanager_vendor.so +vendor/lib64/libvkservice.so ## Wi-Fi vendor/firmware/bcmdhd_clm.blob diff --git a/proprietary-firmware.txt b/proprietary-firmware.txt index 1b37467..a217ff3 100644 --- a/proprietary-firmware.txt +++ b/proprietary-firmware.txt @@ -1,33 +1,33 @@ # Firmware for model SM-N976B - from Samsung package version N976BXXS9HWHB -cm.bin_SM-N976B -dqmdbg.img_SM-N976B -keystorage.bin_SM-N976B -modem.bin_SM-N976B -modem_5g.bin_SM-N976B -modem_debug.bin_SM-N976B -modem_debug_5g.bin_SM-N976B -param.bin_SM-N976B -sboot.bin_SM-N976B -uh.bin_SM-N976B -up_param.bin_SM-N976B +cm.bin_SM-N976B|98b8824c149838c9fb2490a7811f0f34ee28dd87 +dqmdbg.img_SM-N976B|31343f06c117d1b72261b1a7ac459d5c69db5716 +keystorage.bin_SM-N976B|ae0fec716563d2c1bbba8738a2abac0ebf4b7552 +modem.bin_SM-N976B|404011bd63c3b5d2a6ec9bffe15bfdea2e7e36cd +modem_5g.bin_SM-N976B|c15804b5d8c52c5d4e5e6e54f216793072e35b38 +modem_debug.bin_SM-N976B|a61ae264f1289a880b623cdb0575f6c386cfcd58 +modem_debug_5g.bin_SM-N976B|60d4b43a1e791ed512d0bc0ff9eaf049c28ffb31 +param.bin_SM-N976B|9e98ab97cb1528796416a32168b903ebe3b46756 +sboot.bin_SM-N976B|4c365e1d1b1bcf0fbcfff12138cd6e2f433b19e7 +uh.bin_SM-N976B|5d1b8b1a859023181957eb8572870f0914069880 +up_param.bin_SM-N976B|94dafb982f44725c8cb5431a35df3f513ccdd287 # Firmware for model SM-N976N - from Samsung package version N976NKSU2HWH5 -cm.bin_SM-N976N -dqmdbg.img_SM-N976N -keystorage.bin_SM-N976N -modem.bin_SM-N976N -modem_5g.bin_SM-N976N -modem_debug.bin_SM-N976N -modem_debug_5g.bin_SM-N976N -param.bin_SM-N976N -sboot.bin_SM-N976N -uh.bin_SM-N976N -up_param.bin_SM-N976N +cm.bin_SM-N976N|a6f47c31b01328191f1c24824029434abb2876b1 +dqmdbg.img_SM-N976N|d44821c2e15dea283076cb4e9759e3905c6fe4f0 +keystorage.bin_SM-N976N|7476e6d58c09957d560c7f2e0201d17e497997a1 +modem.bin_SM-N976N|4e97917cf22ae6ba980717abbfad4fe6d8255bef +modem_5g.bin_SM-N976N|31ea54305b178dbc2179496d50558e95dafc073c +modem_debug.bin_SM-N976N|e7572d7c0326514dd9275400a1b8c2033da3bc7f +modem_debug_5g.bin_SM-N976N|4a24b00f255aaf201ab5b8732cf284bb8dd5e73c +param.bin_SM-N976N|98ac2ea8eb3cf09a1ba0eda7ae7a41caadf6f6dc +sboot.bin_SM-N976N|037b9d82177e0a42714eece4ebfb3326def247a9 +uh.bin_SM-N976N|96e67a2fde9c315a7c690b9a3717cb9b52b03de3 +up_param.bin_SM-N976N|55bd744c70c387ef4cf763612b9e6c3cd6ad9b33 # File containing the supported models, one per line -models +models|3355889615e4a8ae46a6218e5c266655cc079cd9 # Files containing Samsung package version for supported models -version_SM-N976B -version_SM-N976N +version_SM-N976B|b5c0b6cbf96934f87af8437e550f0dbea1041828 +version_SM-N976N|df5b6f74665415b5ff9c437f84c1759a25fc3280 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 295cf94..0000000 --- a/setup-makefiles.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project -# -# SPDX-License-Identifier: Apache-2.0 -# - -# 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=d2x -export DEVICE_COMMON=exynos9820-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/extract-files.sh" "$@"