From: Enrico Scholz <enrico.sch...@ensc.de> The --extra-space and --overhead option did not had an effect to squashfs partitions. Although squashfs is read-only, it can be useful to allocate more space for the on-disk partition to avoid repartitioning of the whole disk when a new (and larger) squashfs image is written on later updates.
Patch calls get_rootfs_size() *after* creating the image and truncates it then. Signed-off-by: Enrico Scholz <enrico.sch...@ensc.de> --- scripts/lib/wic/partition.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index b623bb9..da651f8 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -195,6 +195,17 @@ class Partition(): "larger (%d kB) than its allowed size %d kB" % (self.mountpoint, self.size, self.fixed_size)) + def __extend_rootfs_image(self, rootfs): + """Enlarges the rootfs so that it fulfills size/overhead-factor + constraints""" + + sz = (os.stat(rootfs).st_size + 1023) // 1024 + pad_sz = self.get_rootfs_size(sz) + + if pad_sz > sz: + with open(rootfs, 'a') as f: + os.ftruncate(f.fileno(), pad_sz * 1024) + def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, native_sysroot): """ @@ -338,6 +349,8 @@ class Partition(): (rootfs_dir, rootfs, extraopts) exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) + self.__extend_rootfs_image(rootfs) + def prepare_empty_partition_ext(self, rootfs, oe_builddir, native_sysroot): """ -- 2.9.5 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core