From f49074ef2c2c2b8b7b7c3f07a80b5a6524acba9e Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Thu, 28 Jan 2021 23:20:50 -0500 Subject: [PATCH 1/2] New package: idevicerestore-1.0.0 --- ...0001-configure.ac-check-for-pthreads.patch | 25 +++++++++ ...a21ef68d170a3fee6a58eeb4ff71399fff97.patch | 23 ++++++++ ...5c63f585e42b32f450e4a1ab926eb9b964d2.patch | 22 ++++++++ .../patches/WirelessChargingFix.patch | 53 +++++++++++++++++++ srcpkgs/idevicerestore/template | 19 +++++++ 5 files changed, 142 insertions(+) create mode 100644 srcpkgs/idevicerestore/patches/0001-configure.ac-check-for-pthreads.patch create mode 100644 srcpkgs/idevicerestore/patches/1d29a21ef68d170a3fee6a58eeb4ff71399fff97.patch create mode 100644 srcpkgs/idevicerestore/patches/33285c63f585e42b32f450e4a1ab926eb9b964d2.patch create mode 100644 srcpkgs/idevicerestore/patches/WirelessChargingFix.patch create mode 100644 srcpkgs/idevicerestore/template diff --git a/srcpkgs/idevicerestore/patches/0001-configure.ac-check-for-pthreads.patch b/srcpkgs/idevicerestore/patches/0001-configure.ac-check-for-pthreads.patch new file mode 100644 index 000000000000..49dd81525639 --- /dev/null +++ b/srcpkgs/idevicerestore/patches/0001-configure.ac-check-for-pthreads.patch @@ -0,0 +1,25 @@ +From 66dc1fa84fbe65f1008255d2b1d9bced9cf9dce6 Mon Sep 17 00:00:00 2001 +From: Ivan Shapovalov +Date: Fri, 25 Sep 2015 23:37:27 +0300 +Subject: [PATCH] configure.ac: check for pthreads + +Fixes building at least on Arch. +--- + configure.ac | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configure.ac b/configure.ac +index 1db709a..c722910 100644 +--- configure.ac ++++ configure.ac +@@ -35,6 +35,7 @@ AM_PROG_CC_C_O + AC_PROG_LIBTOOL + + # Checks for libraries. ++AC_SEARCH_LIBS([pthread_create], [pthread]) + PKG_CHECK_MODULES(libirecovery, libirecovery-1.0 >= $LIBIRECOVERY_VERSION) + PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= $LIBIMOBILEDEVICE_VERSION) + PKG_CHECK_MODULES(libplist, libplist-2.0 >= $LIBPLIST_VERSION) +-- +2.27.0 + diff --git a/srcpkgs/idevicerestore/patches/1d29a21ef68d170a3fee6a58eeb4ff71399fff97.patch b/srcpkgs/idevicerestore/patches/1d29a21ef68d170a3fee6a58eeb4ff71399fff97.patch new file mode 100644 index 000000000000..500a0455f505 --- /dev/null +++ b/srcpkgs/idevicerestore/patches/1d29a21ef68d170a3fee6a58eeb4ff71399fff97.patch @@ -0,0 +1,23 @@ +From 1d29a21ef68d170a3fee6a58eeb4ff71399fff97 Mon Sep 17 00:00:00 2001 +From: Nikias Bassen +Date: Tue, 27 Oct 2020 18:02:52 +0100 +Subject: [PATCH] restore: Add new baseband firmware file mapping for Mav20 + basebands (iPhone 12) + +--- + src/restore.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/restore.c b/src/restore.c +index e35047a..4f167ea 100644 +--- src/restore.c ++++ src/restore.c +@@ -1282,6 +1282,8 @@ static const char* restore_get_bbfw_fn_for_element(const char* elem) + // ICE19 firmware files + { "RestorePSI2", "restorepsi2.bin" }, + { "PSI2", "psi_ram2.bin" }, ++ // Mav20 Firmware file ++ { "Misc", "multi_image.mbn" }, + { NULL, NULL } + }; + diff --git a/srcpkgs/idevicerestore/patches/33285c63f585e42b32f450e4a1ab926eb9b964d2.patch b/srcpkgs/idevicerestore/patches/33285c63f585e42b32f450e4a1ab926eb9b964d2.patch new file mode 100644 index 000000000000..806b778667b1 --- /dev/null +++ b/srcpkgs/idevicerestore/patches/33285c63f585e42b32f450e4a1ab926eb9b964d2.patch @@ -0,0 +1,22 @@ +From 33285c63f585e42b32f450e4a1ab926eb9b964d2 Mon Sep 17 00:00:00 2001 +From: Nikias Bassen +Date: Tue, 27 Oct 2020 23:28:30 +0100 +Subject: [PATCH] restore: Add SE,ChipID 0xD2 for iPhone 12 SE firmware + +--- + src/restore.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/restore.c b/src/restore.c +index 841990d..adea97a 100644 +--- src/restore.c ++++ src/restore.c +@@ -1985,7 +1985,7 @@ static plist_t restore_get_se_firmware_data(restored_client_t restore, struct id + } + if (chip_id == 0x20211) { + comp_name = "SE,Firmware"; +- } else if (chip_id == 0x73 || chip_id == 0x64 || chip_id == 0xC8) { ++ } else if (chip_id == 0x73 || chip_id == 0x64 || chip_id == 0xC8 || chip_id == 0xD2) { + comp_name = "SE,UpdatePayload"; + } else { + info("WARNING: Unknown SE,ChipID 0x%" PRIx64 " detected. Restore might fail.\n", (uint64_t)chip_id); diff --git a/srcpkgs/idevicerestore/patches/WirelessChargingFix.patch b/srcpkgs/idevicerestore/patches/WirelessChargingFix.patch new file mode 100644 index 000000000000..3c8a98eb865a --- /dev/null +++ b/srcpkgs/idevicerestore/patches/WirelessChargingFix.patch @@ -0,0 +1,53 @@ +From 18ba27c74305100146dd9599336dbdcd5e794ad1 Mon Sep 17 00:00:00 2001 +From: Nikias Bassen +Date: Mon, 12 Oct 2020 17:56:20 +0200 +Subject: [PATCH] restore: Fix NORData request by sending new components (fixes + wireless charging on newer devices) + +The NorImageData response didn't include the WCHFirmwareUpdater for newer +devices, resulting in wireless charging capability to be broken on iPhone XS, +iPhone XR, and newer. Upon further inspection it turned out that the selection +for the images to send was only based on `IsFirmwarePayload` property. +However, there are additional components with other properties, as the +WCHFirmwareUpdater one, that don't have the `IsFirmwarePayload` property but +instead `IsSecondaryFirmwarePayload` and `IsLoadedByiBoot` which seem to be +the rule for including these images. +--- + src/restore.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/src/restore.c b/src/restore.c +index 3e84689..e35047a 100644 +--- src/restore.c ++++ src/restore.c +@@ -1059,11 +1059,26 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* + plist_dict_next_item(build_id_manifest, iter, &component, &manifest_entry); + if (component && manifest_entry && plist_get_node_type(manifest_entry) == PLIST_DICT) { + uint8_t is_fw = 0; +- plist_t is_fw_node = plist_access_path(manifest_entry, 2, "Info", "IsFirmwarePayload"); +- if (is_fw_node && plist_get_node_type(is_fw_node) == PLIST_BOOLEAN) { +- plist_get_bool_val(is_fw_node, &is_fw); ++ uint8_t is_secondary_fw = 0; ++ uint8_t loaded_by_iboot = 0; ++ plist_t fw_node; ++ ++ fw_node = plist_access_path(manifest_entry, 2, "Info", "IsFirmwarePayload"); ++ if (fw_node && plist_get_node_type(fw_node) == PLIST_BOOLEAN) { ++ plist_get_bool_val(fw_node, &is_fw); ++ } ++ ++ fw_node = plist_access_path(manifest_entry, 2, "Info", "IsLoadedByiBoot"); ++ if (fw_node && plist_get_node_type(fw_node) == PLIST_BOOLEAN) { ++ plist_get_bool_val(fw_node, &loaded_by_iboot); + } +- if (is_fw) { ++ ++ fw_node = plist_access_path(manifest_entry, 2, "Info", "IsSecondaryFirmwarePayload"); ++ if (fw_node && plist_get_node_type(fw_node) == PLIST_BOOLEAN) { ++ plist_get_bool_val(fw_node, &is_secondary_fw); ++ } ++ ++ if (is_fw || (is_secondary_fw && loaded_by_iboot)) { + plist_t comp_path = plist_access_path(manifest_entry, 2, "Info", "Path"); + if (comp_path) { + plist_dict_set_item(firmware_files, component, plist_copy(comp_path)); diff --git a/srcpkgs/idevicerestore/template b/srcpkgs/idevicerestore/template new file mode 100644 index 000000000000..3549a50cc89c --- /dev/null +++ b/srcpkgs/idevicerestore/template @@ -0,0 +1,19 @@ +# Template file for 'idevicerestore' +pkgname=idevicerestore +version=1.0.0 +revision=1 +build_style=gnu-configure +hostmakedepends="automake libtool pkg-config" +makedepends="libimobiledevice-devel libplist-devel libressl-devel + libzip-devel readline-devel libcurl-devel libirecovery-devel" +depends="usbmuxd" +short_desc="Command-line application to restore firmware files to iOS devices" +maintainer="Orphaned " +license="GPL-2.0-or-later" +homepage="https://github.com/libimobiledevice/idevicerestore" +distfiles="https://github.com/libimobiledevice/${pkgname}/archive/${version}.tar.gz" +checksum=2c83c60b8b7027b3730d63c3ebbdede5b0b43bd5ab1e54caaa52b3b1268881e5 + +pre_configure() { + autoreconf -fi +} From ca11c4f17700c6d0d4cb6af87c8af43c0ede9f19 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Sat, 13 Feb 2021 10:27:49 -0500 Subject: [PATCH 2/2] New package: libirecovery-1.0.0 --- common/shlibs | 1 + srcpkgs/libirecovery-devel | 1 + srcpkgs/libirecovery/template | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 120000 srcpkgs/libirecovery-devel create mode 100644 srcpkgs/libirecovery/template diff --git a/common/shlibs b/common/shlibs index 91a9d7a282e7..c526df47c21b 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4037,3 +4037,4 @@ libwinbind-client-samba4.so samba-libs-4.13.2_1 libsixel.so.1 libsixel-1.8.6_1 libpamtest.so.0 pam_wrapper-1.1.3_1 libopenaptx.so.0 libopenaptx-0.2.0_1 +libirecovery-1.0.so.3 libirecovery-1.0.0_1 diff --git a/srcpkgs/libirecovery-devel b/srcpkgs/libirecovery-devel new file mode 120000 index 000000000000..d093190e4fa9 --- /dev/null +++ b/srcpkgs/libirecovery-devel @@ -0,0 +1 @@ +libirecovery \ No newline at end of file diff --git a/srcpkgs/libirecovery/template b/srcpkgs/libirecovery/template new file mode 100644 index 000000000000..c458513b3f54 --- /dev/null +++ b/srcpkgs/libirecovery/template @@ -0,0 +1,28 @@ +# Template file for 'libirecovery' +pkgname=libirecovery +version=1.0.0 +revision=1 +build_style=gnu-configure +hostmakedepends="automake libtool pkgconf" +makedepends="libusb-devel readline-devel ncurses-devel eudev-libudev-devel" +short_desc="Allows communication with iBoot/iBSS of iOS devices via USB" +maintainer="Orphaned " +license="LGPL-2.1-only" +homepage="https://github.com/libimobiledevice/libirecovery" +distfiles="https://github.com/libimobiledevice/libirecovery/archive/${version}.tar.gz" +checksum=b0228372ae17fc78492f67932caea1c7f04d6a5da3468f240a6dac9173b29864 + +pre_configure() { + autoreconf -fi +} + +libirecovery-devel_package() { + short_desc+=" - development files" + depends="${makedepends} ${sourcepkg}>=${version}_${revision}" + pkg_install() { + vmove usr/include + vmove usr/lib/*.a + vmove usr/lib/*.so + vmove usr/lib/pkgconfig + } +}