All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] module.bbclass: Add devshell support
@ 2017-05-03 16:13 Stefan Wiehler
  2017-05-03 19:06 ` Andre McCurdy
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wiehler @ 2017-05-03 16:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: ulrich.langenbach

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@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
 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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] module.bbclass: Add devshell support
  2017-05-03 16:13 [PATCH] module.bbclass: Add devshell support Stefan Wiehler
@ 2017-05-03 19:06 ` Andre McCurdy
  2017-05-05 14:45   ` Stefan Wiehler
  2017-05-05 15:01   ` Stefan Wiehler
  0 siblings, 2 replies; 5+ messages in thread
From: Andre McCurdy @ 2017-05-03 19:06 UTC (permalink / raw)
  To: Stefan Wiehler; +Cc: ulrich.langenbach, OE Core mailing list

On Wed, May 3, 2017 at 9:13 AM, Stefan Wiehler
<stefan.wiehler@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@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@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] module.bbclass: Add devshell support
  2017-05-03 19:06 ` Andre McCurdy
@ 2017-05-05 14:45   ` Stefan Wiehler
  2017-05-05 15:01   ` Stefan Wiehler
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Wiehler @ 2017-05-05 14:45 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: ulrich.langenbach, OE Core mailing list

 >> 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?

I agree, I couldn't find any other class having devshell task dependencies.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] module.bbclass: Add devshell support
  2017-05-03 19:06 ` Andre McCurdy
  2017-05-05 14:45   ` Stefan Wiehler
@ 2017-05-05 15:01   ` Stefan Wiehler
  2017-05-26  6:36     ` Stefan Wiehler
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Wiehler @ 2017-05-05 15:01 UTC (permalink / raw)
  To: openembedded-core

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@missinglinkelectronics.com>
---

Change: Remove devshell task dependency

 meta/classes/module.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index 802476b..391776d 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -18,6 +18,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}   \
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] module.bbclass: Add devshell support
  2017-05-05 15:01   ` Stefan Wiehler
@ 2017-05-26  6:36     ` Stefan Wiehler
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Wiehler @ 2017-05-26  6:36 UTC (permalink / raw)
  To: OE Core mailing list; +Cc: Ulrich Langenbach

 > 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@missinglinkelectronics.com>
 > ---
 >
 > Change: Remove devshell task dependency
 >
 > …

Is there anything else preventing this from being merged?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-26  6:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 16:13 [PATCH] module.bbclass: Add devshell support Stefan Wiehler
2017-05-03 19:06 ` Andre McCurdy
2017-05-05 14:45   ` Stefan Wiehler
2017-05-05 15:01   ` Stefan Wiehler
2017-05-26  6:36     ` Stefan Wiehler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.