kernel: split patches folder up into backport, pending and hack folders
[openwrt/openwrt.git] / target / linux / generic / pending-4.9 / 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 diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
13 index 7623ac5fc586..181ea0fb3c91 100644
14 --- a/drivers/mtd/redboot.c
15 +++ b/drivers/mtd/redboot.c
16 @@ -265,14 +265,21 @@ static int parse_redboot_partitions(struct mtd_info *master,
17 #endif
18 names += strlen(names)+1;
19
20 -#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
21 if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
22 - i++;
23 - parts[i].offset = parts[i-1].size + parts[i-1].offset;
24 - parts[i].size = fl->next->img->flash_base - parts[i].offset;
25 - parts[i].name = nullname;
26 - }
27 + if (!strcmp(parts[i].name, "rootfs")) {
28 + parts[i].size = fl->next->img->flash_base;
29 + parts[i].size &= ~(master->erasesize - 1);
30 + parts[i].size -= parts[i].offset;
31 +#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
32 + nrparts--;
33 + } else {
34 + i++;
35 + parts[i].offset = parts[i-1].size + parts[i-1].offset;
36 + parts[i].size = fl->next->img->flash_base - parts[i].offset;
37 + parts[i].name = nullname;
38 #endif
39 + }
40 + }
41 tmp_fl = fl;
42 fl = fl->next;
43 kfree(tmp_fl);
44 --
45 2.11.0
46