[oe-commits] [openembedded-core] 04/17: wic: apply --extra-space + --overhead to squashfs
git at git.openembedded.org
git at git.openembedded.org
Wed Sep 13 10:43:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit c3a534aa3e4b80b1d344a72b42bdf406478850dd
Author: Enrico Scholz <enrico.scholz at ensc.de>
AuthorDate: Fri Sep 8 19:33:03 2017 +0200
wic: apply --extra-space + --overhead to squashfs
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.scholz at ensc.de>
Signed-off-by: Ross Burton <ross.burton at intel.com>
---
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):
"""
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list