Wolfgang Denk wrote: > Dear Jean-Christophe PLAGNIOL-VILLARD, > > In message <1241989002-21623-1-git-send-email-plagn...@jcrosoft.com> you > wrote: >> all mips boards except a few use the same cpu lds so move it to cpu/$(CPU) >> >> that could be overwrite in following order >> SOC >> BOARD >> via the corresponding config.mk >> >> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagn...@jcrosoft.com> >> Cc: Shinya Kuribayashi <shinya.kuribaya...@necel.com>
I've double checked that consolidation of u-boot.lds files is ok, and LDSCRIPT part as wll. >> diff --git a/Makefile b/Makefile >> index ee09856..2cb0ce2 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -3222,6 +3222,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 >> @@ -3232,6 +3233,7 @@ gth2_config : unconfig >> pb1000_config : unconfig >> @mkdir -p $(obj)include >> @echo "#define CONFIG_PB1000 1" >$(obj)include/config.h >> + @echo "#define CONFIG_CPU_LITTLE_ENDIAN" >>$(obj)include/config.h >> @$(MKCONFIG) -a pb1x00 mips mips pb1x00 > > These changes look unrelated to the linker script stuff you mention in > the commit message ? If they are related, you should explain what you > are doing here, and why. This tweaks little endian builds, and used with mips_config.mk change. +ifdef CONFIG_CPU_LITTLE_ENDIAN +PREDEF +=-DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ +PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF)) +else +PREDEF += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ +PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF)) +endif Background is, we're going to have a single, unified u-boot.lds, hence OUTPUT_FORMAT(default, big, little) command would be applied across all supported targets as well. Then, we'd like to pass -EL specifier to the linker so that some little-endian builds are processed properly. The goal here is, * 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! * Expected behavior # echo mips-linux | grep -q 'mips.*el-.*' || echo -EL -EL # echo mips-linux | grep -q 'mips.*el-.*' && echo -EB # echo mipsel-linux | grep -q 'mips.*el-.*' || echo -EL # echo mipsel-linux | grep -q 'mips.*el-.*' && echo -EB -EB * Side-effects Some LE toolchains with 'mips-linux', will have a redundant -LE. Some BE toolchains with 'mipsel-linux', will have a redundant -BE. In these cases, you would see a lot of warnings. It's harmless, so I'd like to ignore them as they're minor enough, and consolidation of lds files is more important here. Also note that I believe we would never find the latter case. So, I'd like to say the patch itself looks basically good. But still some work needs to be done. * How about splitting the patch into two, 1) CONFIG_CPU_LITTLE_ENDIAN introduction patch, and 2) u-boot.lds consoliation patch ? * Just wondered, is there any reason why you didn't use PREDEF_{BE,LE} like Linux kernel does? 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_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(UNDEF_ALL) $(PREDEF_LE)) else PLATFORM_CFLAGS += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(UNDEF_ALL) $(PREDEF_BE)) endif * By the way, s/PLATFORM_CFLAGS/PLATFORM_CPPFLAGS/. * And we need -EL/-EB specifier on PLATFORM_LDFLAGS as well. We call the GNU ld directly on the final link, so $(UNDEF_ALL) and $(PREDEF_??) part probably are not required. * We need to fix examples/{Makefile,mips.lds} as well. * We need to remove ENDIANNESS from cpu/mips/config.mk, finally. diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk index a173c54..098d6c7 100644 --- a/cpu/mips/config.mk +++ b/cpu/mips/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) If there're any problems or objections, I'll work on the patch on my side (to help Jean), and try to queue them toward the next release. Revised patches are welcome, of course. Shinya _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot