diff --git a/extract-files.py b/extract-files.py new file mode 100755 index 0000000..f0c52c5 --- /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( + 'beyond1lte', + '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 ab57a3a..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=beyond1lte -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 7c90913..f6a2e4c 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 @@ -27,8 +27,8 @@ vendor/firmware/bcm4375B1_semco.hcd vendor/firmware/bcm4375B1_semco_sem.hcd ## Camera - from beyond1lte - G973FXXSEGVA9 --vendor/lib64/hw/camera.exynos9820.so|2399a48b9e4187a8f2de083c21f8d99767bee62b --vendor/lib64/libexynoscamera3.so|67c555e3af1b20a7754a448466ad7e9fdccd5b03 +vendor/lib64/hw/camera.exynos9820.so|2399a48b9e4187a8f2de083c21f8d99767bee62b +vendor/lib64/libexynoscamera3.so|67c555e3af1b20a7754a448466ad7e9fdccd5b03|67c555e3af1b20a7754a448466ad7e9fdccd5b03 ## Camera Firmware vendor/firmware/fimc_is_fw_mcu.bin @@ -39,10 +39,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/bidirmic.bin @@ -68,19 +66,19 @@ vendor/firmware/txse3.bin vendor/firmware/vts.bin ## Gatekeeper --vendor/lib/hw/gatekeeper.exynos9820.so --vendor/lib64/hw/gatekeeper.exynos9820.so +vendor/lib/hw/gatekeeper.exynos9820.so +vendor/lib64/hw/gatekeeper.exynos9820.so ## GPS --vendor/bin/hw/gpsd --vendor/bin/hw/vendor.samsung.hardware.gnss@2.0-service +vendor/bin/hw/gpsd +vendor/bin/hw/vendor.samsung.hardware.gnss@2.0-service vendor/etc/gnss/gps.xml vendor/etc/init/init.gps.rc vendor/etc/init/vendor.samsung.hardware.gnss@2.0-service.rc --vendor/lib64/libwrappergps.so --vendor/lib64/hw/android.hardware.gnss@2.0-impl.so --vendor/lib64/hw/gps.default.so --vendor/lib64/hw/vendor.samsung.hardware.gnss@2.0-impl.so +vendor/lib64/libwrappergps.so +vendor/lib64/hw/android.hardware.gnss@2.0-impl.so;FIX_SONAME +vendor/lib64/hw/gps.default.so;FIX_SONAME +vendor/lib64/hw/vendor.samsung.hardware.gnss@2.0-impl.so ## NFC vendor/firmware/nfc/sec_s3nrn82_firmware.bin @@ -91,12 +89,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 @@ -109,11 +107,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 4334458..3c379a2 100644 --- a/proprietary-firmware.txt +++ b/proprietary-firmware.txt @@ -1,29 +1,29 @@ # Firmware for model SM-G973F - from Samsung package version G973FXXSGHWC2 -cm.bin_SM-G973F -dqmdbg.img_SM-G973F -keystorage.bin_SM-G973F -modem.bin_SM-G973F -modem_debug.bin_SM-G973F -param.bin_SM-G973F -sboot.bin_SM-G973F -uh.bin_SM-G973F -up_param.bin_SM-G973F +cm.bin_SM-G973F|f9c7f55ae776e331df7e9cfddf41137dd98dc757 +dqmdbg.img_SM-G973F|867d39fb839488472e24a151985b0dd4cb3662af +keystorage.bin_SM-G973F|1ec505909291ff464f63f38d520b76e427d4908a +modem.bin_SM-G973F|9f56964ec570d709911403fd414b4efe028792b9 +modem_debug.bin_SM-G973F|4feba681a7d9efe99ea0cd465963f7d96dd17611 +param.bin_SM-G973F|cc375acf6889812b47e8762b59ca75d27b27ddc1 +sboot.bin_SM-G973F|0224b1568d3ec348bad2918e0bf81214aab7f5c5 +uh.bin_SM-G973F|cc28604dfddc06cada9bdb60d96aaf248c64ae7c +up_param.bin_SM-G973F|218c771da641276525130bf9315c620af753aad8 # Firmware for model SM-G973N - from Samsung package version G973NKSU7HWD3 -cm.bin_SM-G973N -dqmdbg.img_SM-G973N -keystorage.bin_SM-G973N -modem.bin_SM-G973N -modem_debug.bin_SM-G973N -param.bin_SM-G973N -sboot.bin_SM-G973N -uh.bin_SM-G973N -up_param.bin_SM-G973N +cm.bin_SM-G973N|98c7df501900895823a34ccdfc5240865814e0e4 +dqmdbg.img_SM-G973N|2a3b4f162457c8eb57de62b2a6afbcd60ee6ef28 +keystorage.bin_SM-G973N|19942b7434a87f38157b23d9e5686fd528eeecbd +modem.bin_SM-G973N|4ca61d5034ecca16f05020a2ce7c20c1d11e3794 +modem_debug.bin_SM-G973N|a94fd4eb38007bfcbe4ef88b941c1d5c2940bf8c +param.bin_SM-G973N|9721305e65c13d1686c51e21b765888ba424f0c0 +sboot.bin_SM-G973N|d06d7694c96ad8cec92dbd2594f8ee43ef6f6ae0 +uh.bin_SM-G973N|5427dba6bd330bf2812675bf7c46fd2f8e9972cc +up_param.bin_SM-G973N|aa8573639dbd7886b7ff4ae18bd92e9815424320 # File containing the supported models, one per line -models +models|1ef6255117afcaec2ba8beb1a9e613d825abcf82 # Files containing Samsung package version for supported models -version_SM-G973F -version_SM-G973N +version_SM-G973F|de6872e8d6a90daf76705d100655233273ca1032 +version_SM-G973N|e725ea0d3f4f826612cd563f2b4eaed9e19973a6 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 a39174a..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=beyond1lte -export DEVICE_COMMON=exynos9820-common -export VENDOR=samsung - -"./../../${VENDOR}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"