kernel: generic: add kernel 4.3
[openwrt.git] / target / linux / generic / patches-4.3 / 420-mtd-redboot_space.patch
1 --- a/drivers/mtd/redboot.c
2 +++ b/drivers/mtd/redboot.c
3 @@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru
4  #endif
5                 names += strlen(names)+1;
6  
7 -#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
8                 if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
9 -                       i++;
10 -                       parts[i].offset = parts[i-1].size + parts[i-1].offset;
11 -                       parts[i].size = fl->next->img->flash_base - parts[i].offset;
12 -                       parts[i].name = nullname;
13 -               }
14 +                       if (!strcmp(parts[i].name, "rootfs")) {
15 +                               parts[i].size = fl->next->img->flash_base;
16 +                               parts[i].size &= ~(master->erasesize - 1);
17 +                               parts[i].size -= parts[i].offset;
18 +#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
19 +                               nrparts--;
20 +                       } else {
21 +                               i++;
22 +                               parts[i].offset = parts[i-1].size + parts[i-1].offset;
23 +                               parts[i].size = fl->next->img->flash_base - parts[i].offset;
24 +                               parts[i].name = nullname;
25  #endif
26 +                       }
27 +               }
28                 tmp_fl = fl;
29                 fl = fl->next;
30                 kfree(tmp_fl);