2006-05-05 01:52:57

by Harik

[permalink] [raw]
Subject: Kbuild + Cross compiling

I must be an idiot, but why does Kbuild rebuild every file when cross-compiling?
I'm not editing .config or touching any headers, I'm making tweaks to
a single .c driver,
and it is taking forever due to continual full-rebuilds.

building on i386 for ARCH=arm CROSS_COMPILE=arm-linux-uclibc-

I tried following the logic, but everything is a forced build using
if_changed and if_changed_dep, and I can't read GNU Make well enough
to figure out what it thinks is new. I know make -d says all the
dependancies are up-to-date, so it's being forced some other way.


2006-05-05 04:55:30

by Sam Ravnborg

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On Thu, May 04, 2006 at 09:52:56PM -0400, Dan Merillat wrote:
> I must be an idiot, but why does Kbuild rebuild every file when
> cross-compiling?
> I'm not editing .config or touching any headers, I'm making tweaks to
> a single .c driver,
> and it is taking forever due to continual full-rebuilds.
>
> building on i386 for ARCH=arm CROSS_COMPILE=arm-linux-uclibc-
>
> I tried following the logic, but everything is a forced build using
> if_changed and if_changed_dep, and I can't read GNU Make well enough
> to figure out what it thinks is new. I know make -d says all the
> dependancies are up-to-date, so it's being forced some other way.
kbuild checks for any differences in the commandline alos - so a rebuild
happens if you change options to gcc (think -O2 => -Os).
If you experience that for example mm/slab.c is rebuild then try to
do the following:
cp mm/.slab.o.cmd foo
make mm/
diff -u foo mm/.slab.o.cmd

If diff detects any difference then you know why and need to find out
why there is a difference.

Btw. what make version and what kernel version are you compiling?
There was some inconsistency in kbuild that triggered with make 3.81-rc1
and which will trigger with make 3.82-cvs also.
This issue was only fixed lately - recall it was for 2.6.16

Sam

2006-05-05 06:30:08

by Harik

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On 5/5/06, Sam Ravnborg <[email protected]> wrote:
> kbuild checks for any differences in the commandline alos - so a rebuild
> happens if you change options to gcc (think -O2 => -Os).
> If you experience that for example mm/slab.c is rebuild then try to
> do the following:
> cp mm/.slab.o.cmd foo
> make mm/
> diff -u foo mm/.slab.o.cmd
>
> If diff detects any difference then you know why and need to find out
> why there is a difference.

Nothing, even md5sums match.
2abfcbee132335ba8e1da120569abf67 .do_mounts.o.cmd
2abfcbee132335ba8e1da120569abf67 .do_mounts.o.cmd.1

but it gets rebuilt every time.
>
> Btw. what make version and what kernel version are you compiling?
> There was some inconsistency in kbuild that triggered with make 3.81-rc1
> and which will trigger with make 3.82-cvs also.
> This issue was only fixed lately - recall it was for 2.6.16

2.6.15, but make 3.80. Is that the same problem?

I havn't developed on i386 lately so I don't know if it's only a
cross-compile issue.

2006-05-05 09:56:28

by Ben Dooks

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On Thu, May 04, 2006 at 09:52:56PM -0400, Dan Merillat wrote:
> I must be an idiot, but why does Kbuild rebuild every file when
> cross-compiling?
> I'm not editing .config or touching any headers, I'm making tweaks to
> a single .c driver,
> and it is taking forever due to continual full-rebuilds.
>
> building on i386 for ARCH=arm CROSS_COMPILE=arm-linux-uclibc-
>
> I tried following the logic, but everything is a forced build using
> if_changed and if_changed_dep, and I can't read GNU Make well enough
> to figure out what it thinks is new. I know make -d says all the
> dependancies are up-to-date, so it's being forced some other way.

I do not see the problem building ARM kernels using i386
so this is possibly specific to the setup, or something
you are doing, like changing compiler or compiler options.

--
Ben ([email protected], http://www.fluff.org/)

'a smiley only costs 4 bytes'

2006-05-05 14:36:36

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On 5/5/06, Dan Merillat <[email protected]> wrote:
> I must be an idiot, but why does Kbuild rebuild every file when cross-compiling?
> I'm not editing .config or touching any headers, I'm making tweaks to
> a single .c driver,
> and it is taking forever due to continual full-rebuilds.

I had that problem a while ago. Turned out that the version of make I used on
my debian had a bug.

--
blue skies,
Martin

2006-05-05 15:15:32

by Sam Ravnborg

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On Fri, May 05, 2006 at 02:30:05AM -0400, Dan Merillat wrote:
> On 5/5/06, Sam Ravnborg <[email protected]> wrote:
> >kbuild checks for any differences in the commandline alos - so a rebuild
> >happens if you change options to gcc (think -O2 => -Os).
> >If you experience that for example mm/slab.c is rebuild then try to
> >do the following:
> >cp mm/.slab.o.cmd foo
> >make mm/
> >diff -u foo mm/.slab.o.cmd
> >
> >If diff detects any difference then you know why and need to find out
> >why there is a difference.
>
> Nothing, even md5sums match.
> 2abfcbee132335ba8e1da120569abf67 .do_mounts.o.cmd
> 2abfcbee132335ba8e1da120569abf67 .do_mounts.o.cmd.1
>
> but it gets rebuilt every time.

So we need to dive a bit deeper to understand why everything gets
rebuild.
Try following patch:

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e48e60d..4c52131 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -189,6 +189,9 @@ endef
# Built-in and composite module parts

%.o: %.c FORCE
+ @echo $@
+ @echo chg=$?
+ @echo arg-check=$(call arg-check, $(cmd_cc_o_c), $(cmd_$@))
$(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)

This will not fix anything - but will give us a hint why things gets
rebuild.
After applying the patch try:
make init/do_mounts.o

And then post the output.
Also include the .do_mounts.o.cmd file

Sam

2006-05-05 20:53:38

by Harik

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On 5/5/06, Martin Schwidefsky <[email protected]> wrote:
> On 5/5/06, Dan Merillat <[email protected]> wrote:
> > I must be an idiot, but why does Kbuild rebuild every file when cross-compiling?
> > I'm not editing .config or touching any headers, I'm making tweaks to
> > a single .c driver,
> > and it is taking forever due to continual full-rebuilds.
>
> I had that problem a while ago. Turned out that the version of make I used on
> my debian had a bug.

That was it. debian make 3.80 was buggy. Since make was a likely
culprit I upgraded it anyway, then I read this and it confirmed what I
found.

Thanks for the help, everyone.

2006-05-05 21:18:46

by Sam Ravnborg

[permalink] [raw]
Subject: Re: Kbuild + Cross compiling

On Fri, May 05, 2006 at 04:53:36PM -0400, Dan Merillat wrote:
>
> That was it. debian make 3.80 was buggy. Since make was a likely
> culprit I upgraded it anyway, then I read this and it confirmed what I
> found.
If debian reports make 3.80-rc1 as 3.80 then either debian or make has a
problem.

Sam