Patchwork [2/2] kernel.bbclass: Call make with correct variables in kernelscripts_sstate_postinst

login
register
mail settings
Submitter Mike Crowe
Date Nov. 19, 2013, 5:37 p.m.
Message ID <1384882665-26840-2-git-send-email-mac@mcrowe.com>
Download mbox | patch
Permalink /patch/61981/
State New
Headers show

Comments

Mike Crowe - Nov. 19, 2013, 5:37 p.m.
Ensure that the environment variable and command line arguments that are
used when calling make in kernel_do_compile are used in
kernelscripts_sstate_postinst.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
---
 meta/classes/kernel.bbclass |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Bruce Ashfield - Nov. 19, 2013, 5:41 p.m.
On Tue, Nov 19, 2013 at 12:37 PM, Mike Crowe <mac@mcrowe.com> wrote:
> Ensure that the environment variable and command line arguments that are
> used when calling make in kernel_do_compile are used in
> kernelscripts_sstate_postinst.

What issue was this causing for you ? The scripts are native, and hence
should just be using the build machines compiler, linker and don't need
the kernel args.

So I'm not convinced that we need this patch, without seeing a tangible
issue that was triggered.

Bruce

>
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> ---
>  meta/classes/kernel.bbclass |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 2fad6e0..9d922d6 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -304,10 +304,11 @@ do_install[prefuncs] += "package_get_auto_pr"
>
>  SSTATEPOSTINSTFUNCS += "kernelscripts_sstate_postinst"
>  kernelscripts_sstate_postinst () {
> +       unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>         if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]; then
>                 (
>                   cd ${STAGING_KERNEL_DIR}
> -                 oe_runmake scripts
> +                 oe_runmake scripts CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
>                 )
>         fi
>  }
> --
> 1.7.10.4
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Richard Purdie - Nov. 19, 2013, 5:46 p.m.
On Tue, 2013-11-19 at 12:41 -0500, Bruce Ashfield wrote:
> On Tue, Nov 19, 2013 at 12:37 PM, Mike Crowe <mac@mcrowe.com> wrote:
> > Ensure that the environment variable and command line arguments that are
> > used when calling make in kernel_do_compile are used in
> > kernelscripts_sstate_postinst.
> 
> What issue was this causing for you ? The scripts are native, and hence
> should just be using the build machines compiler, linker and don't need
> the kernel args.
> 
> So I'm not convinced that we need this patch, without seeing a tangible
> issue that was triggered.

I think for some arches at least, something targetish is being cleaned
and then needing to be rebuilt.

I don't want to have to add dependencies for the toolchain so we need to
look into this further. 

Mike: which arch was this on and do you have the compile error?

Cheers,

Richard
Mike Crowe - Nov. 19, 2013, 5:49 p.m.
On Tuesday 19 November 2013 at 12:41:40 -0500, Bruce Ashfield wrote:
> On Tue, Nov 19, 2013 at 12:37 PM, Mike Crowe <mac@mcrowe.com> wrote:
> > Ensure that the environment variable and command line arguments that are
> > used when calling make in kernel_do_compile are used in
> > kernelscripts_sstate_postinst.
> 
> What issue was this causing for you ? The scripts are native, and hence
> should just be using the build machines compiler, linker and don't need
> the kernel args.
> 
> So I'm not convinced that we need this patch, without seeing a tangible
> issue that was triggered.

Well, for us v2.6.39 appears to be using the target compiler for
something. At least, I get a lot of:

 DEBUG: Executing shell function kernelscripts_sstate_postinst
 NOTE: make scripts
 /bin/sh: mipsel-oe-linux-gcc: command not found
 /bin/sh: mipsel-oe-linux-gcc: command not found
 /bin/sh: mipsel-oe-linux-gcc: command not found
 /bin/sh: mipsel-oe-linux-gcc: command not found
 make: mipsel-oe-linux-gcc: Command not found
 /bin/sh: mipsel-oe-linux-gcc: command not found
 /bin/sh: mipsel-oe-linux-gcc: command not found

which led me to the previous patch to ensure that the compiler is
available.

Thanks.

Mike.
Bruce Ashfield - Nov. 19, 2013, 5:56 p.m.
On Tue, Nov 19, 2013 at 12:46 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Tue, 2013-11-19 at 12:41 -0500, Bruce Ashfield wrote:
>> On Tue, Nov 19, 2013 at 12:37 PM, Mike Crowe <mac@mcrowe.com> wrote:
>> > Ensure that the environment variable and command line arguments that are
>> > used when calling make in kernel_do_compile are used in
>> > kernelscripts_sstate_postinst.
>>
>> What issue was this causing for you ? The scripts are native, and hence
>> should just be using the build machines compiler, linker and don't need
>> the kernel args.
>>
>> So I'm not convinced that we need this patch, without seeing a tangible
>> issue that was triggered.
>
> I think for some arches at least, something targetish is being cleaned
> and then needing to be rebuilt.

Right. I suppose that if you are installing a mips->mips compiler, then the
target toolchain is required. That really wasn't the intention of this change,
so it likely isn't properly restricted to the native build case (Where native
is a x86 development machine).

But with Phil pointing out the module.bbclass 'make scripts' code again,
I'd like to figure out why it wasn't working for the original bug report and try
to drop all of this mess.

Bruce

>
> I don't want to have to add dependencies for the toolchain so we need to
> look into this further.
>
> Mike: which arch was this on and do you have the compile error?
>
> Cheers,
>
> Richard
>
Phil Blundell - Nov. 19, 2013, 5:59 p.m.
On Tue, 2013-11-19 at 17:49 +0000, Mike Crowe wrote:
> On Tuesday 19 November 2013 at 12:41:40 -0500, Bruce Ashfield wrote:
> > What issue was this causing for you ? The scripts are native, and hence
> > should just be using the build machines compiler, linker and don't need
> > the kernel args.
> > 
> > So I'm not convinced that we need this patch, without seeing a tangible
> > issue that was triggered.
> 
> Well, for us v2.6.39 appears to be using the target compiler for
> something. At least, I get a lot of:

I did "make V=1 scripts" in a kernel devshell and it seems to be using
the cross-compiler to build scripts/mod/empty.o.  It's not entirely
obvious that this file actually needs to be in the sysroot, but it seems
that patching the kernel to prevent it getting built would be a bit of a
maintenance headache.

p.

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 2fad6e0..9d922d6 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -304,10 +304,11 @@  do_install[prefuncs] += "package_get_auto_pr"
 
 SSTATEPOSTINSTFUNCS += "kernelscripts_sstate_postinst"
 kernelscripts_sstate_postinst () {
+	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]; then
 		( 
 		  cd ${STAGING_KERNEL_DIR}
-		  oe_runmake scripts
+		  oe_runmake scripts CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
 		)
 	fi
 }