ramips: drop support for kernel 4.14
[openwrt/openwrt.git] / target / linux / generic / pending-4.14 / 420-mtd-redboot_space.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: add patch for including unpartitioned space in the rootfs partition for redboot devices (if applicable)
3
4 [john@phrozen.org: used by ixp and others]
5
6 lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9 drivers/mtd/redboot.c | 19 +++++++++++++------
10 1 file changed, 13 insertions(+), 6 deletions(-)
11
12 --- a/drivers/mtd/redboot.c
13 +++ b/drivers/mtd/redboot.c
14 @@ -265,14 +265,21 @@ static int parse_redboot_partitions(stru
15 #endif
16 names += strlen(names)+1;
17
18 -#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
19 if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
20 - i++;
21 - parts[i].offset = parts[i-1].size + parts[i-1].offset;
22 - parts[i].size = fl->next->img->flash_base - parts[i].offset;
23 - parts[i].name = nullname;
24 - }
25 + if (!strcmp(parts[i].name, "rootfs")) {
26 + parts[i].size = fl->next->img->flash_base;
27 + parts[i].size &= ~(master->erasesize - 1);
28 + parts[i].size -= parts[i].offset;
29 +#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
30 + nrparts--;
31 + } else {
32 + i++;
33 + parts[i].offset = parts[i-1].size + parts[i-1].offset;
34 + parts[i].size = fl->next->img->flash_base - parts[i].offset;
35 + parts[i].name = nullname;
36 #endif
37 + }
38 + }
39 tmp_fl = fl;
40 fl = fl->next;
41 kfree(tmp_fl);