public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] update the MIPS u-boot.lds
       [not found] <1281366824-18811-1-git-send-email-y>
@ 2010-08-09 15:13 ` xiangfu at openmobilefree.net
       [not found] ` <1281366824-18811-2-git-send-email-y>
  1 sibling, 0 replies; 4+ messages in thread
From: xiangfu at openmobilefree.net @ 2010-08-09 15:13 UTC (permalink / raw)
  To: u-boot



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

* [U-Boot] [PATCH 2/2] change the way of build little endian board
       [not found] ` <1281366824-18811-2-git-send-email-y>
@ 2010-08-09 15:13   ` xiangfu at openmobilefree.net
  2010-08-09 17:10     ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: xiangfu at openmobilefree.net @ 2010-08-09 15:13 UTC (permalink / raw)
  To: u-boot

add CONFIG_CPU_LITTLE_ENDIAN to little endian board config.
use -dumpmachine to check if the cross compile.

Signed-off-by: Xiangfu Liu <xiangfu@openmobilefree.net>
Acked-by: Shinya Kuribayashi <skuribay@pobox.com>

---
 Makefile                 |    1 +
 arch/mips/config.mk      |   27 +++++++++++++++++++++++++--
 arch/mips/cpu/config.mk  |    8 --------
 include/configs/pb1x00.h |    2 ++
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 451ccdd..47b5622 100644
--- a/Makefile
+++ b/Makefile
@@ -2306,6 +2306,7 @@ dbau1550_config		:	unconfig
 dbau1550_el_config	:	unconfig
 	@mkdir -p $(obj)include
 	@echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
+	@echo "#define CONFIG_CPU_LITTLE_ENDIAN" >>$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 gth2_config		:	unconfig
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index aa06761..f5d9ac5 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -23,8 +23,6 @@
 
 CROSS_COMPILE ?= mips_4KC-
 
-STANDALONE_LOAD_ADDR = 0x80200000 -T mips.lds
-
 PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 
 #
@@ -50,3 +48,28 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic
 PLATFORM_CPPFLAGS		+= -msoft-float
 PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib
+
+#
+# We explicitly add the endianness specifier if needed, this allows
+# to compile kernels with a toolchain for the other endianness. We
+# carefully avoid to add it redundantly because gcc 3.3/3.4 complains
+# when fed the toolchain default!
+#
+# Certain gcc versions upto gcc 4.1.1 (probably 4.2-subversion as of
+# 2006-10-10 don't properly change the predefined symbols if -EB / -EL
+# are used, so we kludge that here.  A bug has been filed at
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.
+#
+UNDEF_ALL += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
+UNDEF_ALL += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
+PREDEF_BE += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
+PREDEF_LE += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
+ifdef CONFIG_CPU_LITTLE_ENDIAN
+PLATFORM_CPPFLAGS	+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF_LE))
+PLATFORM_LDFLAGS	+= -EL
+else
+PLATFORM_CPPFLAGS	+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF_BE))
+PLATFORM_LDFLAGS	+= -EB
+endif
+
+STANDALONE_LOAD_ADDR = 0x80200000 -T mips.lds $(PLATFORM_LDFLAGS)
diff --git a/arch/mips/cpu/config.mk b/arch/mips/cpu/config.mk
index a173c54..098d6c7 100644
--- a/arch/mips/cpu/config.mk
+++ b/arch/mips/cpu/config.mk
@@ -28,12 +28,4 @@ else \
 	echo "-march=4kc -mtune=4kc"; \
 fi)
 
-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
-endif
-
-MIPSFLAGS += $(ENDIANNESS)
-
 PLATFORM_CPPFLAGS += $(MIPSFLAGS)
diff --git a/include/configs/pb1x00.h b/include/configs/pb1x00.h
index 5ad745e..49ca07c 100644
--- a/include/configs/pb1x00.h
+++ b/include/configs/pb1x00.h
@@ -28,6 +28,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_CPU_LITTLE_ENDIAN
+
 #define CONFIG_MIPS32		1  /* MIPS32 CPU core	*/
 #define CONFIG_PB1X00		1
 #define CONFIG_SOC_AU1X00	1  /* alchemy series cpu */
-- 
1.7.0.4

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

* [U-Boot] [PATCH 2/2] change the way of build little endian board
  2010-08-09 15:13   ` [U-Boot] [PATCH 2/2] change the way of build little endian board xiangfu at openmobilefree.net
@ 2010-08-09 17:10     ` Mike Frysinger
  2010-08-10  1:30       ` Xiangfu Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2010-08-09 17:10 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 9, 2010 at 11:13 AM,  <xiangfu@openmobilefree.net> wrote:
> add CONFIG_CPU_LITTLE_ENDIAN to little endian board config.
> use -dumpmachine to check if the cross compile.
>
> ---
> ?Makefile ? ? ? ? ? ? ? ? | ? ?1 +
> ?arch/mips/config.mk ? ? ?| ? 27 +++++++++++++++++++++++++--
> ?arch/mips/cpu/config.mk ?| ? ?8 --------
> ?include/configs/pb1x00.h | ? ?2 ++

since this is a mips-specific issue, please prefix your summaries
accordingly.  so the subject should be something like:
  mips: change the way of build little endian board

that way non-mips people can easily ignore this e-mail
-mike

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

* [U-Boot] [PATCH 2/2] change the way of build little endian board
  2010-08-09 17:10     ` Mike Frysinger
@ 2010-08-10  1:30       ` Xiangfu Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Xiangfu Liu @ 2010-08-10  1:30 UTC (permalink / raw)
  To: u-boot

On 08/10/2010 01:10 AM, Mike Frysinger wrote:
> On Mon, Aug 9, 2010 at 11:13 AM,<xiangfu@openmobilefree.net>  wrote:
>> add CONFIG_CPU_LITTLE_ENDIAN to little endian board config.
>> use -dumpmachine to check if the cross compile.
>>
>> ---
>>   Makefile                 |    1 +
>>   arch/mips/config.mk      |   27 +++++++++++++++++++++++++--
>>   arch/mips/cpu/config.mk  |    8 --------
>>   include/configs/pb1x00.h |    2 ++
>
> since this is a mips-specific issue, please prefix your summaries
> accordingly.  so the subject should be something like:
>    mips: change the way of build little endian board
>
> that way non-mips people can easily ignore this e-mail
> -mike
Hi Mike

thanks for the advice. I will do that next time.

-- 
Best Regards
Xiangfu Liu
http://www.openmobilefree.net

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

end of thread, other threads:[~2010-08-10  1:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1281366824-18811-1-git-send-email-y>
2010-08-09 15:13 ` [U-Boot] [PATCH 1/2] update the MIPS u-boot.lds xiangfu at openmobilefree.net
     [not found] ` <1281366824-18811-2-git-send-email-y>
2010-08-09 15:13   ` [U-Boot] [PATCH 2/2] change the way of build little endian board xiangfu at openmobilefree.net
2010-08-09 17:10     ` Mike Frysinger
2010-08-10  1:30       ` Xiangfu Liu

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