[OE-core] [PATCH 12/12] wic: use bitbake variable ROOTFS_SIZE
Ed Bartosh
ed.bartosh at linux.intel.com
Sun Aug 30 17:47:09 UTC 2015
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.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
scripts/lib/wic/imager/direct.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 57b1335..d68fd2a 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
--
2.1.4
More information about the Openembedded-core
mailing list