summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-12-15 12:42:39 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-17 09:57:04 +0000
commitdb08ffee0ad1451f3bf710f4d1b623938ba9aefb (patch)
treea8df97ba9a38ac360b2763a13635082eddda42ae /scripts/lib/wic/partition.py
parent86ceb8bd514094cc848d0505c18f14e662b6ea62 (diff)
downloadpoky-db08ffee0ad1451f3bf710f4d1b623938ba9aefb.tar.gz
wic: obey the rootfs size from the metadata
When no --size is specified for the rootfs in the .wks, we want to obey the rootfs size from the metadata, otherwise the defined IMAGE_ROOTFS_EXTRA_SPACE and IMAGE_OVERHEAD_FACTOR will not be obeyed. In some cases, this can result in image construction failure, if the size determined by du was insufficient to hold the files without the aforementioned extra space. This fallback from --size to ROOTFS_SIZE was already implemented when --rootfs-dir is specified in the .wks, but it did not occur otherwise, neither when --rootfs-dir= was passed to `wic create` nor when IMAGE_ROOTFS was used. This made a certain amount of sense, as this fallback logic happened at such a level that it wasn't able to identify which partitions were rootfs partitions otherwise. Rather than doing it at that level, we can do it in prepare_rootfs(), which is run by the rootfs source plugins. Note that IMAGE_OVERHEAD_FACTOR and a --overhead-factor in the .wks will now both be applied when --size isn't specified in the .wks. A warning is added about this, though a user won't see it unless wic fails or they examine the do_image_wic log. Fixes [YOCTO #10815] (From OE-Core rev: 1d50e11286722c4114c1ae0bc285f846cd85fc4c) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r--scripts/lib/wic/partition.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index ac4c836bdb..b191cdee54 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -28,7 +28,7 @@ import os
28import tempfile 28import tempfile
29 29
30from wic.utils.oe.misc import msger, parse_sourceparams 30from wic.utils.oe.misc import msger, parse_sourceparams
31from wic.utils.oe.misc import exec_cmd, exec_native_cmd 31from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
32from wic.plugin import pluginmgr 32from wic.plugin import pluginmgr
33 33
34partition_methods = { 34partition_methods = {
@@ -194,6 +194,17 @@ class Partition():
194 msger.error("File system for partition %s not specified in kickstart, " \ 194 msger.error("File system for partition %s not specified in kickstart, " \
195 "use --fstype option" % (self.mountpoint)) 195 "use --fstype option" % (self.mountpoint))
196 196
197 # Get rootfs size from bitbake variable if it's not set in .ks file
198 if not self.size:
199 # Bitbake variable ROOTFS_SIZE is calculated in
200 # Image._get_rootfs_size method from meta/lib/oe/image.py
201 # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT,
202 # IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE
203 rsize_bb = get_bitbake_var('ROOTFS_SIZE')
204 if rsize_bb:
205 msger.warning('overhead-factor was specified, but size was not, so bitbake variables will be used for the size. In this case both IMAGE_OVERHEAD_FACTOR and --overhead-factor will be applied')
206 self.size = int(round(float(rsize_bb)))
207
197 for prefix in ("ext", "btrfs", "vfat", "squashfs"): 208 for prefix in ("ext", "btrfs", "vfat", "squashfs"):
198 if self.fstype.startswith(prefix): 209 if self.fstype.startswith(prefix):
199 method = getattr(self, "prepare_rootfs_" + prefix) 210 method = getattr(self, "prepare_rootfs_" + prefix)