[oe-commits] [openembedded-core] 20/34: wic: Using the right rootfs size during prepare_rootfs

git at git.openembedded.org git at git.openembedded.org
Fri Sep 27 12:03:24 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 0217a0392b8cc534fcc0d760b7663a1845b306f5
Author: Alessio Igor Bogani <alessio.bogani at elettra.eu>
AuthorDate: Thu Sep 26 11:35:02 2019 +0200

    wic: Using the right rootfs size during prepare_rootfs
    
    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 at elettra.eu>
    Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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 2a71d7b..d809408 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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list