From 7d61198cc87272e88c0dd769683985e9579fc15c Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Thu, 11 Jul 2019 12:06:42 +0200 Subject: [PATCH] imx-boot: iterate on matching RAM sizes in do_install/do_append The existing loops were iterating through all RAM_CONFIGS, but they must only iterate over those that match the RAM size on the platform's UBOOT_CONFIG. This commit adds a Python class 'boot-artifacts' to get the list of matching combinations of RAM_CONFIGS and UBOOT_CONFIG so that the iteration is easier to do than nesting loops inside one another. Signed-off-by: Hector Palacios https://jira.digi.com/browse/DEL-6641 --- meta-digi-arm/classes/boot-artifacts.bbclass | 26 +++++++++++++++++++ .../imx-mkimage/imx-boot_0.2.bbappend | 5 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 meta-digi-arm/classes/boot-artifacts.bbclass diff --git a/meta-digi-arm/classes/boot-artifacts.bbclass b/meta-digi-arm/classes/boot-artifacts.bbclass new file mode 100644 index 000000000..3ca896e6f --- /dev/null +++ b/meta-digi-arm/classes/boot-artifacts.bbclass @@ -0,0 +1,26 @@ +# Class for the generation of boot artifacts + +# This function returns a list with the RAM_CONFIGS that match the RAM size +# in the list of UBOOT_CONFIG +def get_uboot_ram_combinations(d): + import re + + types = d.getVar('UBOOT_CONFIG', True) or "" + ram_configs = d.getVar('RAM_CONFIGS', True) or "" + + # Convert to arrays + types = types.split(" ") + ram_configs = ram_configs.split(" ") + + # Obtain the list of RAM_CONFIGS for whose RAM size there is a match + # in UBOOT_CONFIG + matches = [] + for type in types: + ramsize = re.search("([0-9]*[G|M]B)", type).group(1) + for ramc in ram_configs: + if ramsize in ramc: + matches.append(ramc) + + return " ".join(matches) + +UBOOT_RAM_COMBINATIONS = "${@get_uboot_ram_combinations(d)}" diff --git a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-boot_0.2.bbappend b/meta-digi-arm/recipes-bsp/imx-mkimage/imx-boot_0.2.bbappend index 77cbb9314..d7c5a16cb 100644 --- a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-boot_0.2.bbappend +++ b/meta-digi-arm/recipes-bsp/imx-mkimage/imx-boot_0.2.bbappend @@ -1,4 +1,5 @@ # Copyright 2019 Digi International, Inc. +inherit boot-artifacts # Use the v4.14 ga BSP branch SRCBRANCH = "imx_4.14.98_2.0.0_ga" @@ -83,7 +84,7 @@ do_compile () { do_install () { install -d ${D}/boot - for ramc in ${RAM_CONFIGS}; do + for ramc in ${UBOOT_RAM_COMBINATIONS}; do for target in ${IMXBOOT_TARGETS}; do install -m 0644 ${S}/${UBOOT_PREFIX}-${MACHINE}-${ramc}.bin-${target} ${D}/boot/ done @@ -103,7 +104,7 @@ do_deploy () { install -m 0644 ${BOOT_STAGING}/soc.mak ${DEPLOYDIR}/${BOOT_TOOLS} # copy the generated boot image to deploy path - for ramc in ${RAM_CONFIGS}; do + for ramc in ${UBOOT_RAM_COMBINATIONS}; do IMAGE_IMXBOOT_TARGET="" for target in ${IMXBOOT_TARGETS}; do # Use first "target" as IMAGE_IMXBOOT_TARGET