diff options
author | Stefan Agner <stefan@agner.ch> | 2018-10-10 15:51:04 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2019-03-04 17:09:51 +0100 |
commit | 9e371185b5ed64f82fd86f6d8c7adea1c65e5b77 (patch) | |
tree | 785291182719d67ef7fadbd3e72989ca32d65ea8 | |
parent | d740495376ebfc267097fba460aa9edd99ed2902 (diff) |
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 <stefan@agner.ch>
-rw-r--r-- | classes/image_type_tezi.bbclass | 22 |
1 files 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 } }, { |