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 <hector.palacios@digi.com>

https://jira.digi.com/browse/DEL-6641
This commit is contained in:
Hector Palacios 2019-07-11 12:06:42 +02:00
parent 00ac4445bc
commit 7d61198cc8
2 changed files with 29 additions and 2 deletions

View File

@ -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)}"

View File

@ -1,4 +1,5 @@
# Copyright 2019 Digi International, Inc. # Copyright 2019 Digi International, Inc.
inherit boot-artifacts
# Use the v4.14 ga BSP branch # Use the v4.14 ga BSP branch
SRCBRANCH = "imx_4.14.98_2.0.0_ga" SRCBRANCH = "imx_4.14.98_2.0.0_ga"
@ -83,7 +84,7 @@ do_compile () {
do_install () { do_install () {
install -d ${D}/boot install -d ${D}/boot
for ramc in ${RAM_CONFIGS}; do for ramc in ${UBOOT_RAM_COMBINATIONS}; do
for target in ${IMXBOOT_TARGETS}; do for target in ${IMXBOOT_TARGETS}; do
install -m 0644 ${S}/${UBOOT_PREFIX}-${MACHINE}-${ramc}.bin-${target} ${D}/boot/ install -m 0644 ${S}/${UBOOT_PREFIX}-${MACHINE}-${ramc}.bin-${target} ${D}/boot/
done done
@ -103,7 +104,7 @@ do_deploy () {
install -m 0644 ${BOOT_STAGING}/soc.mak ${DEPLOYDIR}/${BOOT_TOOLS} install -m 0644 ${BOOT_STAGING}/soc.mak ${DEPLOYDIR}/${BOOT_TOOLS}
# copy the generated boot image to deploy path # copy the generated boot image to deploy path
for ramc in ${RAM_CONFIGS}; do for ramc in ${UBOOT_RAM_COMBINATIONS}; do
IMAGE_IMXBOOT_TARGET="" IMAGE_IMXBOOT_TARGET=""
for target in ${IMXBOOT_TARGETS}; do for target in ${IMXBOOT_TARGETS}; do
# Use first "target" as IMAGE_IMXBOOT_TARGET # Use first "target" as IMAGE_IMXBOOT_TARGET