[OE-core] [PATCH] meta: handle UBOOT_CONFIG in image.bbclass

liu.ming50 at gmail.com liu.ming50 at gmail.com
Wed May 15 19:22:36 UTC 2019


From: Ming Liu <liu.ming50 at gmail.com>

The code dealing with IMAGE_FSTYPES in uboot-config.bbclass would not
take any effect since it's in a uboot particular class, but it's not
being inherited by any image recipes.

Move the IMAGE_FSTYPES handling part to image.bbclass would make it
really work.

Also drop some trivial debug code.

Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
---
 meta/classes/image.bbclass        | 12 ++++++++++++
 meta/classes/uboot-config.bbclass | 17 ++++-------------
 meta/conf/documentation.conf      |  2 +-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d2b2fb9..b1d63c6 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -365,6 +365,18 @@ python () {
 
         return basetype
 
+    # Check UBOOT_CONFIG
+    ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
+    ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
+    ubootconfigflags.pop('doc', None)
+    if len(ubootconfig) > 0:
+        for config in ubootconfig:
+            for f, v in ubootconfigflags.items():
+                if config == f:
+                    items = v.split(',')
+                    if len(items) > 1 and items[1]:
+                        d.appendVar('IMAGE_FSTYPES', ' ' + items[1])
+
     basetypes = {}
     alltypes = d.getVar('IMAGE_FSTYPES').split()
     typedeps = {}
diff --git a/meta/classes/uboot-config.bbclass b/meta/classes/uboot-config.bbclass
index 89ff970..59dcd04 100644
--- a/meta/classes/uboot-config.bbclass
+++ b/meta/classes/uboot-config.bbclass
@@ -15,18 +15,15 @@ UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}"
 
 python () {
     ubootmachine = d.getVar("UBOOT_MACHINE")
-    ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
     ubootbinary = d.getVar('UBOOT_BINARY')
     ubootbinaries = d.getVar('UBOOT_BINARIES')
+    ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
+    ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
+
     # The "doc" varflag is special, we don't want to see it here
     ubootconfigflags.pop('doc', None)
-    ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
 
     if not ubootmachine and not ubootconfig:
-        PN = d.getVar("PN")
-        FILE = os.path.basename(d.getVar("FILE"))
-        bb.debug(1, "To build %s, see %s for instructions on \
-                 setting up your machine config" % (PN, FILE))
         raise bb.parse.SkipRecipe("Either UBOOT_MACHINE or UBOOT_CONFIG must be set in the %s machine configuration." % d.getVar("MACHINE"))
 
     if ubootmachine and ubootconfig:
@@ -40,18 +37,12 @@ python () {
             for f, v in ubootconfigflags.items():
                 if config == f: 
                     items = v.split(',')
-                    if items[0] and len(items) > 3:
+                    if len(items) == 0 or len(items) > 3:
                         raise bb.parse.SkipRecipe('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
 }
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 550df20..048ce12 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -439,7 +439,7 @@ TUNEVALID[doc] = "Descriptions, stored as flags, of valid tuning features."
 
 #U
 
-UBOOT_CONFIG[doc] = "Configures the UBOOT_MACHINE and can also define IMAGE_FSTYPES for individual cases."
+UBOOT_CONFIG[doc] = "Configures the UBOOT_MACHINE and can also define IMAGE_FSTYPES, UBOOT_BINARIES for individual cases."
 UBOOT_ENTRYPOINT[doc] = "Specifies the entry point for the U-Boot image."
 UBOOT_LOADADDRESS[doc] = "Specifies the load address for the U-Boot image."
 UBOOT_LOCALVERSION[doc] = "Appends a string to the name of the local version of the U-Boot image."
-- 
2.7.4



More information about the Openembedded-core mailing list