From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Enrico Scholz <enrico.scholz@ensc.de>,
openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 3/3] wic: apply --extra-space + --overhead to squashfs
Date: Mon, 11 Sep 2017 16:41:50 +0300 [thread overview]
Message-ID: <20170911134150.6jpsypaj4dgjv67t@linux.intel.com> (raw)
In-Reply-To: <20170908173303.29634-4-enrico.scholz@sigma-chemnitz.de>
On Fri, Sep 08, 2017 at 07:33:03PM +0200, Enrico Scholz wrote:
> From: Enrico Scholz <enrico.scholz@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.scholz@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
next prev parent reply other threads:[~2017-09-11 13:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 17:33 [PATCH 0/3] wic: enhanced bootimage + squashfs support Enrico Scholz
2017-09-08 17:33 ` [PATCH 1/3] wic: accept '-' in bitbake variables Enrico Scholz
2017-09-08 17:33 ` [PATCH 2/3] wic: allow multiple /boot partitions with different content Enrico Scholz
2017-09-08 17:33 ` [PATCH 3/3] wic: apply --extra-space + --overhead to squashfs Enrico Scholz
2017-09-11 13:41 ` Ed Bartosh [this message]
2017-09-11 14:04 ` Enrico Scholz
2017-09-12 8:53 ` Ed Bartosh
2017-09-12 9:44 ` Enrico Scholz
2017-09-12 11:48 ` Ed Bartosh
2017-09-12 12:18 ` Enrico Scholz
2017-09-12 12:57 ` Ed Bartosh
2017-09-12 13:23 ` Enrico Scholz
2017-09-13 12:10 ` Ed Bartosh
2017-09-11 20:00 ` [PATCH v2 " Enrico Scholz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170911134150.6jpsypaj4dgjv67t@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=enrico.scholz@ensc.de \
--cc=enrico.scholz@sigma-chemnitz.de \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.