[OE-core] [PATCH] module.bbclass: Add devshell support

Andre McCurdy armccurdy at gmail.com
Wed May 3 19:06:56 UTC 2017


On Wed, May 3, 2017 at 9:13 AM, Stefan Wiehler
<stefan.wiehler at missinglinkelectronics.com> wrote:
> Adds development shell support for out-of-tree kernel modules by reproducing
> the build environment of the compile task.
>
> Signed-off-by: Stefan Wiehler <stefan.wiehler at missinglinkelectronics.com>
> ---
>  meta/classes/module.bbclass | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index 802476bc7a..9b019513ae 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -1,6 +1,7 @@
>  inherit module-base kernel-module-split pkgconfig
>
>  addtask make_scripts after do_prepare_recipe_sysroot before do_compile
> +addtask make_scripts after do_prepare_recipe_sysroot before do_devshell

For normal recipes, devshell doesn't care about any build dependencies
(and so runs very quickly if you just need to refresh a patch etc). If
you need a devshell which is able to build something then the normal
way would be to manually run the configure or compile task before the
devshell task.

I'm not sure of kernel modules are a special enough case to do things
differently and add build dependencies to the devshell task?

>  do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
>  do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
>
> @@ -18,6 +19,26 @@ python __anonymous () {
>      d.setVar('KBUILD_EXTRA_SYMBOLS', " ".join(extra_symbols))
>  }
>
> +python do_devshell_prepend () {
> +    os.environ['CFLAGS'] = ''
> +    os.environ['CPPFLAGS'] = ''
> +    os.environ['CXXFLAGS'] = ''
> +    os.environ['LDFLAGS'] = ''
> +
> +    os.environ['KERNEL_PATH'] = d.getVar('STAGING_KERNEL_DIR')
> +    os.environ['KERNEL_SRC'] = d.getVar('STAGING_KERNEL_DIR')
> +    os.environ['KERNEL_VERSION'] = d.getVar('KERNEL_VERSION')
> +    os.environ['CC'] = d.getVar('KERNEL_CC')
> +    os.environ['LD'] = d.getVar('KERNEL_LD')
> +    os.environ['AR'] = d.getVar('KERNEL_AR')
> +    os.environ['O'] = d.getVar('STAGING_KERNEL_BUILDDIR')
> +    kbuild_extra_symbols = d.getVar('KBUILD_EXTRA_SYMBOLS')
> +    if kbuild_extra_symbols:
> +        os.environ['KBUILD_EXTRA_SYMBOLS'] = kbuild_extra_symbols
> +    else:
> +        os.environ['KBUILD_EXTRA_SYMBOLS'] = ''
> +}
> +
>  module_do_compile() {
>         unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
>         oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
> --
> 2.11.0
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



More information about the Openembedded-core mailing list