diff options
Diffstat (limited to 'target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch')
-rw-r--r-- | target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch index c3b73eabe9..ca9e686177 100644 --- a/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch +++ b/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch @@ -31,7 +31,18 @@ unsigned long offset; #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED static char nullstring[] = "unallocated"; -@@ -201,7 +218,10 @@ static int parse_redboot_partitions(stru +@@ -134,7 +151,9 @@ nogood: + } + + numslots = (master->erasesize / sizeof(struct fis_image_desc)); +- for (i = 0; i < numslots; i++) { ++ first_slot = (buf[i].flash_base & (master->erasesize - 1)) / ++ sizeof(struct fis_image_desc); ++ for (i = first_slot; i < first_slot + numslots; i++) { + if (!memcmp(buf[i].name, "FIS directory", 14)) { + /* This is apparently the FIS directory entry for the + * FIS directory itself. The FIS directory size is +@@ -200,7 +219,10 @@ nogood: goto out; } @@ -43,23 +54,23 @@ struct fis_list *new_fl, **prev; if (buf[i].name[0] == 0xff) { -@@ -277,12 +297,13 @@ static int parse_redboot_partitions(stru +@@ -275,12 +297,13 @@ nogood: } #endif - for ( ; i<nrparts; i++) { + for ( ; i < nrparts; i++) { - if (max_offset < buf[i].flash_base + buf[i].size) -- max_offset = buf[i].flash_base + buf[i].size; +- max_offset = buf[i].flash_base + buf[i].size; parts[i].size = fl->img->size; parts[i].offset = fl->img->flash_base; parts[i].name = names; + if (max_offset < parts[i].offset + parts[i].size) -+ max_offset = parts[i].offset + parts[i].size; ++ max_offset = parts[i].offset + parts[i].size; + strcpy(names, fl->img->name); #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY if (!memcmp(names, "RedBoot", 8) || -@@ -312,7 +333,9 @@ static int parse_redboot_partitions(stru +@@ -310,7 +333,9 @@ nogood: fl = fl->next; kfree(tmp_fl); } |