summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2019-08-08 13:23:59 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-12 16:23:57 +0100
commit7365a605ae5aa1207a9a06604c8189cd422ac604 (patch)
tree08d5a5bdf8deecbb7a56a070f5d17cfc077a34dd /scripts
parent351a10ccd6f197ff105b207ea25d936c3e12044d (diff)
downloadpoky-7365a605ae5aa1207a9a06604c8189cd422ac604.tar.gz
wic: Make disk partition size consistently computed
When using different root directories with a wks file wic is using the value from the original ROOTFS_SIZE which is not correct. Example: Number Start End Size File system Name Flags 1 20.5kB 318MB 318MB fat16 otaefi legacy_boot, msftdata 2 318MB 636MB 318MB ext4 otaboot 3 636MB 1709MB 1074MB ext4 otaroot 4 1709MB 2027MB 318MB ext4 otaboot_b 5 2027MB 3101MB 1074MB ext4 otaroot_b 6 3101MB 5249MB 2147MB ext4 fluxdata The partitions 1, 2, and 3 incorrectly inherit the size, instead of using a computed size. With the patch applied it is working properly: Number Start End Size File system Name Flags 1 20.5kB 14.5MB 14.5MB fat16 otaefi legacy_boot, msftdata 2 14.5MB 65.3MB 50.8MB ext4 otaboot 3 65.3MB 1139MB 1074MB ext4 otaroot 4 1139MB 1190MB 50.8MB ext4 otaboot_b 5 1190MB 2264MB 1074MB ext4 otaroot_b 6 2264MB 4411MB 2147MB ext4 fluxdata As for the removal of the bb.warn, if the size is not specified, it is not something to warn the end user about. Some of my default images make use of the head room + a computed directory size or while generating images. (From OE-Core rev: 8e48b4d6c4d0ed213089a7449fea63aa0656e786) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/partition.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index f427c8101b..2a71d7b1d6 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -212,19 +212,13 @@ 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 # Get rootfs size from bitbake variable if it's not set in .ks file 215 # If size is not specified compute it from the rootfs_dir size
216 if not self.size and real_rootfs: 216 if not self.size and real_rootfs:
217 # Bitbake variable ROOTFS_SIZE is calculated in 217 # Use the same logic found in get_rootfs_size()
218 # Image._get_rootfs_size method from meta/lib/oe/image.py 218 # from meta/classes/image.bbclass
219 # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT, 219 du_cmd = "du -ks %s" % rootfs_dir
220 # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE 220 out = exec_cmd(du_cmd)
221 rsize_bb = get_bitbake_var('ROOTFS_SIZE') 221 self.size = int(out.split()[0])
222 if rsize_bb:
223 logger.warning('overhead-factor was specified, but size was not,'
224 ' so bitbake variables will be used for the size.'
225 ' In this case both IMAGE_OVERHEAD_FACTOR and '
226 '--overhead-factor will be applied')
227 self.size = int(round(float(rsize_bb)))
228 222
229 prefix = "ext" if self.fstype.startswith("ext") else self.fstype 223 prefix = "ext" if self.fstype.startswith("ext") else self.fstype
230 method = getattr(self, "prepare_rootfs_" + prefix) 224 method = getattr(self, "prepare_rootfs_" + prefix)