From 8a3847fbbf9cfad90919a99878b3df2e11389f24 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 22 May 2019 19:02:51 +0200 Subject: image_type_tezi.bbclass: extend for apalis-imx8 The i.MX8 kernel is currently 20MB and doesn't fit in the hard coded 16MB boot partition size. Set the boot partition size dynamically to twice the payload size rounded up to the next power of 2, but at least to 16MB. The Apalis iMX8 needs additional firmware for HDMI in the boot partition. Provide a new MACHINE_BOOT_FILES variable which adds to the list of to be installed files. Signed-off-by: Max Krummenacher --- classes/image_type_tezi.bbclass | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/classes/image_type_tezi.bbclass b/classes/image_type_tezi.bbclass index e612bc5..f3d5bfa 100644 --- a/classes/image_type_tezi.bbclass +++ b/classes/image_type_tezi.bbclass @@ -53,6 +53,14 @@ def get_uncompressed_size(d, type=""): size = f.read().strip() return float(size) +# Make an educated guess of the needed boot partition size +# max(16MB, twice the size of the payload rounded up to the next 2^x number) +def get_bootfs_part_size(d): + from math import log + payload_size = get_uncompressed_size(d, 'bootfs.tar') / 1024 + part_size = 2 ** (2 + int(log (payload_size, 2))) + return max(16, part_size) + def rootfs_tezi_emmc(d): from collections import OrderedDict offset_bootrom = d.getVar('OFFSET_BOOTROM_PAYLOAD') @@ -81,7 +89,7 @@ def rootfs_tezi_emmc(d): "name": "mmcblk0", "partitions": [ { - "partition_size_nominal": 16, + "partition_size_nominal": get_bootfs_part_size(d), "want_maximised": False, "content": { "label": "BOOT", @@ -274,7 +282,7 @@ python rootfs_tezi_run_json() { } create_tezi_bootfs () { - create_bootfs "${TEZI_KERNEL_IMAGETYPE}" "${TEZI_KERNEL_DEVICETREE}" + create_bootfs "${TEZI_KERNEL_IMAGETYPE}" "${TEZI_KERNEL_DEVICETREE}" "${MACHINE_BOOT_FILES}" } do_image_teziimg[prefuncs] += "create_tezi_bootfs rootfs_tezi_run_json" @@ -350,7 +358,7 @@ python rootfs_tezi_run_distro_json() { } create_tezi_distro_bootfs () { - create_bootfs "${TEZI_KERNEL_IMAGETYPE}" "${TEZI_KERNEL_DEVICETREE}" "boot.scr" + create_bootfs "${TEZI_KERNEL_IMAGETYPE}" "${TEZI_KERNEL_DEVICETREE}" "boot.scr" ${MACHINE_BOOT_FILES} } do_image_teziimg_distro[prefuncs] += "create_tezi_distro_bootfs rootfs_tezi_run_distro_json" -- cgit v1.2.3