diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..58ffbdd --- /dev/null +++ b/extract-files.py @@ -0,0 +1,54 @@ +#!/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'), +} # fmt: skip + +module = ExtractUtilsModule( + 'd1', + '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 19aa7ec..0000000 --- a/extract-files.sh +++ /dev/null @@ -1,38 +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}" - ;; - 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=d1 -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 dcb9006..428ab25 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,8 +25,8 @@ vendor/firmware/bcm4375B1_semco.hcd vendor/firmware/bcm4375B1_semco_sem.hcd ## Camera - from d1 - N970FXXS7GVB1 --vendor/lib64/hw/camera.exynos9825.so|63a55d3796921c03c331a63fa57cd17987442677 --vendor/lib64/libexynoscamera3.so|dba359984d33b5f5c5be532aa28cb4f029773c19 +vendor/lib64/hw/camera.exynos9825.so|63a55d3796921c03c331a63fa57cd17987442677 +vendor/lib64/libexynoscamera3.so|dba359984d33b5f5c5be532aa28cb4f029773c19|dba359984d33b5f5c5be532aa28cb4f029773c19 ## Camera Firmware vendor/firmware/fimc_is_fw_mcu.bin @@ -37,10 +37,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 @@ -80,20 +78,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 @@ -104,12 +102,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 @@ -122,11 +120,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 eb51cec..8699e32 100644 --- a/proprietary-firmware.txt +++ b/proprietary-firmware.txt @@ -1,16 +1,16 @@ # Firmware for model SM-N970F - from Samsung package version N970FXXS9HWHA -cm.bin_SM-N970F -dqmdbg.img_SM-N970F -keystorage.bin_SM-N970F -modem.bin_SM-N970F -modem_debug.bin_SM-N970F -param.bin_SM-N970F -sboot.bin_SM-N970F -uh.bin_SM-N970F -up_param.bin_SM-N970F +cm.bin_SM-N970F|40ebf495dc7d6ddf4292c6862cd203c617bf5a97 +dqmdbg.img_SM-N970F|487728143785bbda7e94891c510861036c5a317e +keystorage.bin_SM-N970F|36d364a7880f6520c9ec2ae8f49e89f4072ce8bc +modem.bin_SM-N970F|e71c5c7a8e5de3fc97d0b577c6eb2f6cc228977a +modem_debug.bin_SM-N970F|4ad824e0ae17382637892f20d4f5df384e58fc09 +param.bin_SM-N970F|536d142fa04e05364b42d11c192e04784b060c01 +sboot.bin_SM-N970F|c6e004b766fbba97700747e4f2da531efaa4071e +uh.bin_SM-N970F|610a16f5e94bb1f495088894c14d9a779ebfdb7f +up_param.bin_SM-N970F|9f49e38c209b04f240129d1428a3e3a0f80cd7db # File containing the supported models, one per line -models +models|c55950824b82b88c5f0fcade4700eec3f44c9cb8 # Files containing Samsung package version for supported models -version_SM-N970F +version_SM-N970F|92167d89c5cdfc317ec76291c49022e4e763242b 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 d33db03..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=d1 -export DEVICE_COMMON=exynos9820-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/extract-files.sh" "$@"