[OE-core] [oe-core][PATCH v2] u-boot: extend UBOOT_CONFIG format to support different binary name

Ting Liu ting.liu at nxp.com
Wed Jun 22 09:44:16 UTC 2016


Ping.

> -----Original Message-----
> From: ting.liu at nxp.com [mailto:ting.liu at nxp.com]
> Sent: Wednesday, June 15, 2016 11:01 PM
> To: openembedded-core at lists.openembedded.org
> Cc: Zhenhua Luo <zhenhua.luo at nxp.com>; Ting Liu <ting.liu at nxp.com>
> Subject: [oe-core][PATCH v2] u-boot: extend UBOOT_CONFIG format to
> support different binary name
> 
> From: Ting Liu <ting.liu at nxp.com>
> 
> When using UBOOT_CONFIG format, the final u-boot binary for each config
> may have different names. Extend UBOOT_CONFIG format to support
> different binary to be copied.
> 
> The new format is supposed to be compatible with old one as
> ${UBOOT_BINARY} is copied by default, and images,binary can be empty.
> 
> An example format to specify it, in the machine, is:
> UBOOT_CONFIG ??= "sdcard-ifc sdcard-qspi lpuart qspi secure-boot nor"
> UBOOT_CONFIG[nor] = "ls1021atwr_nor_config,,u-boot-dtb.bin"
> UBOOT_CONFIG[sdcard-ifc] = "ls1021atwr_sdcard_ifc_config,,u-boot-with-
> spl-pbl.bin"
> UBOOT_CONFIG[sdcard-qspi] = "ls1021atwr_sdcard_qspi_config,,u-boot-
> with-spl-pbl.bin"
> UBOOT_CONFIG[lpuart] = "ls1021atwr_nor_lpuart_config,,u-boot-dtb.bin"
> UBOOT_CONFIG[qspi] = "ls1021atwr_qspi_config,,u-boot-dtb.bin"
> UBOOT_CONFIG[secure-boot] = "ls1021atwr_nor_SECURE_BOOT_config"
> 
> Signed-off-by: Ting Liu <ting.liu at nxp.com>
> ---
>  meta/classes/uboot-config.bbclass  | 19 ++++++++++++++++---
> meta/recipes-bsp/u-boot/u-boot.inc | 12 +++++++++---
>  2 files changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-
> config.bbclass
> index cb061af..3f760f2 100644
> --- a/meta/classes/uboot-config.bbclass
> +++ b/meta/classes/uboot-config.bbclass
> @@ -3,7 +3,7 @@
>  # The format to specify it, in the machine, is:
>  #
>  # UBOOT_CONFIG ??= <default>
> -# UBOOT_CONFIG[foo] = "config,images"
> +# UBOOT_CONFIG[foo] = "config,images,binary"
>  #
>  # or
>  #
> @@ -11,9 +11,13 @@
>  #
>  # Copyright 2013, 2014 (C) O.S. Systems Software LTDA.
> 
> +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
> +
>  python () {
>      ubootmachine = d.getVar("UBOOT_MACHINE", True)
>      ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
> +    ubootbinary = d.getVar('UBOOT_BINARY', True)
> +    ubootbinaries = d.getVar('UBOOT_BINARIES', True)
>      # The "doc" varflag is special, we don't want to see it here
>      ubootconfigflags.pop('doc', None)
> 
> @@ -27,6 +31,9 @@ python () {
>      if ubootmachine and ubootconfigflags:
>          raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and
> UBOOT_CONFIG at the same time.")
> 
> +    if ubootconfigflags and ubootbinaries:
> +        raise bb.parse.SkipPackage("You cannot use UBOOT_BINARIES as it
> + is internal to uboot_config.bbclass.")
> +
>      if not ubootconfigflags:
>          return
> 
> @@ -36,13 +43,19 @@ python () {
>              for f, v in ubootconfigflags.items():
>                  if config == f:
>                      items = v.split(',')
> -                    if items[0] and len(items) > 2:
> -                        raise bb.parse.SkipPackage('Only config,images can be
> specified!')
> +                    if items[0] and len(items) > 3:
> +                        raise bb.parse.SkipPackage('Only
> + config,images,binary can be specified!')
>                      d.appendVar('UBOOT_MACHINE', ' ' + items[0])
>                      # IMAGE_FSTYPES appending
>                      if len(items) > 1 and items[1]:
>                          bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1])
>                          d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
> +                    if len(items) > 2 and items[2]:
> +                        bb.debug(1, "Appending '%s' to UBOOT_BINARIES." % items[2])
> +                        d.appendVar('UBOOT_BINARIES', ' ' + items[2])
> +                    else:
> +                        bb.debug(1, "Appending '%s' to UBOOT_BINARIES." %
> ubootbinary)
> +                        d.appendVar('UBOOT_BINARIES', ' ' +
> + ubootbinary)
>                      break
>      elif len(ubootconfig) == 0:
>         raise bb.parse.SkipPackage('You must set a default in UBOOT_CONFIG.')
> diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-
> boot/u-boot.inc
> index 1071d1f..1f64faa 100644
> --- a/meta/recipes-bsp/u-boot/u-boot.inc
> +++ b/meta/recipes-bsp/u-boot/u-boot.inc
> @@ -32,7 +32,6 @@ UBOOT_LOCALVERSION ?= ""
>  # but enable individual recipes to change this value.
>  UBOOT_SUFFIX ??= "bin"
>  UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}"
> -UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
>  UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}"
>  UBOOT_MAKE_TARGET ?= "all"
> 
> @@ -82,15 +81,22 @@ do_compile () {
> 
>      if [ -n "${UBOOT_CONFIG}" ]
>      then
> +        unset i j k
>          for config in ${UBOOT_MACHINE}; do
>              i=$(expr $i + 1);
> -            for type  in ${UBOOT_CONFIG}; do
> +            for type in ${UBOOT_CONFIG}; do
>                  j=$(expr $j + 1);
>                  if [ $j -eq $i ]
>                  then
>                      oe_runmake O=${config} ${config}
>                      oe_runmake O=${config} ${UBOOT_MAKE_TARGET}
> -                    cp  ${S}/${config}/${UBOOT_BINARY}  ${S}/${config}/u-boot-
> ${type}.${UBOOT_SUFFIX}
> +                    for binary in ${UBOOT_BINARIES}; do
> +                        k=$(expr $k + 1);
> +                        if [ $k -eq $i ]; then
> +                            cp ${S}/${config}/${binary} ${S}/${config}/u-boot-
> ${type}.${UBOOT_SUFFIX}
> +                        fi
> +                    done
> +                    unset k
>                  fi
>              done
>              unset  j
> --
> 1.9.2




More information about the Openembedded-core mailing list