[OpenWrt-Devel] [PATCH 3/4] kernel: mtdsplit_squashfs: Align with the erase-block size

Martin Blumenstingl martin.blumenstingl at googlemail.com
Fri Jan 15 18:59:08 EST 2016


On most image types the rootfs ends at an erase-block. However, at least
with brnImages this is not the case: while the partitions are aligned
with the erase-block size there is a 12 byte footer at the end of the
partition which must not be touched by any filesystem. This lead to a
rootfs_data partition which was not aligned properly (and thus ended up
being readonly):
	0x000000480000-0x00000085a800 : "rootfs_data" (128 KiB EB)

Signed-off-by: Martin Blumenstingl <martin.blumenstingl at googlemail.com>
---
 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c
index 3d80e07..5329037 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_squashfs.c
@@ -49,7 +49,7 @@ mtdsplit_parse_squashfs(struct mtd_info *master,
 	part->name = ROOTFS_SPLIT_NAME;
 	part->offset = mtd_roundup_to_eb(part_offset + squashfs_len,
 					 parent_mtd) - part_offset;
-	part->size = master->size - part->offset;
+	part->size = mtd_rounddown_to_eb(master->size - part->offset, master);
 
 	*pparts = part;
 	return 1;
-- 
2.7.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list