Skip to contentSkip to conversation

update the MIPS u-boot.lds

PATCH New xiangfu at openmobilefree.net 2 participants 4 messages Aug 9, 2010 – Aug 10, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1281366824-18811-1-git-send-email-y

A message that is not in the archive (sent off-list or not yet received): 1281366824-18811-2-git-send-email-y

#3 lore raw

PATCH 2/2 change the way of build little endian board

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 ++
 4 files changed, 28 insertions(+), 10 deletions(-)
Makefile +1 -0
index 451ccdd..47b5622 100644
@@ -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
arch/mips/config.mk +25 -2
index aa06761..f5d9ac5 100644
@@ -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)
arch/mips/cpu/config.mk +0 -8
index a173c54..098d6c7 100644
@@ -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)
include/configs/pb1x00.h +2 -0
index 5ad745e..49ca07c 100644
@@ -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 */
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 2/2 change the way of build little endian board

Quoted 8 lines · On Mon, Aug 9, 2010 at 11:13 AM, <[email protected]> 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

#5 lore raw

PATCH 2/2 change the way of build little endian board

Quoted 10 lines · Mike Frysinger
Quoted 8 lines · On Mon, Aug 9, 2010 at 11:13 AM,<[email protected]> 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 ++
Quoted 6 lines

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.

Signature · 3 lines
Best Regards
Xiangfu Liu
http://www.openmobilefree.net