summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/wic/partition.py23
1 files 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():
212 if os.path.isfile(rootfs): 212 if os.path.isfile(rootfs):
213 os.remove(rootfs) 213 os.remove(rootfs)
214 214
215 # If size is not specified compute it from the rootfs_dir size
216 if not self.size and real_rootfs: 215 if not self.size and real_rootfs:
217 # Use the same logic found in get_rootfs_size() 216 # The rootfs size is not set in .ks file so try to get it
218 # from meta/classes/image.bbclass 217 # from bitbake variable
219 du_cmd = "du -ks %s" % rootfs_dir 218 rsize_bb = get_bitbake_var('ROOTFS_SIZE')
220 out = exec_cmd(du_cmd) 219 rdir = get_bitbake_var('IMAGE_ROOTFS')
221 self.size = int(out.split()[0]) 220 if rsize_bb and rdir == rootfs_dir:
221 # Bitbake variable ROOTFS_SIZE is calculated in
222 # Image._get_rootfs_size method from meta/lib/oe/image.py
223 # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT,
224 # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE
225 self.size = int(round(float(rsize_bb)))
226 else:
227 # Bitbake variable ROOTFS_SIZE is not defined so compute it
228 # from the rootfs_dir size using the same logic found in
229 # get_rootfs_size() from meta/classes/image.bbclass
230 du_cmd = "du -ks %s" % rootfs_dir
231 out = exec_cmd(du_cmd)
232 self.size = int(out.split()[0])
222 233
223 prefix = "ext" if self.fstype.startswith("ext") else self.fstype 234 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
224 method = getattr(self, "prepare_rootfs_" + prefix) 235 method = getattr(self, "prepare_rootfs_" + prefix)