From c87080ee05157d2f3749bb92c5eda804037c4f15 Mon Sep 17 00:00:00 2001 From: Russell Senior Date: Wed, 22 Jun 2016 22:48:28 +0200 Subject: ath25: update kernel from 3.18 to 4.4 Summary of changes: * moved config-3.18 to config-4.4 and patches-3.18 to patches-4.4 * removed most of the first two patches, that seem to be upstream already * changed deprecated/removed IRQF_DISABLED to zero following examples in upstream kernel patches * added config line to disable device-tree to satisfy kernel configuration * add new image generation code Build tested and run tested on an Accton MR3201A. Signed-off-by: Russell Senior Signed-off-by: Sergey Ryazanov Signed-off-by: John Crispin --- .../142-redboot_various_erase_size_fix.patch | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 target/linux/ath25/patches-4.4/142-redboot_various_erase_size_fix.patch (limited to 'target/linux/ath25/patches-4.4/142-redboot_various_erase_size_fix.patch') diff --git a/target/linux/ath25/patches-4.4/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-4.4/142-redboot_various_erase_size_fix.patch new file mode 100644 index 0000000000..e1b0a89905 --- /dev/null +++ b/target/linux/ath25/patches-4.4/142-redboot_various_erase_size_fix.patch @@ -0,0 +1,72 @@ +--- a/drivers/mtd/redboot.c ++++ b/drivers/mtd/redboot.c +@@ -58,6 +58,22 @@ static inline int redboot_checksum(struc + return 1; + } + ++static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset) ++{ ++ struct mtd_erase_region_info *regions = mtd->eraseregions; ++ int i; ++ ++ for (i = 0; i < mtd->numeraseregions; i++) { ++ if (regions[i].offset + ++ regions[i].numblocks * regions[i].erasesize <= offset) ++ continue; ++ ++ return regions[i].erasesize; ++ } ++ ++ return mtd->erasesize; ++} ++ + static int parse_redboot_partitions(struct mtd_info *master, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +@@ -74,6 +90,7 @@ static int parse_redboot_partitions(stru + int namelen = 0; + int nulllen = 0; + int numslots; ++ int first_slot; + unsigned long offset; + #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED + static char nullstring[] = "unallocated"; +@@ -186,7 +203,10 @@ static int parse_redboot_partitions(stru + goto out; + } + +- 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++) { + struct fis_list *new_fl, **prev; + + if (buf[i].name[0] == 0xff) { +@@ -262,12 +282,13 @@ static int parse_redboot_partitions(stru + } + #endif + for ( ; iimg->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; ++ + strcpy(names, fl->img->name); + #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY + if (!memcmp(names, "RedBoot", 8) || +@@ -297,7 +318,9 @@ static int parse_redboot_partitions(stru + fl = fl->next; + kfree(tmp_fl); + } +- if (master->size - max_offset >= master->erasesize) { ++ ++ if (master->size - max_offset >= ++ mtd_get_offset_erasesize(master, max_offset)) { + parts[nrparts].size = master->size - max_offset; + parts[nrparts].offset = max_offset; + parts[nrparts].name = names; -- cgit v1.2.3