From ac78b820e4144617f80c27f866f153f49ffdd92e Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Tue, 5 May 2015 01:02:14 +0200 Subject: Improved command sequence and use SystemPartitionPadding from build identity to make sure we use correct values. --- src/recovery.c | 15 +++++++++------ src/restore.c | 12 +++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/recovery.c b/src/recovery.c index 5930db6..c21af19 100644 --- a/src/recovery.c +++ b/src/recovery.c @@ -164,10 +164,6 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build } } - if (recovery_set_autoboot(client, 0) < 0) { - return -1; - } - info("Recovery Mode Environment:\n"); char* value = NULL; irecv_getenv(client->recovery->client, "build-version", &value); @@ -197,6 +193,10 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build } } + if (recovery_set_autoboot(client, 0) < 0) { + return -1; + } + /* send logo and show it */ if (recovery_send_applelogo(client, build_identity) < 0) { error("ERROR: Unable to send AppleLogo\n"); @@ -393,8 +393,11 @@ int recovery_send_ramdisk(struct idevicerestore_client_t* client, plist_t build_ } } - irecv_send_command(client->recovery->client, "getenv ramdisk-size"); - irecv_receive(client->recovery->client); + char* value = NULL; + irecv_getenv(client->recovery->client, "ramdisk-size", &value); + info("ramdisk-size=%s\n", (value ? value : "(unknown)")); + free(value); + value = NULL; if (recovery_send_component(client, build_identity, component) < 0) { error("ERROR: Unable to send %s to device.\n", component); diff --git a/src/restore.c b/src/restore.c index 79e1828..aa352c5 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1805,17 +1805,19 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit // FIXME: not required for iOS 5? //plist_dict_set_item(opts, "SourceRestoreBundlePath", plist_new_string("/tmp")); plist_dict_set_item(opts, "SystemImage", plist_new_bool(1)); - plist_t spp = plist_new_dict(); - { + // FIXME: new on iOS 5 ? + plist_dict_set_item(opts, "SystemImageType", plist_new_string("User")); + plist_t spp = plist_access_path(build_identity, 2, "Info", "SystemPartitionPadding"); + if (spp) { + spp = plist_copy(spp); + } else { + spp = plist_new_dict(); plist_dict_set_item(spp, "128", plist_new_uint(1280)); plist_dict_set_item(spp, "16", plist_new_uint(160)); plist_dict_set_item(spp, "32", plist_new_uint(320)); plist_dict_set_item(spp, "64", plist_new_uint(640)); plist_dict_set_item(spp, "8", plist_new_uint(80)); } - // FIXME: new on iOS 5 ? - plist_dict_set_item(opts, "SystemImageType", plist_new_string("User")); - plist_dict_set_item(opts, "SystemPartitionPadding", spp); char* guid = generate_guid(); if (guid) { -- cgit v1.1-32-gdbae