1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: add patch for including unpartitioned space in the rootfs partition for redboot devices (if applicable)
4 [john@phrozen.org: used by ixp and others]
6 lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 drivers/mtd/redboot.c | 19 +++++++++++++------
10 1 file changed, 13 insertions(+), 6 deletions(-)
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,
18 names += strlen(names)+1;
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) {
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;
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
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;