diff options
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 57b1335a17..d68fd2a8c5 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -29,6 +29,7 @@ import shutil from wic import kickstart, msger from wic.utils import fs_related +from wic.utils.oe.misc import get_bitbake_var from wic.utils.partitionedfs import Image from wic.utils.errors import CreatorError, ImageError from wic.imager.baseimager import BaseImageCreator @@ -229,6 +230,19 @@ class DirectImageCreator(BaseImageCreator): fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) for p in parts: + # get rootfs size from bitbake variable if it's not set in .ks file + if not p.size: + # and if rootfs name is specified for the partition + image_name = p.get_rootfs() + if image_name: + # 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 + rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name) + if rsize_bb: + # convert from Kb to Mb + p.size = int(rsize_bb) / 1024 # need to create the filesystems in order to get their # sizes before we can add them and do the layout. # Image.create() actually calls __format_disks() to create |