summaryrefslogtreecommitdiffstats
path: root/src/recovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recovery.c')
-rw-r--r--src/recovery.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/recovery.c b/src/recovery.c
index b6a6f51..e3fb4d1 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -124,7 +124,7 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
{
if (client->build_major >= 8) {
client->restore_boot_args = strdup("rd=md0 nand-enable-reformat=1 -progress");
- } else if (client->build_major >= 20) {
+ } else if (client->macos_variant) {
client->restore_boot_args = strdup("rd=md0 nand-enable-reformat=1 -progress -restore");
}
@@ -158,6 +158,20 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
free(value);
value = NULL;
+ unsigned long boot_stage = 0;
+ irecv_getenv(client->recovery->client, "boot-stage", &value);
+ if (value) {
+ boot_stage = strtoul(value, NULL, 0);
+ }
+ if (boot_stage > 0) {
+ info("iBoot boot-stage=%s\n", value);
+ free(value);
+ value = NULL;
+ if (boot_stage != 2) {
+ error("ERROR: iBoot should be at boot stage 2, continuing anyway...\n");
+ }
+ }
+
unsigned long radio_error = 0;
irecv_getenv(client->recovery->client, "radio-error", &value);
if (value) {
@@ -344,7 +358,7 @@ int recovery_send_ibec(struct idevicerestore_client_t* client, plist_t build_ide
return -1;
}
- recovery_error = irecv_send_command(client->recovery->client, "go");
+ recovery_error = irecv_send_command_breq(client->recovery->client, "go", 1);
if (recovery_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to execute %s\n", component);
return -1;
@@ -498,7 +512,7 @@ int recovery_send_kernelcache(struct idevicerestore_client_t* client, plist_t bu
recovery_error = irecv_send_command(client->recovery->client, setba);
}
- recovery_error = irecv_send_command(client->recovery->client, "bootx");
+ recovery_error = irecv_send_command_breq(client->recovery->client, "bootx", 1);
if (recovery_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to execute %s\n", component);
return -1;
@@ -507,24 +521,6 @@ int recovery_send_kernelcache(struct idevicerestore_client_t* client, plist_t bu
return 0;
}
-int recovery_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid)
-{
- if(client->recovery == NULL) {
- if (recovery_client_new(client) < 0) {
- return -1;
- }
- }
-
- const struct irecv_device_info *device_info = irecv_get_device_info(client->recovery->client);
- if (!device_info) {
- return -1;
- }
-
- *ecid = device_info->ecid;
-
- return 0;
-}
-
int recovery_is_image4_supported(struct idevicerestore_client_t* client)
{
if(client->recovery == NULL) {
@@ -541,7 +537,7 @@ int recovery_is_image4_supported(struct idevicerestore_client_t* client)
return (device_info->ibfl & IBOOT_FLAG_IMAGE4_AWARE);
}
-int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
+int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->recovery == NULL) {
if (recovery_client_new(client) < 0) {
@@ -566,7 +562,7 @@ int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char*
return 0;
}
-int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
+int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->recovery == NULL) {
if (recovery_client_new(client) < 0) {
@@ -593,7 +589,7 @@ int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char
int recovery_send_reset(struct idevicerestore_client_t* client)
{
- irecv_send_command(client->recovery->client, "reset");
+ irecv_send_command_breq(client->recovery->client, "reset", 1);
return 0;
}