wic: use bitbake variable ROOTFS_SIZE
If bitbake image is referenced in .ks file and --size is not used there wic uses ROOTFS_SIZE variable to set minimum partition size. ROOTFS_SIZE is calculated in meta/lib/oe/image.py when rootfs is created. The calculation is done using other image parameters: IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT, IMAGE_OVERHEAD_FACTOR and IMAGE_ROOTFS_EXTRA_SPACE. (From OE-Core rev: 173d440c14ee3140ae08c6a87decc9b2f4c9e391) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
4f7b72a07d
commit
7b421dccc1
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue