public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
@ 2014-03-05  9:24 Masahiro Yamada
  2014-03-05 10:06 ` Detlev Zundel
  2014-03-05 13:37 ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Masahiro Yamada @ 2014-03-05  9:24 UTC (permalink / raw)
  To: u-boot

CROSS_COMPILE is generally passed from the command line
or by the environment variable because cross tools
vary from user to user.

But, having some choices of often used CROSS_COMPILE
seems reasonable.

$(call cc-cross-prefix, ...) returns the first prefix
where a prefix$(CC) is found in PATH.

If your cross tools exist in the argument of
$(call cc-cross-prefix, ...), you do not have to
specify it explicitly.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

My question is which cross tools are popular enough
to be added to the list.

In my opition, arm-linux-gnueabi-gcc is popular
because it is distributed in Ubuntu.

On the other hand, I am not sure ppc_8xx-gcc is currently
being used.

Which one should be to added/deleted to our default list.
Your comments are very welcome.
(I am not familiar with compilers very much.)


 arch/arm/config.mk        | 2 +-
 arch/microblaze/config.mk | 2 +-
 arch/powerpc/config.mk    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 792cb43..c5fd22f 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -6,7 +6,7 @@
 #
 
 ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := arm-linux-
+CROSS_COMPILE := $(call cc-cross-prefix, arm-linux- arm-linux-gnueabi-)
 endif
 
 ifndef CONFIG_STANDALONE_LOAD_ADDR
diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
index cdb321a..dae74f8 100644
--- a/arch/microblaze/config.mk
+++ b/arch/microblaze/config.mk
@@ -9,7 +9,7 @@
 #
 
 ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := mb-
+CROSS_COMPILE := $(call cc-cross-prefix, mb- microblaze-linux-)
 endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index e398f97..ac94b2e 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -6,7 +6,7 @@
 #
 
 ifeq ($(CROSS_COMPILE),)
-CROSS_COMPILE := ppc_8xx-
+CROSS_COMPILE := $(call cc-cross-prefix, ppc_8xx- powerpc-linux-)
 endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
-- 
1.8.3.2

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05  9:24 [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE Masahiro Yamada
@ 2014-03-05 10:06 ` Detlev Zundel
  2014-03-05 10:27   ` Masahiro Yamada
  2014-03-05 13:37 ` Tom Rini
  1 sibling, 1 reply; 7+ messages in thread
From: Detlev Zundel @ 2014-03-05 10:06 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

> CROSS_COMPILE is generally passed from the command line
> or by the environment variable because cross tools
> vary from user to user.
>
> But, having some choices of often used CROSS_COMPILE
> seems reasonable.
>
> $(call cc-cross-prefix, ...) returns the first prefix
> where a prefix$(CC) is found in PATH.
>
> If your cross tools exist in the argument of
> $(call cc-cross-prefix, ...), you do not have to
> specify it explicitly.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

I have to admit that I don't really like this approach.  On the one hand
it is an heuristic trying to guess the intentions of the user.  This is
nice if it works but can be very surprising when it goes wrong.

But more imprtantly, it will blur the the boundaries of the build
process as we trade the very self contained determinism of "use what
CROSS_COMPILE" says to "use what we may find in the rest of the system".

It would even be possible that a "once working" build process will not
work anymore because the user has installed a new toolchain in the
meantime and then this completely unrelated action has an (unwanted)
impact.

In short, I would rather want to stay with our current (clearly defined)
setup :)

Best wishes
  Detlev

-- 
He who can properly define and divide is to be considered a god.
                                        -- Plato
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05 10:06 ` Detlev Zundel
@ 2014-03-05 10:27   ` Masahiro Yamada
  2014-03-05 10:38     ` Detlev Zundel
  2014-03-05 21:45     ` Gerhard Sittig
  0 siblings, 2 replies; 7+ messages in thread
From: Masahiro Yamada @ 2014-03-05 10:27 UTC (permalink / raw)
  To: u-boot

Hi Detlev,


On Wed, 05 Mar 2014 11:06:03 +0100
Detlev Zundel <dzu@denx.de> wrote:

> Hi Masahiro,
> 
> > CROSS_COMPILE is generally passed from the command line
> > or by the environment variable because cross tools
> > vary from user to user.
> >
> > But, having some choices of often used CROSS_COMPILE
> > seems reasonable.
> >
> > $(call cc-cross-prefix, ...) returns the first prefix
> > where a prefix$(CC) is found in PATH.
> >
> > If your cross tools exist in the argument of
> > $(call cc-cross-prefix, ...), you do not have to
> > specify it explicitly.
> >
> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> 
> I have to admit that I don't really like this approach.  On the one hand
> it is an heuristic trying to guess the intentions of the user.  This is
> nice if it works but can be very surprising when it goes wrong.
> 
> But more imprtantly, it will blur the the boundaries of the build
> process as we trade the very self contained determinism of "use what
> CROSS_COMPILE" says to "use what we may find in the rest of the system".
> 
> It would even be possible that a "once working" build process will not
> work anymore because the user has installed a new toolchain in the
> meantime and then this completely unrelated action has an (unwanted)
> impact.
> 
> In short, I would rather want to stay with our current (clearly defined)
> setup :)
> 

Maybe this is verbose, but
just in case, let me add a few words.

If you like, you can still pass CROSS_COMPILE from the command line
or by the environment variable.


  ifeq ($(CROSS_COMPILE),)
  CROSS_COMPILE := $(call cc-cross-prefix, arm-linux- arm-linux-gnueabi-)
  endif

$(call cc-cross-prefix, ...) is invoked only when $(CROSS_COMPILE) is empty,
that is CROSS_COMPILE is not explicitely specified.


For users who know everything happening in the built system,
this patch might be helpful for less typing...


Best Regards
Masahiro Yamada

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05 10:27   ` Masahiro Yamada
@ 2014-03-05 10:38     ` Detlev Zundel
  2014-03-05 21:45     ` Gerhard Sittig
  1 sibling, 0 replies; 7+ messages in thread
From: Detlev Zundel @ 2014-03-05 10:38 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

> Hi Detlev,
>
>
> On Wed, 05 Mar 2014 11:06:03 +0100
> Detlev Zundel <dzu@denx.de> wrote:
>
>> Hi Masahiro,
>> 
>> > CROSS_COMPILE is generally passed from the command line
>> > or by the environment variable because cross tools
>> > vary from user to user.
>> >
>> > But, having some choices of often used CROSS_COMPILE
>> > seems reasonable.
>> >
>> > $(call cc-cross-prefix, ...) returns the first prefix
>> > where a prefix$(CC) is found in PATH.
>> >
>> > If your cross tools exist in the argument of
>> > $(call cc-cross-prefix, ...), you do not have to
>> > specify it explicitly.
>> >
>> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
>> 
>> I have to admit that I don't really like this approach.  On the one hand
>> it is an heuristic trying to guess the intentions of the user.  This is
>> nice if it works but can be very surprising when it goes wrong.
>> 
>> But more imprtantly, it will blur the the boundaries of the build
>> process as we trade the very self contained determinism of "use what
>> CROSS_COMPILE" says to "use what we may find in the rest of the system".
>> 
>> It would even be possible that a "once working" build process will not
>> work anymore because the user has installed a new toolchain in the
>> meantime and then this completely unrelated action has an (unwanted)
>> impact.
>> 
>> In short, I would rather want to stay with our current (clearly defined)
>> setup :)
>> 
>
> Maybe this is verbose, but
> just in case, let me add a few words.
>
> If you like, you can still pass CROSS_COMPILE from the command line
> or by the environment variable.
>
>
>   ifeq ($(CROSS_COMPILE),)
>   CROSS_COMPILE := $(call cc-cross-prefix, arm-linux- arm-linux-gnueabi-)
>   endif
>
> $(call cc-cross-prefix, ...) is invoked only when $(CROSS_COMPILE) is
> empty,
> that is CROSS_COMPILE is not explicitely specified.
>
>
> For users who know everything happening in the built system,
> this patch might be helpful for less typing...

Yes, I fully understand your intention but I still believe that setting
CROSS_COMPILE is usually scripted anyway so the savings are near
negligible and the "price" we pay is adding (more) information about
cross-toolchains which is really outside of the scope of U-Boot (or any
other project I'd say).

If there would be real savings, then maybe it is worth to break the
principle of modularity but in the current discussion I just don't see
that.

Best wishes
  Detlev

-- 
Our choice isn't between a digital world where the NSA can eavesdrop and one
where the NSA is prevented from eavesdropping; it's between a digital world
that is vulnerable to allattackers, and one that is secure for all users.
                              -- Bruce Schneier
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05  9:24 [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE Masahiro Yamada
  2014-03-05 10:06 ` Detlev Zundel
@ 2014-03-05 13:37 ` Tom Rini
  2014-03-12  5:47   ` Masahiro Yamada
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Rini @ 2014-03-05 13:37 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 06:24:24PM +0900, Masahiro Yamada wrote:

> CROSS_COMPILE is generally passed from the command line
> or by the environment variable because cross tools
> vary from user to user.
> 
> But, having some choices of often used CROSS_COMPILE
> seems reasonable.
> 
> $(call cc-cross-prefix, ...) returns the first prefix
> where a prefix$(CC) is found in PATH.
> 
> If your cross tools exist in the argument of
> $(call cc-cross-prefix, ...), you do not have to
> specify it explicitly.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
> 
> My question is which cross tools are popular enough
> to be added to the list.
> 
> In my opition, arm-linux-gnueabi-gcc is popular
> because it is distributed in Ubuntu.
> 
> On the other hand, I am not sure ppc_8xx-gcc is currently
> being used.
> 
> Which one should be to added/deleted to our default list.
> Your comments are very welcome.
> (I am not familiar with compilers very much.)
> 
> 
>  arch/arm/config.mk        | 2 +-
>  arch/microblaze/config.mk | 2 +-
>  arch/powerpc/config.mk    | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Looking at the kernel, mips is a better example of where this becomes a
handy thing, over just a "stop passing CROSS_COMPILE".  But that
includes adding tool-archpref.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140305/09ce1bd6/attachment.pgp>

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05 10:27   ` Masahiro Yamada
  2014-03-05 10:38     ` Detlev Zundel
@ 2014-03-05 21:45     ` Gerhard Sittig
  1 sibling, 0 replies; 7+ messages in thread
From: Gerhard Sittig @ 2014-03-05 21:45 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 19:27 +0900, Masahiro Yamada wrote:
> 
> If you like, you can still pass CROSS_COMPILE from the command line
> or by the environment variable.
> 
>   ifeq ($(CROSS_COMPILE),)
>   CROSS_COMPILE := $(call cc-cross-prefix, arm-linux- arm-linux-gnueabi-)
>   endif
> 
> $(call cc-cross-prefix, ...) is invoked only when $(CROSS_COMPILE) is empty,
> that is CROSS_COMPILE is not explicitely specified.

Ouch!  Please don't do this.  You may call it "not explicitely
specified", while I call it "explicitly NOT specified".

What I did in the past is to specifically pass 'CROSS_COMPILE='
on the command line, explicitly voiding any potentially set
value.  If the computer takes this as an invitation to come up
with its own idea of what I might have meant, this is bad.

I agree with Detlev, and strongly so.  Computers should strictly
do what they were told to do, and not try guess (they are awful
at that), or even to outsmart the user (this is counter
productive, and causes a lot of heat).


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

* [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE
  2014-03-05 13:37 ` Tom Rini
@ 2014-03-12  5:47   ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2014-03-12  5:47 UTC (permalink / raw)
  To: u-boot

Hello Detlev, Gerhard, Tom, 

On Wed, 5 Mar 2014 08:37:54 -0500
Tom Rini <trini@ti.com> wrote:

> On Wed, Mar 05, 2014 at 06:24:24PM +0900, Masahiro Yamada wrote:
> 
> > CROSS_COMPILE is generally passed from the command line
> > or by the environment variable because cross tools
> > vary from user to user.
> > 
> > But, having some choices of often used CROSS_COMPILE
> > seems reasonable.
> > 
> > $(call cc-cross-prefix, ...) returns the first prefix
> > where a prefix$(CC) is found in PATH.
> > 
> > If your cross tools exist in the argument of
> > $(call cc-cross-prefix, ...), you do not have to
> > specify it explicitly.
> > 
> > Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> > ---
> > 
> > My question is which cross tools are popular enough
> > to be added to the list.
> > 
> > In my opition, arm-linux-gnueabi-gcc is popular
> > because it is distributed in Ubuntu.
> > 
> > On the other hand, I am not sure ppc_8xx-gcc is currently
> > being used.
> > 
> > Which one should be to added/deleted to our default list.
> > Your comments are very welcome.
> > (I am not familiar with compilers very much.)
> > 
> > 
> >  arch/arm/config.mk        | 2 +-
> >  arch/microblaze/config.mk | 2 +-
> >  arch/powerpc/config.mk    | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> Looking at the kernel, mips is a better example of where this becomes a
> handy thing, over just a "stop passing CROSS_COMPILE".  But that
> includes adding tool-archpref.
> 
> -- 
> Tom


Actually, my motivation here was to emulate arch/$(ARCH)/Makefile
of Linux Kernel. Some of them are already using cc-cross-prefix.
And arch/mips/Makefile looked reasonable enough to me.

But if this patch is unwelcome to developers (it looks like so),
I do not mind retracting it.

Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2014-03-12  5:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05  9:24 [U-Boot] [RFC PATCH] kbuild: use "cc-cross-prefix" to choose CROSS_COMPILE Masahiro Yamada
2014-03-05 10:06 ` Detlev Zundel
2014-03-05 10:27   ` Masahiro Yamada
2014-03-05 10:38     ` Detlev Zundel
2014-03-05 21:45     ` Gerhard Sittig
2014-03-05 13:37 ` Tom Rini
2014-03-12  5:47   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox