From 9e371185b5ed64f82fd86f6d8c7adea1c65e5b77 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 10 Oct 2018 15:51:04 +0200 Subject: image_type_tezi: move bootfs size calculation Create a separate function to calculate bootfs size. This allows to reuse bootfs size calculation for distro boot. Signed-off-by: Stefan Agner --- classes/image_type_tezi.bbclass | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/classes/image_type_tezi.bbclass b/classes/image_type_tezi.bbclass index 25e5ec5..56ca062 100644 --- a/classes/image_type_tezi.bbclass +++ b/classes/image_type_tezi.bbclass @@ -22,18 +22,15 @@ def rootfs_get_size(d): d.getVar('IMAGE_ROOTFS', True)]) return int(output.split()[0]) -def rootfs_tezi_emmc(d): +def bootfs_get_size(d): import subprocess - from collections import OrderedDict - deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) + kernel = d.getVar('KERNEL_IMAGETYPE', True) - offset_bootrom = d.getVar('OFFSET_BOOTROM_PAYLOAD', True) - offset_spl = d.getVar('OFFSET_SPL_PAYLOAD', True) - imagename = d.getVar('IMAGE_NAME', True) - imagename_suffix = d.getVar('IMAGE_NAME_SUFFIX', True) + deploydir = d.getVar('DEPLOY_DIR_IMAGE', True) # Calculate size of bootfs... bootfiles = [ os.path.join(deploydir, kernel) ] + has_devicetree = d.getVar('KERNEL_DEVICETREE', True) if has_devicetree: for dtb in d.getVar('KERNEL_DEVICETREE', True).split(): @@ -42,7 +39,14 @@ def rootfs_tezi_emmc(d): args = ['du', '-kLc'] args.extend(bootfiles) output = subprocess.check_output(args) - bootfssize_kb = int(output.splitlines()[-1].split()[0]) + return int(output.splitlines()[-1].split()[0]) + +def rootfs_tezi_emmc(d): + from collections import OrderedDict + offset_bootrom = d.getVar('OFFSET_BOOTROM_PAYLOAD', True) + offset_spl = d.getVar('OFFSET_SPL_PAYLOAD', True) + imagename = d.getVar('IMAGE_NAME', True) + imagename_suffix = d.getVar('IMAGE_NAME_SUFFIX', True) bootpart_rawfiles = [] @@ -71,7 +75,7 @@ def rootfs_tezi_emmc(d): "filesystem_type": "FAT", "mkfs_options": "", "filename": imagename + ".bootfs.tar.xz", - "uncompressed_size": bootfssize_kb / 1024 + "uncompressed_size": bootfs_get_size(d) / 1024 } }, { -- cgit v1.2.3