summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-10-02 20:56:18 +0200
committerGravatar Nikias Bassen2025-10-02 20:56:18 +0200
commit460bf2e85b4e1dd01a3b87d18bc932805642079c (patch)
treeba680682fa225ac11a0e785701ae12f2be610b6e /src
parentfb46a9db2d8d11dc98d2bf6d61754e4c8f185460 (diff)
downloadidevicerestore-460bf2e85b4e1dd01a3b87d18bc932805642079c.tar.gz
idevicerestore-460bf2e85b4e1dd01a3b87d18bc932805642079c.tar.bz2
Fix baseband processing with Mav25 (and possibly others too)
Diffstat (limited to 'src')
-rw-r--r--src/idevicerestore.c8
-rw-r--r--src/idevicerestore.h1
-rw-r--r--src/restore.c17
3 files changed, 17 insertions, 9 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 809f935..04070a1 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -171,8 +171,6 @@ const uint8_t lpol_file[22] = {
};
const uint32_t lpol_file_length = 22;
-static int idevicerestore_keep_pers = 0;
-
static int load_version_data(struct idevicerestore_client_t* client)
{
if (!client) {
@@ -814,7 +812,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
plist_free(response);
free(uarp_buf);
- if (idevicerestore_keep_pers) {
+ if (client->flags & FLAG_KEEP_PERS) {
write_file("Ace3Binary", ace3bin, ace3bin_size);
}
@@ -1907,7 +1905,7 @@ int main(int argc, char* argv[])
break;
case 'k':
- idevicerestore_keep_pers = 1;
+ client->flags |= FLAG_KEEP_PERS;
break;
#ifdef HAVE_LIMERA1N
@@ -2863,7 +2861,7 @@ int personalize_component(struct idevicerestore_client_t* client, const char *co
}
free(component_blob);
- if (idevicerestore_keep_pers) {
+ if (client->flags & FLAG_KEEP_PERS) {
write_file(component_name, stitched_component, stitched_component_size);
}
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 9d6f5af..ce8686f 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -46,6 +46,7 @@ extern "C" {
#define FLAG_ALLOW_RESTORE_MODE (1 << 10)
#define FLAG_NO_RESTORE (1 << 11)
#define FLAG_IGNORE_ERRORS (1 << 12)
+#define FLAG_KEEP_PERS (1 << 13)
#define FLAG_IN_PROGRESS (1 << 30)
#define RESTORE_VARIANT_ERASE_INSTALL "Erase Install (IPSW)"
diff --git a/src/restore.c b/src/restore.c
index deeaf43..12f837c 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -2094,8 +2094,8 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned
}
}
// check for anything but .mbn and .fls if bb_nonce is set
- if (bb_nonce && !keep) {
- const char* fn = zip_get_name(za, i, 0);
+ const char* fn = zip_get_name(za, i, 0);
+ if (!keep) {
if (fn) {
char* ext = strrchr(fn, '.');
if (ext && (!strcmp(ext, ".fls") || !strcmp(ext, ".mbn") || !strcmp(ext, ".elf") || !strcmp(ext, ".bin"))) {
@@ -2104,11 +2104,14 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned
}
}
if (!keep) {
+ logger(LL_DEBUG, "%s: removing %s from bbfw\n", __func__, fn);
zip_delete(za, i);
+ } else {
+ logger(LL_DEBUG, "%s: keeping %s in bbfw\n", __func__, fn);
}
}
- if (bb_nonce) {
+ if (bbticket) {
if (is_fls) {
// add BBTicket to file ebl.fls
zindex = zip_name_locate(za, "ebl.fls", 0);
@@ -2401,7 +2404,13 @@ leave:
plist_free(dict);
free(buffer);
if (bbfwtmp) {
- remove(bbfwtmp);
+ if (client->flags & FLAG_KEEP_PERS) {
+ const char* bbfwname = path_get_basename(bbfwtmp);
+ logger(LL_VERBOSE, "%s: Keeping personalized BBFW as %s\n", __func__, bbfwname);
+ rename(bbfwtmp, bbfwname);
+ } else {
+ remove(bbfwtmp);
+ }
free(bbfwtmp);
}
plist_free(response);