linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: honor the ARCH setting of the existing configuration
@ 2011-07-31 19:44 Aunt Tillie
  2011-07-31 20:20 ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Aunt Tillie @ 2011-07-31 19:44 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, linux-kbuild, David Woodhouse, Aunt Tillie

This change make Kbuild honor the ARCH setting of the existing configuration, if
any .config is present so that it does not get reset if there is a conflict
with the default ARCH for the platform and the current setting.

Signed-off-by: Arnaud Lacombe aka. Aunt Tillie <lacombar@gmail.com>
---
 Makefile |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index f676d15..bb2f1fc 100644
--- a/Makefile
+++ b/Makefile
@@ -192,7 +192,12 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 export KBUILD_BUILDHOST := $(SUBARCH)
-ARCH		?= $(SUBARCH)
+ifeq ($(shell test -e .config && echo y),y)
+ARCH		?= $(shell sed '/^\# Linux\/\(.*\) .* Kernel Configuration/!d; s//\1/' .config)
+endif
+ifeq ($(ARCH),)
+ARCH		:= $(SUBARCH)
+endif
 CROSS_COMPILE	?= $(CONFIG_CROSS_COMPILE:"%"=%)
 
 # Architecture as present in compile.h
-- 
1.7.6.153.g78432


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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-07-31 19:44 [PATCH] kbuild: honor the ARCH setting of the existing configuration Aunt Tillie
@ 2011-07-31 20:20 ` David Woodhouse
  2011-07-31 22:07   ` Arnaud Lacombe
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2011-07-31 20:20 UTC (permalink / raw)
  To: Aunt Tillie; +Cc: Michal Marek, linux-kernel, linux-kbuild

On Sun, 2011-07-31 at 15:44 -0400, Aunt Tillie wrote:
> This change make Kbuild honor the ARCH setting of the existing configuration, if
> any .config is present so that it does not get reset if there is a conflict
> with the default ARCH for the platform and the current setting.

I think this is the wrong approach.

There are plans to make the architecture a *real* configuration option,
and that will be lovely when it happens (and changing the 32-vs-64
distinction so that it's no longer a different ARCH but just a config
option is one step in that direction).

But I don't think this patch is really a helpful step towards that goal;
we should do that *properly* or not at all, and not give some temporary
half-baked behaviour in the meantime, that people will come to depend on
(and others will hate because it means they can't just take an ARM
config and build it on their x86 box and have it automatically
converted).

And the other problem is that this is not really addressing the
underlying issue, which is that we are still clinging to the legacy ARCH
values for directories which don't exist in the arch/ directory any
more, and which are *redundant* with the setting of CONFIG_64BIT in the
config.

The only problem here is that we're not using the merged ARCH=x86 by
default, as most of the other 64-bit capable architectures in the kernel
do — and it works just fine for all of them.

If the x86 merge still hasn't been completed, four years after we
deleted arch/{i386,x86_64}, then we need to complete it. Thanks for
helping to root out the few esoteric things that still don't quite work
right on x86; it's very useful to find them and fix them.

-- 
dwmw2


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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-07-31 20:20 ` David Woodhouse
@ 2011-07-31 22:07   ` Arnaud Lacombe
  2011-07-31 22:34     ` David Woodhouse
  0 siblings, 1 reply; 8+ messages in thread
From: Arnaud Lacombe @ 2011-07-31 22:07 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Michal Marek, linux-kernel, linux-kbuild

Hi,

On Sun, Jul 31, 2011 at 4:20 PM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Sun, 2011-07-31 at 15:44 -0400, Aunt Tillie wrote:
>> This change make Kbuild honor the ARCH setting of the existing configuration, if
>> any .config is present so that it does not get reset if there is a conflict
>> with the default ARCH for the platform and the current setting.
>
> I think this is the wrong approach.
>
> There are plans to make the architecture a *real* configuration option,
> and that will be lovely when it happens (and changing the 32-vs-64
> distinction so that it's no longer a different ARCH but just a config
> option is one step in that direction).
>
> But I don't think this patch is really a helpful step towards that goal;
> we should do that *properly* or not at all, and not give some temporary
> half-baked behaviour in the meantime, that people will come to depend on
> (and others will hate because it means they can't just take an ARM
> config and build it on their x86 box and have it automatically
> converted).
>
Irrelevant. This can still be done explicitly:

% make ARCH=arm defconfig
[... time passes ...]
% make ARCH=i386 oldconfig

> And the other problem is that this is not really addressing the
> underlying issue, which is that we are still clinging to the legacy ARCH
> values for directories which don't exist in the arch/ directory any
> more, and which are *redundant* with the setting of CONFIG_64BIT in the
> config.
>
no. The relation between the target architecture and bitness' width is
not a bijection, and treating it as such is short-sighted.

> The only problem here is that we're not using the merged ARCH=x86 by
> default, as most of the other 64-bit capable architectures in the kernel
> do — and it works just fine for all of them.
>
> If the x86 merge still hasn't been completed, four years after we
> deleted arch/{i386,x86_64}, then we need to complete it. Thanks for
> helping to root out the few esoteric things that still don't quite work
> right on x86; it's very useful to find them and fix them.
>
I think you totally miss the point of the patch as you keep being
self-centered on x86.

I am working with configuration for mips, sh, powerpc, arm and x86.
Some of them are for real board, some of them are to regress-test
compilers, binutils and kernel builds. Each of those config hardcode
the CROSS_COMPILER string and have their own build directory. In each
case, I want to be able to just run "make O=/src/obj/v3.0-arm
oldnoconfig all" without having to worry about anything else.

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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-07-31 22:07   ` Arnaud Lacombe
@ 2011-07-31 22:34     ` David Woodhouse
  2011-07-31 23:20       ` Arnaud Lacombe
  2011-08-01  2:05       ` Randy Dunlap
  0 siblings, 2 replies; 8+ messages in thread
From: David Woodhouse @ 2011-07-31 22:34 UTC (permalink / raw)
  To: Arnaud Lacombe; +Cc: Michal Marek, linux-kernel, linux-kbuild

On Sun, 2011-07-31 at 18:07 -0400, Arnaud Lacombe wrote:
> I think you totally miss the point of the patch as you keep being
> self-centered on x86.

I'm focusing on x86 at the moment because x86 is the only architecture
that's *broken* in this respect. The other architectures that you
mention below, where they support 64-bit kernels, all work fine with
only *one* ARCH= setting covering all configurations. It's only x86
where we haven't actually *finished* the merge.

> I am working with configuration for mips, sh, powerpc, arm and x86.
> Some of them are for real board, some of them are to regress-test
> compilers, binutils and kernel builds. Each of those config hardcode
> the CROSS_COMPILER string and have their own build directory. In each
> case, I want to be able to just run "make O=/src/obj/v3.0-arm
> oldnoconfig all" without having to worry about anything else.

Yes, that's a valid but *separate* problem. FWIW I usually solve this
problem with a two-line GNUmakefile:
	ARCH := arm
	include Makefile

I haven't checked whether it works for out-of-source-tree builds; I bet
it could be made to.

I would love to see $ARCH turned into a proper configuration option. 

-- 
dwmw2


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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-07-31 22:34     ` David Woodhouse
@ 2011-07-31 23:20       ` Arnaud Lacombe
  2011-08-01  2:05       ` Randy Dunlap
  1 sibling, 0 replies; 8+ messages in thread
From: Arnaud Lacombe @ 2011-07-31 23:20 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Michal Marek, linux-kernel, linux-kbuild

Hi,

On Sun, Jul 31, 2011 at 6:34 PM, David Woodhouse <dwmw2@infradead.org> wrote:
>> I am working with configuration for mips, sh, powerpc, arm and x86.
>> Some of them are for real board, some of them are to regress-test
>> compilers, binutils and kernel builds. Each of those config hardcode
>> the CROSS_COMPILER string and have their own build directory. In each
>> case, I want to be able to just run "make O=/src/obj/v3.0-arm
>> oldnoconfig all" without having to worry about anything else.
>
> Yes, that's a valid but *separate* problem.
yes, but I never really looked at it so far, I had the occasion now,
and did the patch.

> FWIW I usually solve this problem with a two-line GNUmakefile:
>        ARCH := arm
>        include Makefile
>
this would not work as I might ends up being multiple build in
parallel and I am an aficionados of `git clean -fdx' so the extra file
would go away.

> I haven't checked whether it works for out-of-source-tree builds; I bet
> it could be made to.
>
> I would love to see $ARCH turned into a proper configuration option.
>
I do not think this would be that hard, the main issue is that it
would heavily be cross-tree.

 - Arnaud

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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-07-31 22:34     ` David Woodhouse
  2011-07-31 23:20       ` Arnaud Lacombe
@ 2011-08-01  2:05       ` Randy Dunlap
  2011-08-01  8:42         ` David Woodhouse
  1 sibling, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2011-08-01  2:05 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Arnaud Lacombe, Michal Marek, linux-kernel, linux-kbuild

On Sun, July 31, 2011 3:34 pm, David Woodhouse wrote:
> On Sun, 2011-07-31 at 18:07 -0400, Arnaud Lacombe wrote:
>> I think you totally miss the point of the patch as you keep being
>> self-centered on x86.
>
> I'm focusing on x86 at the moment because x86 is the only architecture
> that's *broken* in this respect. The other architectures that you
> mention below, where they support 64-bit kernels, all work fine with
> only *one* ARCH= setting covering all configurations. It's only x86
> where we haven't actually *finished* the merge.
>
>> I am working with configuration for mips, sh, powerpc, arm and x86.
>> Some of them are for real board, some of them are to regress-test
>> compilers, binutils and kernel builds. Each of those config hardcode
>> the CROSS_COMPILER string and have their own build directory. In each
>> case, I want to be able to just run "make O=/src/obj/v3.0-arm
>> oldnoconfig all" without having to worry about anything else.
>
> Yes, that's a valid but *separate* problem. FWIW I usually solve this
> problem with a two-line GNUmakefile:
> 	ARCH := arm
> 	include Makefile
>
> I haven't checked whether it works for out-of-source-tree builds; I bet
> it could be made to.
>
> I would love to see $ARCH turned into a proper configuration option.

I don't object in principle, but I'm expecting to have to modify/update
multiple *working* scripts as a result.  But of course this won't be
the first time and I don't expect it to be the last time either.
[signed:  eeyore]


-- 



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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-08-01  2:05       ` Randy Dunlap
@ 2011-08-01  8:42         ` David Woodhouse
  2011-08-01 17:33           ` Arnaud Lacombe
  0 siblings, 1 reply; 8+ messages in thread
From: David Woodhouse @ 2011-08-01  8:42 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Arnaud Lacombe, Michal Marek, linux-kernel, linux-kbuild

On Sun, 2011-07-31 at 19:05 -0700, Randy Dunlap wrote:
> 
> > I would love to see $ARCH turned into a proper configuration option.
> 
> I don't object in principle, but I'm expecting to have to modify/update
> multiple *working* scripts as a result.  But of course this won't be
> the first time and I don't expect it to be the last time either.
> [signed:  eeyore] 

:)

Yeah, that's why I'd kind of like to see it done *once*, *properly*.

Arnaud's hack to read it from .config is cute, but might give behaviour
that people will come to depend on in their scripts and then we take it
away again.

-- 
dwmw2


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

* Re: [PATCH] kbuild: honor the ARCH setting of the existing configuration
  2011-08-01  8:42         ` David Woodhouse
@ 2011-08-01 17:33           ` Arnaud Lacombe
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaud Lacombe @ 2011-08-01 17:33 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Randy Dunlap, Michal Marek, linux-kernel, linux-kbuild

Hi,

On Mon, Aug 1, 2011 at 4:42 AM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Sun, 2011-07-31 at 19:05 -0700, Randy Dunlap wrote:
>>
>> > I would love to see $ARCH turned into a proper configuration option.
>>
>> I don't object in principle, but I'm expecting to have to modify/update
>> multiple *working* scripts as a result.  But of course this won't be
>> the first time and I don't expect it to be the last time either.
>> [signed:  eeyore]
>
> :)
>
> Yeah, that's why I'd kind of like to see it done *once*, *properly*.
>
> Arnaud's hack to read it from .config is cute, but might give behaviour
> that people will come to depend on in their scripts and then we take it
> away again.
>
Instead of talking of irrelevant implementation details, what
_behavior_ do you expect ?

The priority I expect is (from most to least):
 1. command line
 2. existing configuration (.config)
 3. Makefile's default
 4. Kconfig default

 - Arnaud

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

end of thread, other threads:[~2011-08-01 17:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-31 19:44 [PATCH] kbuild: honor the ARCH setting of the existing configuration Aunt Tillie
2011-07-31 20:20 ` David Woodhouse
2011-07-31 22:07   ` Arnaud Lacombe
2011-07-31 22:34     ` David Woodhouse
2011-07-31 23:20       ` Arnaud Lacombe
2011-08-01  2:05       ` Randy Dunlap
2011-08-01  8:42         ` David Woodhouse
2011-08-01 17:33           ` Arnaud Lacombe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).