On Fri, Sep 08, 2017 at 07:33:03PM +0200, Enrico Scholz wrote: > 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. >
Is it possible to just use --size or --fixed-size in .wks to allocate partition of certain size? > 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): Do we really need to mangle name of this method? Please, consider reading this for further details: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#naming As this function is not going to be used anywhere I'd just use this code in prepare_rootfs_squashfs. It would be less generic, but much more readable and understandable. > + """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): > """ -- Regards, Ed -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core