[OE-core] [PATCH] insane: Add mechanism to extend QA machine information from BSP layer

Christopher Larson clarson at kergoth.com
Wed Jul 27 03:02:21 UTC 2016


On Fri, Jul 22, 2016 at 7:25 AM, Richard Purdie <
richard.purdie at linuxfoundation.org> wrote:

> In order to add a new architecture or sub-architecture to OE, you currently
> need to tweak the table in insane.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 my_testfunc(machdata, d):
>     machdata["testmachine"] = {
>                         "test64":       ( 8,     0,    0,          False,
>        32),
>                         "testel":     ( 8,     0,    0,          True,
>       32),
>                       }
>     return machdata
>
> PACKAGEQA_EXTRA_MACHDEFFUNCS = "my_testfunc"
>
> [YOCTO #8554]
>
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
>
> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
> index 9b2337c..98381c2 100644
> --- a/meta/classes/insane.bbclass
> +++ b/meta/classes/insane.bbclass
> @@ -54,8 +54,8 @@ UNKNOWN_CONFIGURE_WHITELIST ?= "--enable-nls
> --disable-nls --disable-silent-rule
>  # feel free to add and correct.
>  #
>  #           TARGET_OS  TARGET_ARCH   MACHINE, OSABI, ABIVERSION, Little
> Endian, 32bit?
> -def package_qa_get_machine_dict():
> -    return {
> +def package_qa_get_machine_dict(d):
> +    machdata = {
>              "darwin9" : {
>                          "arm" :       (40,     0,    0,          True,
>       32),
>                        },
> @@ -168,6 +168,16 @@ def package_qa_get_machine_dict():
>                        },
>          }
>
> +    # Add in any extra user supplied data which may come from a BSP
> layer, removing the
> +    # need to always change this class directly
> +    extra_machdata = (d.getVar("PACKAGEQA_EXTRA_MACHDEFFUNCS", True) or
> "").split()
> +    for m in extra_machdata:
> +        call = m + "(machdata, d)"
> +        locs = { "machdata" : machdata, "d" : d}
> +        machdata = bb.utils.better_eval(call, locs)
>

Out of curiosity, why pass in the dict and have it modify and return it,
when it could just return a new dict that you add to machdata with
machdata.update()?
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160726/66093e40/attachment-0002.html>


More information about the Openembedded-core mailing list