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