U-Boot configuration rework
v2 cover U-Boot configuration rework
This serie consolidate the UBOOT_MACHINE and UBOOT_CONFIG handle; the code for verification of UBOOT_MACHINE has been duplicated and it must be shared with UBOOT_CONFIG to allow better handle of it and error reporting.
The patch simplify the U-Boot code and it has been tested with OE-Core and meta-fsl-arm layers.
Changes in v2:
- Fix grammar in messages (added 'the' and dropped 'are') - Hans Beckérus
Otavio Salvador (3):
uboot-config.bbclass: Use an annonymous python function uboot-config.bbclass: Handle UBOOT_MACHINE setting
u-boot, u-boot-fw-utils, u-boot-fw-utils-cross: Use uboot-config class
meta/classes/uboot-config.bbclass | 30 ++++++++++++++++------ .../u-boot/u-boot-fw-utils-cross_2013.07.bb | 2 +- meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb | 9 +------ meta/recipes-bsp/u-boot/u-boot.inc | 11 +------- 4 files changed, 25 insertions(+), 27 deletions(-)
Signature · 1 line
1.8.4.rc3
PATCH v2 1/3 uboot-config.bbclass: Use an annonymous python function
The processing needs to happen per recipe and thus it ought to use annonymous python function instead to be triggered at event.
---
Changes in v2: None
meta/classes/uboot-config.bbclass | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
meta/classes/uboot-config.bbclass +5 -7
@@ -7,14 +7,12 @@ # # Copyright 2013 (C) O.S. Systems Software LTDA. -addhandler uboot_config_eventhandler -uboot_config_eventhandler[eventmask] = "bb.event.ConfigParsed" -python uboot_config_eventhandler() { - ubootconfigflags = e.data.getVarFlags('UBOOT_CONFIG') +python () { + ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') if not ubootconfigflags: return - ubootconfig = (e.data.getVar('UBOOT_CONFIG', True) or "").split() + ubootconfig = (d.getVar('UBOOT_CONFIG', True) or "").split() if len(ubootconfig) > 1: raise bb.parse.SkipPackage('You can only have a single default for UBOOT_CONFIG.') elif len(ubootconfig) == 0:
@@ -31,9 +29,9 @@ python uboot_config_eventhandler() { if ubootconfig == f: bb.debug(1, "Setting UBOOT_MACHINE to %s." % items[0]) - e.data.setVar('UBOOT_MACHINE', items[0]) + d.setVar('UBOOT_MACHINE', items[0]) if items[1]: bb.debug(1, "Appending '%s' to IMAGE_FSTYPES." % items[1]) - e.data.appendVar('IMAGE_FSTYPES', ' ' + items[1]) + d.appendVar('IMAGE_FSTYPES', ' ' + items[1]) }
Signature · 1 line
1.8.4.rc3
PATCH v2 2/3 uboot-config.bbclass: Handle UBOOT_MACHINE setting
In reply to Otavio SalvadorThe class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG variables and handle possible mistakes done by user when using these variables.
---
Changes in v2:
- Fix grammar in messages (added 'the' and dropped 'are') - Hans Beckérus
meta/classes/uboot-config.bbclass | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
meta/classes/uboot-config.bbclass +17 -1
@@ -1,14 +1,30 @@ -# Allow easy override of U-Boot config for a machine +# Handle U-Boot config for a machine # # The format to specify it, in the machine, is: # # UBOOT_CONFIG ??= <default> # UBOOT_CONFIG[foo] = "config,images" # +# or +# +# UBOOT_MACHINE = "config" +# # Copyright 2013 (C) O.S. Systems Software LTDA. python () { + ubootmachine = d.getVar("UBOOT_MACHINE", True) ubootconfigflags = d.getVarFlags('UBOOT_CONFIG') + + if not ubootmachine and not ubootconfigflags: + PN = d.getVar("PN", True) + FILE = os.path.basename(d.getVar("FILE", True)) + bb.debug(1, "To build %s, see %s for instructions on \ + setting up your machine config" % (PN, FILE)) + raise bb.parse.SkipPackage("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE", True)) + + if ubootmachine and ubootconfigflags: + raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at the same time.") + if not ubootconfigflags: return
Signature · 1 line
1.8.4.rc3
PATCH v2 3/3 u-boot, u-boot-fw-utils, u-boot-fw-utils-cross: Use uboot-config class
In reply to Otavio SalvadorThe U-Boot configuration has been consolidates into a single class to avoid code duplication. This is now done by uboot-config class, so we now use it.
---
Changes in v2: None
meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb | 2 +- meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb | 9 +-------- meta/recipes-bsp/u-boot/u-boot.inc | 11 +---------- 3 files changed, 3 insertions(+), 19 deletions(-)
meta/recipes-bsp/u-boot/u-boot-fw-utils-cross_2013.07.bb +1 -1
@@ -15,7 +15,7 @@ SRC_URI = "git://git.denx.de/u-boot.git;branch=master;protocol=git" S = "${WORKDIR}/git" -inherit cross +inherit uboot-config cross EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"'
meta/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb +1 -8
@@ -17,14 +17,7 @@ S = "${WORKDIR}/git" EXTRA_OEMAKE = 'HOSTCC="${CC}" HOSTSTRIP="true"' -python () { - if not d.getVar("UBOOT_MACHINE", True): - PN = d.getVar("PN", True) - FILE = os.path.basename(d.getVar("FILE", True)) - bb.debug(1, "To build %s, see %s for instructions on \ - setting up your machine config" % (PN, FILE)) - raise bb.parse.SkipPackage("UBOOT_MACHINE is not set in the %s machine configuration." % d.getVar("MACHINE", True)) -} +inherit uboot-config do_compile () { oe_runmake ${UBOOT_MACHINE}
meta/recipes-bsp/u-boot/u-boot.inc +1 -10
@@ -3,19 +3,10 @@ HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" SECTION = "bootloaders" PROVIDES = "virtual/bootloader" -inherit deploy +inherit uboot-config deploy EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"' -python () { - if not d.getVar("UBOOT_MACHINE", True): - PN = d.getVar("PN", True) - FILE = os.path.basename(d.getVar("FILE", True)) - bb.debug(1, "To build %s, see %s for instructions on \ - setting up your machine config" % (PN, FILE)) - raise bb.parse.SkipPackage("UBOOT_MACHINE is not set in the %s machine configuration." % d.getVar("MACHINE", True)) -} - # Allow setting an additional version string that will be picked up by the # u-boot build system and appended to the u-boot version. If the .scmversion # file already exists it will not be overwritten.
Signature · 1 line
1.8.4.rc3