Skip to contentSkip to conversation

U-Boot configuration rework

PATCH Superseded Otavio Salvador 2 participants 6 messages Sep 19, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

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
#1 lore raw

PATCH 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.

---
 meta/classes/uboot-config.bbclass | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
meta/classes/uboot-config.bbclass +5 -7
index fc37620..44b46ff 100644
@@ -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
#2 lore raw

PATCH 2/3 uboot-config.bbclass: Handle UBOOT_MACHINE setting

In reply to Otavio Salvador

The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG variables and handle possible mistakes done by user when using these variables.

---
 meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
meta/classes/uboot-config.bbclass +17 -1
index 44b46ff..b81cc60 100644
@@ -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 are 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 same time.")
+
     if not ubootconfigflags:
         return
 
Signature · 1 line
1.8.4.rc3
#3 lore raw

Re: [PATCH 2/3] uboot-config.bbclass: Handle UBOOT_MACHINE setting

Quoted 29 lines · Otavio Salvador

The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG variables and handle possible mistakes done by user when using these variables.

---
 meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
meta/classes/uboot-config.bbclass +5 -1
index 44b46ff..b81cc60 100644
@@ -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 () {

meta/classes/uboot-config.bbclass line 24

Quoted 10 lines
meta/classes/uboot-config.bbclass +9 -0
+    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 are must be set in the %s machine configuration." % d.getVar("MACHINE", True))
+

Minor grammar error; UBOOT_CONFIG are must > UBOOT_CONFIG must

meta/classes/uboot-config.bbclass line 27

Quoted 3 lines
meta/classes/uboot-config.bbclass +3 -0
+    if ubootmachine and ubootconfigflags:
+        raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at same time.")
+

Minor grammar error; at same time -> at the same time

Thanks.
Hans

Quoted 10 lines
meta/classes/uboot-config.bbclass +0 -1
     if not ubootconfigflags:
         return
 
--

1.8.4.rc3

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#4 lore raw

Re: [PATCH 2/3] uboot-config.bbclass: Handle UBOOT_MACHINE setting

Quoted 43 lines · Hans Beckérus
Quoted 29 lines · Otavio Salvador

The class now consolidate the handle of UBOOT_MACHINE and UBOOT_CONFIG variables and handle possible mistakes done by user when using these variables.

---
 meta/classes/uboot-config.bbclass | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
meta/classes/uboot-config.bbclass +5 -1
index 44b46ff..b81cc60 100644
@@ -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 () {

meta/classes/uboot-config.bbclass line 24

Quoted 10 lines
meta/classes/uboot-config.bbclass +9 -0
+    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 are must be set in the %s machine configuration." % d.getVar("MACHINE", True))
+

Minor grammar error; UBOOT_CONFIG are must > UBOOT_CONFIG must

Quoted 4 lines

meta/classes/uboot-config.bbclass line 27

Quoted 3 lines
meta/classes/uboot-config.bbclass +3 -0
+    if ubootmachine and ubootconfigflags:
+        raise bb.parse.SkipPackage("You cannot use UBOOT_MACHINE and UBOOT_CONFIG at same time.")
+

Minor grammar error; at same time -> at the same time

Thanks; I fixed both in my local tree and will wait some more time for feedback and I send a v2.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#5 lore raw

PATCH 3/3 u-boot, u-boot-fw-utils, u-boot-fw-utils-cross: Use uboot-config class

In reply to Otavio Salvador

The 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.

---
 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
index 7f649ca..4b7fd24 100644
@@ -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
index e711951..be54343 100644
@@ -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
index 6ec63df..10a3cf8 100644
@@ -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