]> code.ossystems Code Review - openembedded-core.git/commitdiff
siteinfo: Add mechanism to extend siteinfo information from BSP layer
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 22 Jul 2016 14:25:43 +0000 (15:25 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Jul 2016 22:46:55 +0000 (23:46 +0100)
In order to add a new architecture or sub-architecture to OE, you currently
need to tweak the table in siteinfo.bbclass. This adds a mechanism so this
can be done from a BSP layer. It needs a function definition which needs
a class file but can then be done with something like:

def rp_testfunc2(archinfo, osinfo, targetinfo, d):
    archinfo['testarch'] = "little-endian bit-32"
    osinfo['testos'] = "common-linux"
    targetinfo['mymach-linux'] = "mymach-linux-common"

    return archinfo, osinfo, targetinfo

SITEINFO_EXTRA_DATAFUNCS = "rp_testfunc2"

[YOCTO #8554]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/siteinfo.bbclass

index 50141a353f9d3e4dcd5e1b3c922b741cdd8fc5ae..03d4c4fd200b2470fc4b247f39f36ca07aa9fff9 100644 (file)
@@ -107,6 +107,14 @@ def siteinfo_data(d):
         "x86_64-mingw32": "bit-64",
     }
 
+    # Add in any extra user supplied data which may come from a BSP layer, removing the
+    # need to always change this class directly
+    extra_siteinfo = (d.getVar("SITEINFO_EXTRA_DATAFUNCS", True) or "").split()
+    for m in extra_siteinfo:
+        call = m + "(archinfo, osinfo, targetinfo, d)"
+        locs = { "archinfo" : archinfo, "osinfo" : osinfo, "targetinfo" : targetinfo, "d" : d}
+        archinfo, osinfo, targetinfo = bb.utils.better_eval(call, locs)
+
     hostarch = d.getVar("HOST_ARCH", True)
     hostos = d.getVar("HOST_OS", True)
     target = "%s-%s" % (hostarch, hostos)