420-mtd-redboot_space.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. [john@phrozen.org: used by ixp and others]
  4. lede-commit: 394918851f84e4d00fa16eb900e7700e95091f00
  5. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  6. ---
  7. drivers/mtd/redboot.c | 19 +++++++++++++------
  8. 1 file changed, 13 insertions(+), 6 deletions(-)
  9. --- a/drivers/mtd/redboot.c
  10. +++ b/drivers/mtd/redboot.c
  11. @@ -266,14 +266,21 @@ static int parse_redboot_partitions(stru
  12. #endif
  13. names += strlen(names)+1;
  14. -#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  15. if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
  16. - i++;
  17. - parts[i].offset = parts[i-1].size + parts[i-1].offset;
  18. - parts[i].size = fl->next->img->flash_base - parts[i].offset;
  19. - parts[i].name = nullname;
  20. - }
  21. + if (!strcmp(parts[i].name, "rootfs")) {
  22. + parts[i].size = fl->next->img->flash_base;
  23. + parts[i].size &= ~(master->erasesize - 1);
  24. + parts[i].size -= parts[i].offset;
  25. +#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  26. + nrparts--;
  27. + } else {
  28. + i++;
  29. + parts[i].offset = parts[i-1].size + parts[i-1].offset;
  30. + parts[i].size = fl->next->img->flash_base - parts[i].offset;
  31. + parts[i].name = nullname;
  32. #endif
  33. + }
  34. + }
  35. tmp_fl = fl;
  36. fl = fl->next;
  37. kfree(tmp_fl);