All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Alessio Igor Bogani <alessio.bogani@elettra.eu>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH v2] wic: Using the right rootfs size during prepare_rootfs
Date: Thu, 26 Sep 2019 07:59:16 -0500	[thread overview]
Message-ID: <9e377ef6-d5a9-7ebe-4542-e56f99376037@windriver.com> (raw)
In-Reply-To: <20190926093506.18853440E38_D8C864AB@spamalot.elettra.eu>

This looks correct now with the two patches merged.

Thanks,
Jason.

On 9/26/19 4:35 AM, Alessio Igor Bogani wrote:
> The commit 8e48b4d6c4 makes wic ignores IMAGE_ROOTFS_SIZE for rootfs
> size and makes it uses the computed one only. Re-add support for
> IMAGE_ROOTFS_SIZE variable and compute roots size only if the former
> is not defined. Moreover the size of a provided directory with
> --rootfs-dir="" in the .wks file should always be computed on the fly,
> else every partition will be constrained to be the same size as what
> ever value was in ROOTFS_SIZE.
>
> Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
>   scripts/lib/wic/partition.py | 23 +++++++++++++++++------
>   1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index 2a71d7b1d6..d809408e1a 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -212,13 +212,24 @@ class Partition():
>           if os.path.isfile(rootfs):
>               os.remove(rootfs)
>   
> -        # If size is not specified compute it from the rootfs_dir size
>           if not self.size and real_rootfs:
> -            # Use the same logic found in get_rootfs_size()
> -            # from meta/classes/image.bbclass
> -            du_cmd = "du -ks %s" % rootfs_dir
> -            out = exec_cmd(du_cmd)
> -            self.size = int(out.split()[0])
> +            # The rootfs size is not set in .ks file so try to get it
> +            # from bitbake variable
> +            rsize_bb = get_bitbake_var('ROOTFS_SIZE')
> +            rdir = get_bitbake_var('IMAGE_ROOTFS')
> +            if rsize_bb and rdir == rootfs_dir:
> +                # Bitbake variable ROOTFS_SIZE is calculated in
> +                # Image._get_rootfs_size method from meta/lib/oe/image.py
> +                # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT,
> +                # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE
> +                self.size = int(round(float(rsize_bb)))
> +            else:
> +                # Bitbake variable ROOTFS_SIZE is not defined so compute it
> +                # from the rootfs_dir size using the same logic found in
> +                # get_rootfs_size() from meta/classes/image.bbclass
> +                du_cmd = "du -ks %s" % rootfs_dir
> +                out = exec_cmd(du_cmd)
> +                self.size = int(out.split()[0])
>   
>           prefix = "ext" if self.fstype.startswith("ext") else self.fstype
>           method = getattr(self, "prepare_rootfs_" + prefix)




      reply	other threads:[~2019-09-26 12:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 15:05 [PATCH] wic: Using the right rootfs size during prepare_rootfs Alessio Igor Bogani
2019-09-25 19:37 ` Jason Wessel
2019-09-26  9:35   ` [PATCH v2] " Alessio Igor Bogani
2019-09-26 12:59     ` Jason Wessel [this message]

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=9e377ef6-d5a9-7ebe-4542-e56f99376037@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=alessio.bogani@elettra.eu \
    --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.