Browse Source

Merge pull request #10785 from neheb/apple

[WIP]Add idevicerestore
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
e6e3de1d0f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 271 additions and 27 deletions
  1. +13
    -10
      libs/libimobiledevice/Makefile
  2. +69
    -0
      libs/libimobiledevice/patches/010-format.patch
  3. +84
    -0
      libs/libirecovery/Makefile
  4. +8
    -6
      libs/libplist/Makefile
  5. +6
    -3
      libs/libusbmuxd/Makefile
  6. +47
    -0
      utils/idevicerestore/Makefile
  7. +16
    -8
      utils/usbmuxd/Makefile
  8. +17
    -0
      utils/usbmuxd/files/usbmuxd.init
  9. +11
    -0
      utils/usbmuxd/patches/010-config.patch

+ 13
- 10
libs/libimobiledevice/Makefile View File

@ -8,28 +8,28 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libimobiledevice
PKG_SOURCE_DATE:=2019-11-29
PKG_SOURCE_VERSION:=9f79242a441ce37c28db2b84d49621d26418dc53
PKG_SOURCE_DATE:=2019-12-16
PKG_SOURCE_VERSION:=d04f8ff2e20c42f74161c9cd66502da17b8b0e70
PKG_RELEASE:=1
PKG_MAINTAINER:=
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING.LESSER
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/libimobiledevice/libimobiledevice
PKG_MIRROR_HASH:=709a3f8632930be272020a2ff5109aab5a6dddda39580d60e4f5eacace857e08
PKG_MIRROR_HASH:=f3ea7b5cd9789dc23ddc464bd00f39813116239cfe4ea1f13f58ce5a8413c361
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING.LESSER
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/libimobiledevice/Default
TITLE:=A library that talks to Apple devices.
URL:=https://www.libimobiledevice.org/
SUBMENU:=libimobiledevice
endef
define Package/libimobiledevice/Default/description
@ -41,7 +41,9 @@ define Package/libimobiledevice
$(call Package/libimobiledevice/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=$(ICONV_DEPENDS) +libplist +libusbmuxd +libopenssl
DEPENDS:=+libplist +libusbmuxd +libopenssl
LICENSE:=LGPL-2.1-or-later
LICENSE_FILES:=COPYING.LESSER
endef
define Package/libimobiledevice/description
@ -53,6 +55,8 @@ define Package/libimobiledevice-utils
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libimobiledevice
LICENSE:=GPL-2.0-or-later
ICENSE_FILES:=COPYING
endef
define Package/libimobiledevice-utils/description
@ -60,7 +64,6 @@ define Package/libimobiledevice-utils/description
This package contains the libimobiledevice utilities.
endef
CONFIGURE_VARS += ac_cv_sys_file_offset_bits=64
CONFIGURE_ARGS += --without-cython
define Build/InstallDev


+ 69
- 0
libs/libimobiledevice/patches/010-format.patch View File

@ -0,0 +1,69 @@
From ec2bba4ffe5a0939ba192b014ba594eaa964412f Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 8 Dec 2019 15:45:19 -0800
Subject: [PATCH] idevicedate: Fix -Wformat=2 warning
Format functions expect a constant expression, not a variable.
Simplified the code slightly.
---
tools/idevicedate.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index 4de90b63..6dddc185 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -38,9 +38,9 @@
#include <libimobiledevice/lockdown.h>
#ifdef _DATE_FMT
-#define DATE_FMT_LANGINFO() nl_langinfo (_DATE_FMT)
+#define DATE_FMT_LANGINFO nl_langinfo (_DATE_FMT)
#else
-#define DATE_FMT_LANGINFO() ""
+#define DATE_FMT_LANGINFO "%a %b %e %H:%M:%S %Z %Y"
#endif
static void print_usage(int argc, char **argv)
@@ -75,7 +75,6 @@ int main(int argc, char *argv[])
uint64_t datetime = 0;
time_t rawtime;
struct tm * tmp;
- char const *format = NULL;
char buffer[80];
int result = 0;
@@ -131,14 +130,6 @@ int main(int argc, char *argv[])
}
}
- /* determine a date format */
- if (!format) {
- format = DATE_FMT_LANGINFO ();
- if (!*format) {
- format = "%a %b %e %H:%M:%S %Z %Y";
- }
- }
-
ret = idevice_new(&device, udid);
if (ret != IDEVICE_E_SUCCESS) {
if (udid) {
@@ -195,7 +186,7 @@ int main(int argc, char *argv[])
tmp = localtime(&rawtime);
/* finally we format and print the current date */
- strftime(buffer, 80, format, tmp);
+ strftime(buffer, 80, DATE_FMT_LANGINFO, tmp);
puts(buffer);
} else {
datetime = setdate;
@@ -217,7 +208,7 @@ int main(int argc, char *argv[])
if(lockdownd_set_value(client, NULL, "TimeIntervalSince1970", node) == LOCKDOWN_E_SUCCESS) {
tmp = localtime(&setdate);
- strftime(buffer, 80, format, tmp);
+ strftime(buffer, 80, DATE_FMT_LANGINFO, tmp);
puts(buffer);
} else {
printf("ERROR: Failed to set date on device.\n");

+ 84
- 0
libs/libirecovery/Makefile View File

@ -0,0 +1,84 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libirecovery
PKG_SOURCE_DATE:=2019-12-16
PKG_SOURCE_VERSION:=db36196d8d9db5a1f92e6934cf931cd00a6ead2d
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/libimobiledevice/libirecovery
PKG_MIRROR_HASH:=635f790b97b7e0001050df6a604c2bcd5cc896213f2a2441f58cf0aa4e00f773
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libirecovery/Default
URL:=https://github.com/libimobiledevice/libirecovery
SUBMENU:=libimobiledevice
endef
define Package/libirecovery/Default/description
libirecovery is a cross-platform library which implements communication
to iBoot/iBSS found on Apple's iOS devices via USB.
endef
define Package/libirecovery
$(call Package/libirecovery/Default)
TITLE:=A library that talks to Apple iBoot/iBSS
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libreadline +libusb-1.0
endef
define Package/libirecovery/description
$(call Package/libirecovery/Default/description)
endef
define Package/irecovery
$(call Package/libirecovery/Default)
TITLE:=A utility that talks to Apple iBoot/iBSS
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libirecovery
endef
define Package/irecovery/description
$(call Package/libirecovery/Default/description)
This package contains the libirecovery utilities.
endef
CONFIGURE_ARGS += --without-udev
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/libirecovery.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libirecovery.{a,la,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libirecovery.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libirecovery/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libirecovery.so.* $(1)/usr/lib/
endef
define Package/irecovery/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/irecovery $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libirecovery))
$(eval $(call BuildPackage,irecovery))

+ 8
- 6
libs/libplist/Makefile View File

@ -9,13 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libplist
PKG_SOURCE_VERSION:=2.1.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/libimobiledevice/libplist
PKG_MIRROR_HASH:=452ef5d6e87461a8b7a47a2274878cf200ccf480b4e81924f22ec1c445e353d0
PKG_MAINTAINER:=
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_CPE_ID:=cpe:/a:libimobiledevice:libplist
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
@ -27,6 +28,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/libplist/Default
TITLE:=Apple property list
URL:=https://www.libimobiledevice.org/
SUBMENU:=libimobiledevice
endef
define Package/libplist/Default/description
@ -62,7 +64,7 @@ define Package/libplistcxx/description
This package contains the libplist C++ shared library.
endef
define Package/libplist-utils
define Package/plistutil
$(call Package/libplist/Default)
SECTION:=utils
CATEGORY:=Utilities
@ -72,7 +74,7 @@ define Package/libplist-utils
LICENSE_FILES:=COPYING
endef
define Package/libplist-utils/description
define Package/plistutil/description
$(call Package/libplist/Default/description)
This package contains the libplist utilities.
endef
@ -103,11 +105,11 @@ define Package/libplistcxx/install
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libplist++.so.* $(1)/usr/lib/
endef
define Package/libplist-utils/install
define Package/plistutil/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/plistutil $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libplist))
$(eval $(call BuildPackage,libplistcxx))
$(eval $(call BuildPackage,libplist-utils))
$(eval $(call BuildPackage,plistutil))

+ 6
- 3
libs/libusbmuxd/Makefile View File

@ -9,13 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=libusbmuxd
PKG_SOURCE_VERSION:=2.0.1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/libimobiledevice/libusbmuxd
PKG_MIRROR_HASH:=5078125cd4fe8c7294d4f195a8adfd1fc302101daf5d53e4cc242c3097eef8b6
PKG_MAINTAINER:=
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_CPE_ID:=cpe:/a:libimobiledevice:libusbmuxd
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
@ -26,6 +27,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/libusbmuxd/Default
TITLE:=USB multiplexing daemon
URL:=https://www.libimobiledevice.org/
SUBMENU:=libimobiledevice
endef
define Package/libusbmuxd/Default/description
@ -83,7 +85,8 @@ endef
define Package/libusbmuxd-utils/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/iproxy $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/iproxy $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inetcat $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libusbmuxd))


+ 47
- 0
utils/idevicerestore/Makefile View File

@ -0,0 +1,47 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=idevicerestore
PKG_SOURCE_DATE:=2019-12-13
PKG_SOURCE_VERSION:=a2a6ad16d2c3157153aae7e0835e478237b01507
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/libimobiledevice/idevicerestore
PKG_MIRROR_HASH:=522bd35a0a4e8cc64ef9b29716e88efd84829e81c9c00ce9170fef285ac4b137
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/idevicerestore
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=libimobiledevice
TITLE:=Restore/upgrade firmware of iOS devices
URL:=https://github.com/libimobiledevice/idevicerestore
DEPENDS:=+libirecovery +libzip +libcurl +usbmuxd
endef
define Package/idevicerestore/description
The idevicerestore tool allows to restore firmware files to iOS devices.
It is a full reimplementation of all granular steps which are performed
during restore of a firmware to a device.
endef
define Package/idevicerestore/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/idevicerestore $(1)/usr/bin/
endef
$(eval $(call BuildPackage,idevicerestore))

+ 16
- 8
utils/usbmuxd/Makefile View File

@ -8,18 +8,18 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=usbmuxd
PKG_SOURCE_DATE:=2019-11-11
PKG_SOURCE_VERSION:=9af2b12552693a47601347e1eafc1e94132d727e
PKG_SOURCE_DATE:=2019-12-16
PKG_SOURCE_VERSION:=ec5ff91cfabd30637f8af8f5c79baf4d7818ce57
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/libimobiledevice/usbmuxd
PKG_MIRROR_HASH:=f0b8a5c7ec1625c06b52b4403696c2b6bcbc0da5256bc097b7db053fb14b6892
PKG_MIRROR_HASH:=1d0f2fa3842fbcbebe4b7d323829703e29a3c1a078c62b4a783e4c99a8a2f576
PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Rosen Penev <rosenp@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING.GPLv2
PKG_CPE_ID:=cpe:/a:nikias_bassen:usbmuxd
PKG_CPE_ID:=cpe:/a:libimobiledevice:usbmuxd
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
@ -30,8 +30,9 @@ include $(INCLUDE_DIR)/package.mk
define Package/usbmuxd
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=libimobiledevice
TITLE:=USB multiplexing daemon
URL:=http://www.libimobiledevice.org/
URL:=https://www.libimobiledevice.org/
DEPENDS:=+librt +libusb-1.0 +libusbmuxd +libopenssl +libimobiledevice
endef
@ -43,11 +44,18 @@ define Package/usbmuxd/description
uses a dedicated USB interface as a virtual network device.
endef
define Package/usbmuxd/conffiles
/etc/lockdown
/etc/lockdown/SystemConfiguration.plist
endef
CONFIGURE_ARGS += --without-systemd
define Package/usbmuxd/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/usbmuxd.init $(1)/etc/init.d/usbmuxd
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/usbmuxd $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/usbmuxd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,usbmuxd))

+ 17
- 0
utils/usbmuxd/files/usbmuxd.init View File

@ -0,0 +1,17 @@
#!/bin/sh /etc/rc.common
START=94
USE_PROCD=1
PROG=/usr/sbin/usbmuxd
start_service() {
procd_open_instance
procd_set_param command $PROG -f
procd_set_param stderr 1
procd_close_instance
}
reload_service() {
procd_send_signal $PROG
}

+ 11
- 0
utils/usbmuxd/patches/010-config.patch View File

@ -0,0 +1,11 @@
--- a/src/conf.c
+++ b/src/conf.c
@@ -126,7 +126,7 @@ const char *config_get_config_dir()
#ifdef __APPLE__
base_config_dir = strdup("/var/db");
#else
- base_config_dir = strdup("/var/lib");
+ base_config_dir = strdup("/etc");
#endif
#endif
__config_dir = string_concat(base_config_dir, DIR_SEP_S, CONFIG_DIR, NULL);

Loading…
Cancel
Save