* MIPS Makefile not picking up CROSS_COMPILE from environment setting
@ 2007-10-18 18:46 Wolfgang Denk
2007-10-19 2:47 ` Atsushi Nemoto
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Wolfgang Denk @ 2007-10-18 18:46 UTC (permalink / raw)
To: linux-mips
Hello,
I noticed that, unlike for other architectures like ARM or PowerPC,
the MIPS Makefile does not pick up the settings from a CROSS_COMPILE
environment variable, at least not with many (all?) default configu-
rations.
This makes no sense to me - is there an intention behind it?
Or should I submit a patch to use an environment setting if it
exists, i. e. somthing like this:
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 08355eb..caa04a0 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -43,7 +43,7 @@ UTS_MACHINE := mips64
endif
ifdef CONFIG_CROSSCOMPILE
-CROSS_COMPILE := $(tool-prefix)
+CROSS_COMPILE ?= $(tool-prefix)
endif
ifdef CONFIG_32BIT
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The explanation requiring the fewest assumptions is the most likely
to be correct. -- William of Occam
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-18 18:46 MIPS Makefile not picking up CROSS_COMPILE from environment setting Wolfgang Denk
@ 2007-10-19 2:47 ` Atsushi Nemoto
2007-10-19 7:16 ` Geert Uytterhoeven
2007-10-19 11:18 ` Ralf Baechle
2 siblings, 0 replies; 8+ messages in thread
From: Atsushi Nemoto @ 2007-10-19 2:47 UTC (permalink / raw)
To: wd; +Cc: linux-mips
On Thu, 18 Oct 2007 20:46:36 +0200, Wolfgang Denk <wd@denx.de> wrote:
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index 08355eb..caa04a0 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -43,7 +43,7 @@ UTS_MACHINE := mips64
> endif
>
> ifdef CONFIG_CROSSCOMPILE
> -CROSS_COMPILE := $(tool-prefix)
> +CROSS_COMPILE ?= $(tool-prefix)
> endif
>
> ifdef CONFIG_32BIT
This would not work as expected if CROSS_COMPILE environment variable
did not exist. The toplevel Makefile always assigns an empty string
to CROSS_COMPILE before this, so $(tool-prefix) would not be used at
all.
If we needed to keep CONFIG_CROSSCOMPILE as is and needed
CROSS_COMPILE environment variable, something like this might work.
ifdef CONFIG_CROSSCOMPILE
ifndef CROSS_COMPILE
CROSS_COMPILE := $(tool-prefix)
endif
endif
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-18 18:46 MIPS Makefile not picking up CROSS_COMPILE from environment setting Wolfgang Denk
2007-10-19 2:47 ` Atsushi Nemoto
@ 2007-10-19 7:16 ` Geert Uytterhoeven
2007-10-21 8:37 ` Geert Uytterhoeven
2007-10-19 11:18 ` Ralf Baechle
2 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2007-10-19 7:16 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linux-mips
On Thu, 18 Oct 2007, Wolfgang Denk wrote:
> I noticed that, unlike for other architectures like ARM or PowerPC,
> the MIPS Makefile does not pick up the settings from a CROSS_COMPILE
> environment variable, at least not with many (all?) default configu-
> rations.
>
> This makes no sense to me - is there an intention behind it?
>
> Or should I submit a patch to use an environment setting if it
> exists, i. e. somthing like this:
BTW, currently there's a discussion about such things on lkml under the
subject `Make m68k cross compile like every other architecture.'.
As you can probably guess, MIPS is unlike every other architecture, too ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-18 18:46 MIPS Makefile not picking up CROSS_COMPILE from environment setting Wolfgang Denk
2007-10-19 2:47 ` Atsushi Nemoto
2007-10-19 7:16 ` Geert Uytterhoeven
@ 2007-10-19 11:18 ` Ralf Baechle
2007-10-19 12:39 ` Maciej W. Rozycki
2 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-10-19 11:18 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linux-mips
On Thu, Oct 18, 2007 at 08:46:36PM +0200, Wolfgang Denk wrote:
> I noticed that, unlike for other architectures like ARM or PowerPC,
> the MIPS Makefile does not pick up the settings from a CROSS_COMPILE
> environment variable, at least not with many (all?) default configu-
> rations.
>
> This makes no sense to me - is there an intention behind it?
There are four different tool prefixes possible for MIPS kernels,
mips-linux-, mipsel-linux-, mips64-linux- and mips64el-linux. This bit
in the Makefile makes the kernel automatically pick up the right thing
if CONFIG_CROSSCOMPILE is set.
The idea of passing CROSS_COMPILE from the environment always seemed to
be wrong to me - I keep jumping between all sorts of weird different
kernel configurations so no single setting of an environment variable
would cut it.
What I'd really like to see is a properly working CONFIG_MYARCH option
selectable in Kconfig. Then the makefiles should figure out if it's a
native or crosscompile and add the right tool prefix. The user should
not need to know that sort of stuff unless he wants to.
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-19 11:18 ` Ralf Baechle
@ 2007-10-19 12:39 ` Maciej W. Rozycki
0 siblings, 0 replies; 8+ messages in thread
From: Maciej W. Rozycki @ 2007-10-19 12:39 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Wolfgang Denk, linux-mips
On Fri, 19 Oct 2007, Ralf Baechle wrote:
> The idea of passing CROSS_COMPILE from the environment always seemed to
> be wrong to me - I keep jumping between all sorts of weird different
> kernel configurations so no single setting of an environment variable
> would cut it.
Yes, picking stuff from the environment tends to lead to surprising
behaviour some time later when one has already forgotten they have got
that setting put there. However, for the insistent, it is always possible
to override the variable at the make's command line, so you can say e.g.:
$ make "CROSS_COMPILE=mips64el-linux-" vmlinux
which is what I actually do, or, for the hard-liners:
$ make "CROSS_COMPILE=$CROSS_COMPILE" vmlinux
;-)
> What I'd really like to see is a properly working CONFIG_MYARCH option
> selectable in Kconfig. Then the makefiles should figure out if it's a
> native or crosscompile and add the right tool prefix. The user should
> not need to know that sort of stuff unless he wants to.
Well, the tool prefix cannot be figured out automatically anyway, as,
assuming 32-bit little-endian MIPS for example, it can be one of:
mipsel-linux-
mipsel-unknown-linux-gnu-
mipsel-dec-linux-
...
-- essentially any remotely sane setting that whoever configured the
toolchain considered would suit them best.
Also at one point I plan to implement that long-standing (and
long-ago-agreed-upon) idea of encoding the default ABI in the canonical
system name, which will help people with a 64-bit kernel getting their
userland builds pick the right ABI of their choice with just `./configure;
make', but which will make the choice of tool prefixes yet richer.
Maciej
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-19 7:16 ` Geert Uytterhoeven
@ 2007-10-21 8:37 ` Geert Uytterhoeven
2007-10-22 13:21 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2007-10-21 8:37 UTC (permalink / raw)
To: Wolfgang Denk; +Cc: linux-mips
On Fri, 19 Oct 2007, Geert Uytterhoeven wrote:
> On Thu, 18 Oct 2007, Wolfgang Denk wrote:
> > I noticed that, unlike for other architectures like ARM or PowerPC,
> > the MIPS Makefile does not pick up the settings from a CROSS_COMPILE
> > environment variable, at least not with many (all?) default configu-
> > rations.
> >
> > This makes no sense to me - is there an intention behind it?
> >
> > Or should I submit a patch to use an environment setting if it
> > exists, i. e. somthing like this:
>
> BTW, currently there's a discussion about such things on lkml under the
> subject `Make m68k cross compile like every other architecture.'.
>
> As you can probably guess, MIPS is unlike every other architecture, too ;-)
cc-cross-prefix got into mainline:
910b40468a9ce3f2f5d48c5d260329c27d45adb5
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-21 8:37 ` Geert Uytterhoeven
@ 2007-10-22 13:21 ` Ralf Baechle
2007-10-22 14:30 ` Geert Uytterhoeven
0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-10-22 13:21 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Wolfgang Denk, linux-mips
On Sun, Oct 21, 2007 at 10:37:29AM +0200, Geert Uytterhoeven wrote:
> > BTW, currently there's a discussion about such things on lkml under the
> > subject `Make m68k cross compile like every other architecture.'.
> >
> > As you can probably guess, MIPS is unlike every other architecture, too ;-)
>
> cc-cross-prefix got into mainline:
> 910b40468a9ce3f2f5d48c5d260329c27d45adb5
So then here is a followup patch also unlike any other ;-)
As a convenience for MIPS hacking I keep ARCH hardweired to mips though.
Ralf
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
---
Makefile | 7 +++++--
arch/mips/Makefile | 6 ++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 94b8705..6ad9eda 100644
--- a/Makefile
+++ b/Makefile
@@ -165,7 +165,10 @@ export srctree objtree VPATH TOPDIR
# then ARCH is assigned, getting whatever value it gets normally, and
# SUBARCH is subsequently ignored.
-SUBARCH := mips
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+ -e s/arm.*/arm/ -e s/sa110/arm/ \
+ -e s/s390x/s390/ -e s/parisc64/parisc/ \
+ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
# Cross compiling and selecting different set of gcc/bin-utils
# ---------------------------------------------------------------------------
@@ -186,7 +189,7 @@ SUBARCH := mips
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
-ARCH ?= $(SUBARCH)
+ARCH ?= mips
CROSS_COMPILE ?=
# Architecture as present in compile.h
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 14164c2..00a3033 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -42,8 +42,10 @@ tool-prefix = $(64bit-tool-prefix)
UTS_MACHINE := mips64
endif
-ifdef CONFIG_CROSSCOMPILE
-CROSS_COMPILE := $(tool-prefix)
+ifneq ($(SUBARCH),$(ARCH))
+ ifeq ($(CROSS_COMPILE),)
+ CROSS_COMPILE := $(call cc-cross-prefix, $(tool-prefix))
+ endif
endif
ifdef CONFIG_32BIT
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: MIPS Makefile not picking up CROSS_COMPILE from environment setting
2007-10-22 13:21 ` Ralf Baechle
@ 2007-10-22 14:30 ` Geert Uytterhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2007-10-22 14:30 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Wolfgang Denk, linux-mips
On Mon, 22 Oct 2007, Ralf Baechle wrote:
> On Sun, Oct 21, 2007 at 10:37:29AM +0200, Geert Uytterhoeven wrote:
> > > BTW, currently there's a discussion about such things on lkml under the
> > > subject `Make m68k cross compile like every other architecture.'.
> > >
> > > As you can probably guess, MIPS is unlike every other architecture, too ;-)
> >
> > cc-cross-prefix got into mainline:
> > 910b40468a9ce3f2f5d48c5d260329c27d45adb5
>
> So then here is a followup patch also unlike any other ;-)
>
> As a convenience for MIPS hacking I keep ARCH hardweired to mips though.
Of course, same here for m68k ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-10-22 14:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-18 18:46 MIPS Makefile not picking up CROSS_COMPILE from environment setting Wolfgang Denk
2007-10-19 2:47 ` Atsushi Nemoto
2007-10-19 7:16 ` Geert Uytterhoeven
2007-10-21 8:37 ` Geert Uytterhoeven
2007-10-22 13:21 ` Ralf Baechle
2007-10-22 14:30 ` Geert Uytterhoeven
2007-10-19 11:18 ` Ralf Baechle
2007-10-19 12:39 ` Maciej W. Rozycki
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.