diff options
author | Alessio Igor Bogani <alessio.bogani@elettra.eu> | 2019-09-26 11:35:02 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-27 13:02:16 +0100 |
commit | b404c0cd3c12958e705f666c29920816912c2d56 (patch) | |
tree | 50e139278574b9f8e8465cbfc82d463a6268757b /scripts/lib | |
parent | 990fedd595e1d0bb623bac0bb3993870a97c0af1 (diff) | |
download | poky-b404c0cd3c12958e705f666c29920816912c2d56.tar.gz |
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.
(From OE-Core rev: 0217a0392b8cc534fcc0d760b7663a1845b306f5)
Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/partition.py | 23 |
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) |