diff options
author | OpenWrt Developers <openwrt-devel@openwrt.org> | 2008-11-19 17:40:05 +0000 |
---|---|---|
committer | OpenWrt Developers <openwrt-devel@openwrt.org> | 2008-11-19 17:40:05 +0000 |
commit | 7931f01fd898dab7002a601a92173b4ed2bd96dd (patch) | |
tree | 82989cd5ea141baf9cdc51d0578368e36cd15a67 /package/uboot-ifxmips/patches | |
parent | b0f5f9729a310db2950ed84b8c7387cb7aa69494 (diff) | |
download | master-187ad058-7931f01fd898dab7002a601a92173b4ed2bd96dd.tar.gz master-187ad058-7931f01fd898dab7002a601a92173b4ed2bd96dd.tar.bz2 master-187ad058-7931f01fd898dab7002a601a92173b4ed2bd96dd.zip |
[ifxmips] cleanup uboot package
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13291 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uboot-ifxmips/patches')
-rw-r--r-- | package/uboot-ifxmips/patches/100-ifx.patch | 1230 |
1 files changed, 766 insertions, 464 deletions
diff --git a/package/uboot-ifxmips/patches/100-ifx.patch b/package/uboot-ifxmips/patches/100-ifx.patch index 566132032c..0fd1c02af6 100644 --- a/package/uboot-ifxmips/patches/100-ifx.patch +++ b/package/uboot-ifxmips/patches/100-ifx.patch @@ -35,171 +35,121 @@ ######################################################################### # # U-boot build supports producing a object files to the separate external -@@ -155,6 +174,11 @@ - endif - endif - -+ -+ -+ -+ -+ - export CROSS_COMPILE - - # load other configuration -@@ -163,7 +187,9 @@ - ######################################################################### +@@ -164,6 +183,11 @@ # U-Boot objects....order is important (i.e. start must be first) --OBJS = cpu/$(CPU)/start.o -+OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o -+OBJS_BOOTSTRAP = cpu/$(CPU)/$(BOARDDIR)/start_bootstrap.o + OBJS = cpu/$(CPU)/start.o ++OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o ++ ++cpu/$(CPU)/start_bootstrap.S: cpu/$(CPU)/start.S ++ ln -s start.S cpu/$(CPU)/start_bootstrap.S + ifeq ($(CPU),i386) OBJS += cpu/$(CPU)/start16.o OBJS += cpu/$(CPU)/reset.o -@@ -186,11 +212,11 @@ +@@ -183,6 +207,7 @@ + endif + + OBJS := $(addprefix $(obj),$(OBJS)) ++OBJS_BOOTSTRAP := $(addprefix $(obj),$(OBJS_BOOTSTRAP)) LIBS = lib_generic/libgeneric.a LIBS += board/$(BOARDDIR)/lib$(BOARD).a --LIBS += cpu/$(CPU)/lib$(CPU).a -+LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a - ifdef SOC - LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a - endif --LIBS += lib_$(ARCH)/lib$(ARCH).a -+LIBS += lib_$(ARCH)/$(BOARDIR)/lib$(ARCH).a - LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \ - fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a - LIBS += net/libnet.a -@@ -198,27 +224,54 @@ - LIBS += rtc/librtc.a - LIBS += dtt/libdtt.a - LIBS += drivers/libdrivers.a --LIBS += drivers/nand/libnand.a --LIBS += drivers/nand_legacy/libnand_legacy.a -+#LIBS += drivers/nand_$(BOARDDIR)/libnand.a -+#LIBS += drivers/nand_legacy/libnand_legacy.a - LIBS += drivers/sk98lin/libsk98lin.a - LIBS += post/libpost.a post/cpu/libcpu.a - LIBS += common/libcommon.a +@@ -206,15 +231,24 @@ LIBS += $(BOARDLIBS) LIBS := $(addprefix $(obj),$(LIBS)) + ++LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a ++LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a ++#LIBS_BOOTSTRAP+= board/ifx/libifx.a ++LIBS_BOOTSTRAP+= cpu/$(CPU)/lib$(CPU).a + -+LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a -+LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a -+#LIBS_BOOTSTRAP+= board/ifx/libifx.a -+LIBS_BOOTSTRAP+= cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a ++LIBS_BOOTSTRAP := $(addprefix $(obj),$(LIBS_BOOTSTRAP)) + -+#HEAD_OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o lib_$(ARCH)/board.o -+ -+#HEAD_LIBS = board/$(BOARDDIR)/lib$(BOARD).a -+#HEAD_LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a -+#HEAD_LIBS += lib_$(ARCH)/lib$(ARCH).a -+#HEAD_LIBS += lib_generic/libgeneric.a -+#HEAD_LIBS += common/console.o -+#HEAD_LIBS += common/devices.o -+#HEAD_LIBS += common/cmd_bootm.o -+ -+#.PHONY : $(LIBS) $(HEAD_LIBS) .PHONY : $(LIBS) -+.PHONY : $(LIBS_BOOTSTRAP) ++.PHONY : $(obj)lib_bootstrap/libbootstrap.a # Add GCC lib PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc # The "tools" are needed early, so put this first # Don't include stuff already done in $(LIBS) -+ #examples ++ #examples SUBDIRS = tools \ - examples \ post \ post/cpu .PHONY : $(SUBDIRS) +@@ -226,14 +260,75 @@ -+# HEAD_SUBDIRS = tools -+#HEAD_SUBDIRS = lib_generic \ -+# cpu/$(CPU) \ -+# board/$(BOARDDIR) \ -+# common \ -+# lib_$(ARCH) -+#.PHONY : $(HEAD_SUBDIRS) -+ - ifeq ($(CONFIG_NAND_U_BOOT),y) - NAND_SPL = nand_spl - U_BOOT_NAND = $(obj)u-boot-nand.bin -@@ -227,13 +280,76 @@ __OBJS := $(subst $(obj),,$(OBJS)) __LIBS := $(subst $(obj),,$(LIBS)) - ++__LIBS_BOOTSTRAP := $(subst $(obj),,$(LIBS_BOOTSTRAP)) ++ +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS)) +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS)) -+ + ######################################################################### ######################################################################### ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) +#IFX_ALL = $(obj)u-boot.ifx $(obj)head.srec $(obj)head.bin $(obj)head $(obj)head.map $(COMPRESS_FILE) $(obj)u-boot.srec -+IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin ++IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin $(obj)System_bootstrap.map ++IFX_BOOTSTRAP = $(obj)bootstrap.bin all: $(ALL) +ifx_all: $(IFX_ALL) + ++ifx_bootstrap: $(IFX_BOOTSTRAP) + -+$(obj)u-boot.ifx: $(obj)System.map $(obj)bootstrap.bin $(obj)u-boot.lzimg ++$(obj)u-boot.ifx: $(obj)bootstrap.bin $(obj)u-boot.lzimg + @cat $(obj)bootstrap.bin > $(obj)u-boot.ifx + @cat $(obj)u-boot.lzimg >> $(obj)u-boot.ifx + -+$(obj)u-boot.lzimg: $(obj)u-boot.bin System.map -+# @lzma -f -z --best -v $(obj)u-boot.bin -+ @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma -+ @./tools/mkimage -A mips -T firmware -C lzma \ -+ -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@ ++$(obj)u-boot.lzimg: $(obj)u-boot.bin $(obj)System.map ++ @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma ++ $(obj)tools/mkimage -A mips -T firmware -C lzma \ ++ -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -n 'u-boot image' -d $(obj)u-boot.lzma $@ + -+$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin ++$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)bootstrap.bin + @ cp -f $(obj)u-boot.ifx $(obj)u-boot.bin + @ ./mkbootimg.incaip2 $(obj)ld_uboot.img < ld_uboot.conf + -+ -+ -+ +$(obj)u-boot.zimg: $(obj)u-boot.bin $(obj)System.map + gzip $(obj)u-boot.bin -+ ./tools/mkimage -A $(ARCH) -T firmware -C gzip \ -+ -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ ++ $(obj)tools/mkimage -A $(ARCH) -T firmware -C gzip \ ++ -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ + -d u-boot.gz $@ + +$(obj)u-boot.bzimg: $(obj)u-boot.bin $(obj)System.map + bzip $(obj)u-boot.bin -+ ./tools/mkimage -A $(ARCH) -T firmware -C bzip2 \ -+ -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ ++ $(obj)tools/mkimage -A $(ARCH) -T firmware -C bzip2 \ ++ -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ + -d u-boot.bz2 $@ + +$(obj)u-boot.limg: $(obj)u-boot.bin $(obj)System.map -+# @lzma -f -z --best -v $(obj)u-boot.bin -+ @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma -+ ./tools/mkimage -A $(ARCH) -T firmware -C lzma \ -+ -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ ++ @lzma e $(obj)u-boot.bin $(obj)u-boot.lzma ++ $(obj)tools/mkimage -A $(ARCH) -T firmware -C lzma \ ++ -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ -+ -d u-boot.bin.lzma $@ ++ -d u-boot.lzma $@ + +$(obj)u-boot.img: $(obj)u-boot.bin $(obj)System.map -+ ./tools/mkimage -A $(ARCH) -T firmware -C none \ -+ -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ -+ -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \ ++ $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ ++ -a 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ ++ -e 0x$(shell grep "T _start" $(obj)System.map | awk '{ printf "%s", $$1 }') \ + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ + -d u-boot.bin $@ @@ -207,7 +157,7 @@ $(obj)u-boot.hex: $(obj)u-boot $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -@@ -243,28 +359,36 @@ +@@ -243,28 +338,33 @@ $(obj)u-boot.bin: $(obj)u-boot $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ @@ -228,57 +178,50 @@ --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ -Map u-boot.map -o u-boot -+ -+ +$(obj)bootstrap.bin: $(obj)bootstrap + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ + +$(obj)bootstrap : depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP) + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \ -+ --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \ ++ --start-group $(__LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \ + -Map bootstrap.map -o bootstrap + $(OBJS): -- $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@)) -+ $(MAKE) -C cpu/$(CPU)/$(BOARDDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@)) + $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@)) $(LIBS): $(MAKE) -C $(dir $(subst $(obj),,$@)) -+ -+$(LIBS_BOOTSTRAP): -+ $(MAKE) -C `dirname $@` ++$(obj)lib_bootstrap/libbootstrap.a: ++ $(MAKE) -C $(dir $(subst $(obj),,$@)) + $(SUBDIRS): $(MAKE) -C $@ all -@@ -295,14 +419,14 @@ - - tags ctags: - ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \ -- lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ -+ lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` - - etags: - etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \ -- lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \ -+ lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \ - fs/cramfs fs/fat fs/fdos fs/jffs2 \ - net disk rtc dtt drivers drivers/sk98lin common \ - \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)` -@@ -2032,7 +2156,20 @@ +@@ -310,7 +410,12 @@ + $(obj)System.map: $(obj)u-boot + @$(NM) $< | \ + grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ +- sort > $(obj)System.map ++ sort > $@ ++ ++$(obj)System_bootstrap.map: $(obj)bootstrap ++ @$(NM) $< | \ ++ grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ ++ sort > $@ + + ######################################################################### + else +@@ -2032,7 +2137,20 @@ # MIPS #======================================================================== ######################################################################### -## MIPS32 4Kc -+## Infineon MIPS generic u-boot config ++## Infineon MIPS generic u-boot config +######################################################################### +danube_config: unconfig -+ @$(MKCONFIG) $(@:_config=) mips mips danube ++ @$(MKCONFIG) $(@:_config=) mips mips danube ifx danube + +amazon_config: unconfig + @$(MKCONFIG) $(@:_config=) mips mips amazon @@ -292,16 +235,7 @@ ######################################################################### xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1)))) -@@ -2246,6 +2383,8 @@ - rm -f $(obj)include/bmp_logo.h - find nand_spl -lname "*" -print | xargs rm -f - rm -f nand_spl/u-boot-spl nand_spl/u-boot-spl.map -+ rm -f lib_bootstrap/*.o -+ rm -f lib_bootstrap/*.a - - clobber: clean - find $(OBJTREE) -type f \( -name .depend \ -@@ -2254,7 +2393,7 @@ +@@ -2254,7 +2372,7 @@ | xargs -0 rm -f rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h rm -fr $(obj)*.*~ @@ -310,57 +244,6 @@ rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm ---- /dev/null -+++ b/build_danube.sh -@@ -0,0 +1,28 @@ -+#!/bin/sh -+IFX_CONFIG_FLASH_SIZE=8 -+IFX_CONFIG_MEMORY_SIZE=30 -+CONFIG_RAM_TEXT_BASE=0xA0400000 -+ -+#prepare_headers() -+#{ -+# cp -f include/flash_$1.h \ -+# include/flash.h -+# cp -f include/net_$1.h \ -+# include/net.h -+# cp -f include/asm-mips/cacheops_$1.h \ -+# include/asm-mips/cacheops.h -+# cp -f include/asm-mips/mipsregs_$1.h \ -+# include/asm-mips/mipsregs.h -+#} -+#prepare_headers "danube" -+UBOOT_COMPRESS=lzma -+UBOOT_CFLAGS="-DCONFIG_IFX_MIPS -DCONFIG_LZMA -DIFX_CONFIG_MEMORY_SIZE=${IFX_CONFIG_MEMORY_SIZE} -DIFX_CONFIG_FLASH_SIZE=${IFX_CONFIG_FLASH_SIZE}" -+ -+rm -f .config_ok -+ -+make CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} CPU_TYPE=${IFX_CONFIG_CPU} danube_config distclean -+ -+CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" make UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} CPU_TYPE=${IFX_CONFIG_CPU} danube_config -+ echo -n > .config_ok -+ -+CROSS_COMPILE="mips-linux-uclibc-" CROSS_COMPILE_UCLIBC=1 COMPRESS=${UBOOT_COMPRESS} PLATFORM_CPU=mips32r2 IFX_CFLAGS="${UBOOT_CFLAGS}" make UBOOT_RAM_TEXT_BASE=${CONFIG_RAM_TEXT_BASE} BOOTSTRAP_PRINTF_STATUS=$2 CPU_TYPE=${IFX_CONFIG_CPU} ifx_all ---- a/common/Makefile -+++ b/common/Makefile -@@ -46,7 +46,7 @@ - env_nand.o env_dataflash.o env_flash.o env_eeprom.o \ - env_nvram.o env_nowhere.o \ - exports.o \ -- flash.o fpga.o ft_build.o \ -+ flash_$(BOARD).o fpga.o ft_build.o \ - hush.o kgdb.o lcd.o lists.o lynxkdi.o \ - memsize.o miiphybb.o miiphyutil.o \ - s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \ -@@ -60,7 +60,7 @@ - - all: $(LIB) $(AOBJS) - --$(LIB): $(obj).depend $(OBJS) -+$(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - - $(obj)environment.o: $(src)environment.c $(obj)../tools/envcrc --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -31,6 +31,7 @@ @@ -428,7 +311,7 @@ case IH_COMP_NONE: comp = "uncompressed"; break; case IH_COMP_GZIP: comp = "gzip compressed"; break; case IH_COMP_BZIP2: comp = "bzip2 compressed"; break; -+ case IH_COMP_LZMA: comp = "lzma compressed"; break; ++ case IH_COMP_LZMA: comp = "lzma compressed"; break; default: comp = "unknown compression"; break; } @@ -506,7 +389,7 @@ + *bPartialEnd = 1; } } -+ ++ if (s_first[bank] >= 0) { if (s_last[bank] < 0) { if (addr_last > b_end) { @@ -519,13 +402,11 @@ int rcode = 0; if (argc < 2) { -@@ -368,8 +385,8 @@ - } +@@ -369,7 +386,7 @@ } #endif -- + - if (argc != 3) { -+ + if (argc != 4) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; @@ -605,7 +486,7 @@ + } + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect); + } -+ ++ + if (bLastPartial && first_sect != last_sect){ + if(flash_erase (info, last_sect, last_sect)) { + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, last_sect); @@ -701,7 +582,7 @@ + s_last[bank], + bPartialStart, + bPartialEnd); -+ } ++ } + + //Erase full sectores + if (bPartialStart) @@ -721,7 +602,7 @@ } } - printf ("Erased %d sectors\n", erased); -+ ++ + if (erased && !bPartialErase) { + printf ("Erased %d sectors\n", erased); + } else if (bPartialErase){ @@ -900,7 +781,7 @@ debug (" %08lX ... %08lX ...", (ulong)&(flash_addr_new->data), sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data)); -+ ++ if ((rc = flash_write((char *)env_ptr->data, (ulong)&(flash_addr_new->data), sizeof(env_ptr->data))) || @@ -912,7 +793,7 @@ int env_init(void) { #ifdef CONFIG_OMAP2420H4 -@@ -280,8 +279,55 @@ +@@ -280,6 +279,52 @@ #ifdef CMD_SAVEENV @@ -964,11 +845,8 @@ + int saveenv(void) { -+#define debug printf int len, rc; - ulong end_addr; - ulong flash_sect_addr; -@@ -331,7 +377,7 @@ +@@ -331,7 +376,7 @@ return 1; puts ("Erasing Flash..."); @@ -977,92 +855,21 @@ return 1; puts ("Writing to Flash... "); ---- a/common/hush.c -+++ b/common/hush.c -@@ -3167,9 +3167,11 @@ - int code = 0; - #endif - do { -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - ctx.type = flag; - initialize_context(&ctx); - update_ifs_map(); -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0); - inp->promptmode=1; - rcode = parse_stream(&temp, &ctx, inp, '\n'); -@@ -3180,9 +3182,12 @@ - syntax(); - #ifdef __U_BOOT__ - flag_repeat = 0; -+printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - #endif -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - } - if (rcode != 1 && ctx.old_flag == 0) { -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - done_word(&temp, &ctx); - done_pipe(&ctx,PIPE_SEQ); - #ifndef __U_BOOT__ -@@ -3202,6 +3207,7 @@ - if (code == -1) - flag_repeat = 0; - #endif -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - } else { - if (ctx.old_flag != 0) { - free(ctx.stack); -@@ -3215,6 +3221,7 @@ - temp.quote = 0; - inp->p = NULL; - free_pipe_list(ctx.list_head,0); -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - } - b_free(&temp); - } while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP)); /* loop on syntax errors, return on EOF */ -@@ -3235,9 +3242,12 @@ - #ifdef __U_BOOT__ - char *p = NULL; - int rcode; -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - if ( !s || !*s) - return 1; -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - if (!(p = strchr(s, '\n')) || *++p) { -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - p = xmalloc(strlen(s) + 2); - strcpy(p, s); - strcat(p, "\n"); -@@ -3247,6 +3257,7 @@ - return rcode; - } else { - #endif -+ printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__); - setup_string_in_str(&input, s); - return parse_stream_outer(&input, flag); - #ifdef __U_BOOT__ --- a/config.mk +++ b/config.mk -@@ -77,7 +77,7 @@ - sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules - endif - ifdef CPU --sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules -+sinclude $(TOPDIR)/cpu/$(CPU)/$(BOARD)/config.mk # include CPU specific rules - endif - ifdef SOC - sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules -@@ -130,7 +130,8 @@ +@@ -127,7 +127,11 @@ + OBJDUMP = $(CROSS_COMPILE)objdump + RANLIB = $(CROSS_COMPILE)RANLIB + ++ifneq (,$(findstring s,$(MAKEFLAGS))) ++ARFLAGS = cr ++else ARFLAGS = crv ++endif RELFLAGS= $(PLATFORM_RELFLAGS) DBGFLAGS= -g # -DDEBUG --OPTFLAGS= -Os #-fomit-frame-pointer -+OPTFLAGS= -Os -+#-O2 #-fomit-frame-pointer - ifndef LDSCRIPT - #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug - ifeq ($(CONFIG_NAND_U_BOOT),y) -@@ -139,12 +140,15 @@ + OPTFLAGS= -Os #-fomit-frame-pointer +@@ -139,12 +143,15 @@ LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds endif endif @@ -1079,40 +886,61 @@ ifneq ($(OBJTREE),$(SRCTREE)) CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include -@@ -180,7 +184,10 @@ +@@ -180,7 +187,8 @@ AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) -LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS) +LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(UBOOT_RAM_TEXT_BASE) $(PLATFORM_LDFLAGS) +LDFLAGS_BOOTSTRAP += -Bstatic -T $(LDSCRIPT_BOOTSTRAP) -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS) -+ -+#HEAD_LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(HEAD_FLASH_TEXT_BASE) $(PLATFORM_LDFLAGS) # Location of a usable BFD library, where we define "usable" as # "built for ${HOST}, supports ${TARGET}". Sensible values are -@@ -211,10 +218,17 @@ - - ######################################################################### - -+AFLAGS := $(AFLAGS) $(IFX_CFLAGS) -+CFLAGS := $(CFLAGS) $(IFX_CFLAGS) -+CPPFLAGS := $(CPPFLAGS) $(IFX_CFLAGS) -+ -+######################################################################### -+ +@@ -214,12 +222,19 @@ export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \ AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \ MAKE -export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS -+#export UBOOT_RAM_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS +export UBOOT_RAM_TEXT_BASE BOOTSTRAP_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### + ifndef REMOTE_BUILD + ++%_bootstrap.s: %_bootstrap.S ++ $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $< ++%_bootstrap.o: %_bootstrap.S ++ $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $< ++%_bootstrap.o: %_bootstrap.c ++ $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $< ++ + %.s: %.S + $(CPP) $(AFLAGS) -o $@ $< + %.o: %.S +@@ -229,12 +244,20 @@ + + else + ++$(obj)%_bootstrap.s: %_bootstrap.S ++ $(CPP) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -o $@ $< ++$(obj)%_bootstrap.o: %_bootstrap.S ++ $(CC) $(AFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $< ++$(obj)%_bootstrap.o: %_bootstrap.c ++ $(CC) $(CFLAGS) -DCFG_BOOTSTRAP_CODE -c -o $@ $< ++ + $(obj)%.s: %.S + $(CPP) $(AFLAGS) -o $@ $< + $(obj)%.o: %.S + $(CC) $(AFLAGS) -c -o $@ $< + $(obj)%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< ++ + endif + + ######################################################################### --- a/drivers/Makefile +++ b/drivers/Makefile -@@ -50,14 +50,14 @@ +@@ -50,7 +50,7 @@ videomodes.o w83c553f.o \ ks8695eth.o \ pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \ @@ -1121,14 +949,6 @@ SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) - - all: $(LIB) - --$(LIB): $(obj).depend $(OBJS) -+$(LIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - - ######################################################################### --- a/include/asm-mips/mipsregs.h +++ b/include/asm-mips/mipsregs.h @@ -48,6 +48,7 @@ @@ -1176,7 +996,7 @@ #define CAUSEF_BD (1 << 31) /* -+ * Bits in the coprocessor 0 EBase register ++ * Bits in the coprocessor 0 EBase register + */ +#define EBASEB_CPUNUM 0 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM) @@ -1223,10 +1043,12 @@ +#include <configs/danube.h> --- /dev/null +++ b/include/config.mk -@@ -0,0 +1,3 @@ +@@ -0,0 +1,5 @@ +ARCH = mips +CPU = mips +BOARD = danube ++VENDOR = ifx ++SOC = danube --- a/include/flash.h +++ b/include/flash.h @@ -79,7 +79,7 @@ @@ -1316,15 +1138,11 @@ + +#endif --- /dev/null -+++ b/include/version_autogenerated.h -@@ -0,0 +1 @@ -+#define U_BOOT_VERSION "U-Boot 1.1.5-IFX-LXDB-g71af1545" ---- /dev/null +++ b/ld_uboot.conf @@ -0,0 +1,8 @@ -+TAG_DWNLD() -+{ -+ 0xA0B00000 "u-boot.bin" /* Download u-boot image */ ++TAG_DWNLD() ++{ ++ 0xA0B00000 "u-boot.bin" /* Download u-boot image */ +}; +TAG_START() +{ @@ -1343,11 +1161,12 @@ OBJS := $(addprefix $(obj),$(COBJS)) --- a/lib_mips/board.c +++ b/lib_mips/board.c -@@ -29,6 +29,25 @@ +@@ -29,9 +29,30 @@ #include <net.h> #include <environment.h> -+#ifdef CFG_HEAD_CODE ++#ifdef CFG_BOOTSTRAP_CODE ++//#include <asm/danube.h> +#undef CONFIG_MICROBZIP2 + +#ifdef CONFIG_BZIP2 @@ -1361,32 +1180,78 @@ +#ifdef CONFIG_LZMA +#include <LzmaWrapper.h> +#endif -+ -+#include <image.h> -+#include "head.h" -+#endif //CFG_HEAD_CODE ++#endif //CFG_BOOTSTRAP_CODE + DECLARE_GLOBAL_DATA_PTR; - #if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \ -@@ -39,8 +58,6 @@ +-#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \ ++#if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < BOOTSTRAP_CFG_MONITOR_BASE) || \ ++ (CFG_ENV_ADDR >= (BOOTSTRAP_CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \ ++ defined(CFG_ENV_IS_IN_NVRAM) && defined(CFG_BOOTSTRAP_CODE) ++#define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE) ++#elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \ + (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) ) || \ + defined(CFG_ENV_IS_IN_NVRAM) + #define TOTAL_MALLOC_LEN (CFG_MALLOC_LEN + CFG_ENV_SIZE) +@@ -39,21 +60,24 @@ #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN #endif -#undef DEBUG - extern int timer_init(void); - +- extern int incaip_set_cpuclk(void); -@@ -79,6 +96,25 @@ + ++#ifdef CFG_BOOTSTRAP_CODE ++extern ulong uboot_end_data_bootstrap; ++extern ulong uboot_end_bootstrap; ++#else //CFG_BOOTSTRAP_CODE + extern ulong uboot_end_data; + extern ulong uboot_end; ++#endif //CFG_BOOTSTRAP_CODE + + ulong monitor_flash_len; + +-const char version_string[] = +- U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"; ++const char version_string[] = U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")"; + ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + static char *failed = "*** failed ***\n"; ++#endif + + /* + * Begin and End of memory area for malloc(), and current "brk" +@@ -62,14 +86,15 @@ + static ulong mem_malloc_end; + static ulong mem_malloc_brk; + +- + /* + * The Malloc area is immediately below the monitor copy in DRAM + */ +-static void mem_malloc_init (void) +-{ ++#ifdef CFG_BOOTSTRAP_CODE ++static void mem_malloc_init (ulong dest_addr) { ++#else //CFG_BOOTSTRAP_CODE ++static void mem_malloc_init (void) { + ulong dest_addr = CFG_MONITOR_BASE + gd->reloc_off; +- ++#endif //CFG_BOOTSTRAP_CODE + mem_malloc_end = dest_addr; + mem_malloc_start = dest_addr - TOTAL_MALLOC_LEN; + mem_malloc_brk = mem_malloc_start; +@@ -79,6 +104,25 @@ mem_malloc_end - mem_malloc_start); } -+#ifdef CFG_HEAD_CODE ++#ifdef CFG_BOOTSTRAP_CODE +void *malloc(unsigned int size) { + if(size < (mem_malloc_end - mem_malloc_start)) { + mem_malloc_start += size; -+ //printf("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size); ++ debug ("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size); + return (void *)(mem_malloc_start - size); + } + return NULL; @@ -1399,39 +1264,58 @@ +void free(void *src) { + return; +} -+#endif //CFG_HEAD_CODE ++#endif //CFG_BOOTSTRAP_CODE + void *sbrk (ptrdiff_t increment) { ulong old = mem_malloc_brk; -@@ -99,7 +135,11 @@ +@@ -99,42 +143,58 @@ #else int board_type = 0; /* use dummy arg */ #endif +- puts ("DRAM: "); + ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF +#ifdef CONFIG_USE_DDR_RAM + puts ("DDR-DRAM: "); +#else - puts ("DRAM: "); ++ puts ("DRAM: "); +#endif - ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF if ((gd->ram_size = initdram (board_type)) > 0) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF print_size (gd->ram_size, "\n"); -@@ -116,26 +156,29 @@ ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return (0); + } ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + puts (failed); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return (1); + } + ++#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) + static int display_banner(void) + { +- + printf ("\n\n%s\n\n", version_string); return (0); } ++#endif -+#ifndef CFG_HEAD_CODE ++#ifndef CFG_BOOTSTRAP_CODE static void display_flash_config(ulong size) { puts ("Flash: "); print_size (size, "\n"); } -- -+#endif ++#endif //CFG_BOOTSTRAP_CODE +- ++#if !defined(CFG_BOOTSTRAP_CODE) || defined(DEBUG_ENABLE_BOOTSTRAP_PRINTF) static int init_baudrate (void) { -+#ifndef CFG_HEAD_CODE ++#ifndef CFG_BOOTSTRAP_CODE char tmp[64]; /* long enough for environment variables */ int i = getenv_r ("baudrate", tmp, sizeof (tmp)); @@ -1439,58 +1323,134 @@ ? (int) simple_strtoul (tmp, NULL, 10) : CONFIG_BAUDRATE; - -+#else //CFG_HEAD_CODE -+ gd->baudrate = CONFIG_BAUDRATE; -+#endif //CFG_HEAD_CODE ++#else //CFG_BOOTSTRAP_CODE ++ gd->baudrate = CONFIG_BAUDRATE; ++#endif //CFG_BOOTSTRAP_CODE return (0); } - - ++#endif + /* * Breath some life into the board... - * -@@ -160,7 +203,9 @@ +@@ -159,27 +219,49 @@ + typedef int (init_fnc_t) (void); init_fnc_t *init_sequence[] = { ++#ifdef CFG_BOOTSTRAP_CODE ++ //fuse_prg, ++ //timer_init, ++ //env_init, /* initialize environment */ ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF ++ init_baudrate, /* initialze baudrate settings */ ++ serial_init, /* serial communications setup */ ++ console_init_f, ++ display_banner, /* say that we are here */ ++ checkboard, ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF ++ init_func_ram, ++ NULL, ++#else /********** CFG_BOOTSTRAP_CODE **********/ timer_init, -+#ifndef CFG_HEAD_CODE - env_init, /* initialize environment */ -+#endif //CFG_HEAD_CODE - #ifdef CONFIG_INCA_IP - incaip_set_cpuclk, /* set cpu clock according to environment variable */ - #endif -@@ -179,7 +224,11 @@ +- env_init, /* initialize environment */ +-#ifdef CONFIG_INCA_IP +- incaip_set_cpuclk, /* set cpu clock according to environment variable */ +-#endif + init_baudrate, /* initialze baudrate settings */ + serial_init, /* serial communications setup */ + console_init_f, + display_banner, /* say that we are here */ + checkboard, + init_func_ram, ++ env_init, /* initialize environment */ + NULL, ++#endif //CFG_BOOTSTRAP_CODE + }; + ++#ifdef CFG_BOOTSTRAP_CODE ++extern void bootstrap_relocate_code(ulong addr_sp, gd_t *id, ulong addr); + ++void bootstrap_board_init_f(ulong bootflag) ++#else + void board_init_f(ulong bootflag) ++#endif + { gd_t gd_data, *id; bd_t *bd; init_fnc_t **init_fnc_ptr; -+#ifdef CFG_HEAD_CODE -+ ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_HEAD_BASE; -+#else //CFG_HEAD_CODE - ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE; -+#endif //CFG_HEAD_CODE +- ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE; ++#ifdef CFG_BOOTSTRAP_CODE ++ ulong addr, addr_sp, len = (ulong)&uboot_end_bootstrap - BOOTSTRAP_CFG_MONITOR_BASE; ++ ulong lzmaImageaddr = 0; ++#else //CFG_BOOTSTRAP_CODE ++ ulong addr, addr_sp, len = CFG_MONITOR_LEN; ++#endif //CFG_BOOTSTRAP_CODE ulong *s; #ifdef CONFIG_PURPLE void copy_code (ulong); -@@ -278,7 +327,8 @@ - #ifdef CONFIG_PURPLE +@@ -219,13 +301,12 @@ + addr -= len; + addr &= ~(16 * 1024 - 1); + +- debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr); ++ debug ("Reserving %d Bytes for U-Boot at: %08lx\n", len, addr); + + /* Reserve memory for malloc() arena. + */ + addr_sp = addr - TOTAL_MALLOC_LEN; +- debug ("Reserving %dk for malloc() at: %08lx\n", +- TOTAL_MALLOC_LEN >> 10, addr_sp); ++ debug ("Reserving %d Bytes for malloc() at: %08lx\n", TOTAL_MALLOC_LEN, addr_sp); + + /* + * (permanently) allocate a Board Info struct +@@ -234,20 +315,17 @@ + addr_sp -= sizeof(bd_t); + bd = (bd_t *)addr_sp; + gd->bd = bd; +- debug ("Reserving %d Bytes for Board Info at: %08lx\n", +- sizeof(bd_t), addr_sp); ++ debug ("Reserving %d Bytes for Board Info at: %08lx\n", sizeof(bd_t), addr_sp); + + addr_sp -= sizeof(gd_t); + id = (gd_t *)addr_sp; +- debug ("Reserving %d Bytes for Global Data at: %08lx\n", +- sizeof (gd_t), addr_sp); ++ debug ("Reserving %d Bytes for Global Data at: %08lx\n", sizeof (gd_t), addr_sp); + + /* Reserve memory for boot params. + */ + addr_sp -= CFG_BOOTPARAMS_LEN; + bd->bi_boot_params = addr_sp; +- debug ("Reserving %dk for boot params() at: %08lx\n", +- CFG_BOOTPARAMS_LEN >> 10, addr_sp); ++ debug ("Reserving %dk for boot params() at: %08lx\n", CFG_BOOTPARAMS_LEN >> 10, addr_sp); + + /* + * Finally, we set up a new (bigger) stack. +@@ -279,7 +357,16 @@ copy_code(addr); #endif -- -+ + ++#ifdef CFG_BOOTSTRAP_CODE ++ lzmaImageaddr = (ulong)&uboot_end_data_bootstrap; ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF ++ puts("\n BOOTSTRAP: relocate_code start"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF ++ bootstrap_relocate_code (addr_sp, id, addr); ++#else //CFG_BOOTSTRAP_CODE + puts("\n relocate_code start"); relocate_code (addr_sp, id, addr); ++#endif //CFG_BOOTSTRAP_CODE /* NOTREACHED - relocate_code() does not return */ -@@ -292,7 +342,93 @@ + } +@@ -292,7 +379,110 @@ * ************************************************************************ */ -+#ifdef CFG_HEAD_CODE -+ -+extern void print_image_hdr (image_header_t *hdr); -+extern void jump_unconditional (ulong addr); -+ -+void board_init_r (gd_t *id, ulong dest_addr) { ++#ifdef CFG_BOOTSTRAP_CODE ++void bootstrap_board_init_r (gd_t *id, ulong dest_addr) { + int i; + ulong addr; + ulong data, len, checksum; @@ -1498,40 +1458,49 @@ + image_header_t header; + image_header_t *hdr = &header; + unsigned int destLen; - -+ puts("\n relocate code finish.\n"); ++ int (*fn)(void); ++ ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF ++ puts("\n BOOTSTRAP: relocate_code finish.\n"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + + /* initialize malloc() area */ -+ mem_malloc_init(); ++ mem_malloc_init(dest_addr); + -+ addr = CFG_HEAD_BASE + CFG_UBOOT_OFFSET; ++ addr = (char *)(BOOTSTRAP_CFG_MONITOR_BASE + ((ulong)&uboot_end_data_bootstrap - dest_addr)); + memmove (&header, (char *)addr, sizeof(image_header_t)); + + if (ntohl(hdr->ih_magic) != IH_MAGIC) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("Bad Magic Number at address 0x%08lx\n",addr); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return; + } -+ + + data = (ulong)&header; + len = sizeof(image_header_t); + + checksum = ntohl(hdr->ih_hcrc); + hdr->ih_hcrc = 0; -+ if (crc32 (0, (char *)data, len) != checksum) { ++ if (crc32 (0, (unsigned char *)data, len) != checksum) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("Bad Header Checksum\n"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return; + } + -+ print_image_hdr (hdr); -+ + data = addr + sizeof(image_header_t); + len = ntohl(hdr->ih_size); + len_ptr = (ulong *)data; + ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + debug ("Disabling all the interrupts\n"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + disable_interrupts(); + ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + debug (" Uncompressing UBoot Image ... \n" ); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + /* + * If we've got less than 4 MB of malloc() space, + * use slower decompression algorithm which requires @@ -1544,7 +1513,9 @@ + 0x400000, (char *)data, len, + CFG_MALLOC_LEN < (4096 * 1024), 0); + if (i != BZ_OK) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return; + } +#elif CONFIG_MICROBZIP2 @@ -1552,72 +1523,99 @@ + &destLen, (char *)data, len, + CFG_MALLOC_LEN < (4096 * 1024), 0); + if (i != RETVAL_OK) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return; + } +#elif CONFIG_LZMA -+ i = lzma_inflate ((char *)data, len, (char*)ntohl(hdr->ih_load), &destLen); ++ i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &destLen); + if (i != LZMA_RESULT_OK) { ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("LZMA ERROR %d - must RESET board to recover\n", i); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + return; + } +#else ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + printf ("NONE Compressing u-boot body!!\n"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len); + destLen = len; +#endif ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + debug (" Uncompression completed successfully with destLen %d.\n ",destLen ); + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + -+ jump_unconditional(CFG_MONITOR_BASE); ++ fn = ntohl(hdr->ih_load); ++ (*fn)(); ++ hang (); +} -+#else //CFG_HEAD_CODE ++#else //CFG_BOOTSTRAP_CODE void board_init_r (gd_t *id, ulong dest_addr) { cmd_tbl_t *cmdtp; -@@ -305,6 +441,8 @@ +@@ -305,6 +495,8 @@ bd_t *bd; int i; -+ puts("\n relocate code finish.\n"); ++ puts("\n relocate_code finish.\n"); + gd = id; gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */ -@@ -321,10 +459,10 @@ +@@ -321,12 +513,10 @@ ulong addr; addr = (ulong) (cmdtp->cmd) + gd->reloc_off; -#if 0 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n", -+ -+ debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", - cmdtp->name, (ulong) (cmdtp->cmd), addr); +- cmdtp->name, (ulong) (cmdtp->cmd), addr); -#endif +- cmdtp->cmd = +- (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; ++ ++ debug ("Command \"%s\": 0x%08lx => 0x%08lx\n", cmdtp->name, (ulong) (cmdtp->cmd), addr); + - cmdtp->cmd = - (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; ++ cmdtp->cmd = (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr; -@@ -424,6 +562,7 @@ + addr = (ulong)(cmdtp->name) + gd->reloc_off; + cmdtp->name = (char *)addr; +@@ -363,7 +553,13 @@ + /* initialize malloc() area */ + mem_malloc_init(); + malloc_bin_reloc(); ++#if (CONFIG_COMMANDS & CFG_CMD_NAND) ++ nand_init(); /* go init the NAND */ ++#endif + ++#ifdef CONFIG_SPI ++ spi_init_f(); /* go init the SPI flash */ ++#endif + /* relocate environment function pointers etc. */ + env_relocate(); + +@@ -424,9 +620,12 @@ /* NOTREACHED - no way out of command loop except booting */ } -+#endif //CFG_HEAD_CODE ++#endif //CFG_BOOTSTRAP_CODE void hang (void) { ---- /dev/null -+++ b/lib_mips/head.h -@@ -0,0 +1,3 @@ -+ -+//#define CFG_HEAD_LEN 0x00006000 -+#define CFG_UBOOT_OFFSET CFG_HEAD_LEN ++#ifdef DEBUG_ENABLE_BOOTSTRAP_PRINTF + puts ("### ERROR ### Please RESET the board ###\n"); ++#endif //DEBUG_ENABLE_BOOTSTRAP_PRINTF + for (;;); + } --- a/lib_mips/time.c +++ b/lib_mips/time.c -@@ -80,6 +80,17 @@ +@@ -80,6 +80,19 @@ /*NOP*/; } ++#ifndef CFG_BOOTSTRAP_CODE +void mdelay (unsigned long msec) +{ + int i,j; @@ -1628,6 +1626,7 @@ + } + +} ++#endif + /* * This function is derived from PowerPC code (read timebase as long long). @@ -1665,76 +1664,6 @@ if (!eth_devices) { puts ("No ethernet found.\n"); } else { ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -23,7 +23,7 @@ - - BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) - --OBJ_LINKS = environment.o crc32.o -+OBJ_LINKS = environment_$(BOARDDIR).o crc32_$(BOARDDIR).o - OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o - - ifeq ($(ARCH),mips) -@@ -117,7 +117,7 @@ - CPPFLAGS = -idirafter $(SRCTREE)/include \ - -idirafter $(OBJTREE)/include2 \ - -idirafter $(OBJTREE)/include \ -- -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC -+ -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC $(IFX_CFLAGS) - CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O - AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS) - CC = $(HOSTCC) -@@ -126,14 +126,14 @@ - - all: $(obj).depend $(BINS) $(LOGO_H) subdirs - --$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o -+$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32_$(BOARDDIR).o $(obj)environment_$(BOARDDIR).o - $(CC) $(CFLAGS) -o $@ $^ - - $(obj)img2srec$(SFX): $(obj)img2srec.o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - --$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o -+$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32_$(BOARDDIR).o - $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ - $(STRIP) $@ - -@@ -160,7 +160,7 @@ - $(obj)envcrc.o: $(src)envcrc.c - $(CC) -g $(CFLAGS) -c -o $@ $< - --$(obj)crc32.o: $(obj)crc32.c -+$(obj)crc32_$(BOARDDIR).o: $(obj)crc32_$(BOARDDIR).c - $(CC) -g $(CFLAGS) -c -o $@ $< - - $(obj)mkimage.o: $(src)mkimage.c -@@ -192,16 +192,16 @@ - done - endif - --$(obj)environment.c: -- @rm -f $(obj)environment.c -- ln -s $(src)../common/environment.c $(obj)environment.c -+$(obj)environment_$(BOARDDIR).c: -+ @rm -f $(obj)environment_$(BOARDDIR).c -+ ln -s $(src)../common/environment_$(BOARDDIR).c $(obj)environment_$(BOARDDIR).c - --$(obj)environment.o: $(obj)environment.c -+$(obj)environment_$(BOARDDIR).o: $(obj)environment_$(BOARDDIR).c - $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $< - --$(obj)crc32.c: -- @rm -f $(obj)crc32.c -- ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c -+$(obj)crc32_$(BOARDDIR).c: -+ @rm -f $(obj)crc32_$(BOARDDIR).c -+ ln -s $(src)../lib_generic/crc32_$(BOARDDIR).c $(obj)crc32_$(BOARDDIR).c - - $(LOGO_H): $(obj)bmp_logo $(LOGO_BMP) - $(obj)./bmp_logo $(LOGO_BMP) >$@ --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -28,6 +28,7 @@ @@ -1771,3 +1700,376 @@ (void) fdatasync (ifd); #else (void) fsync (ifd); +--- a/cpu/mips/cache.S ++++ b/cpu/mips/cache.S +@@ -29,7 +29,9 @@ + #include <asm/mipsregs.h> + #include <asm/addrspace.h> + #include <asm/cacheops.h> +- ++#if defined(CONFIG_IFX_MIPS) ++# include "danube/ifx_cache.S" ++#endif + + /* 16KB is the maximum size of instruction and data caches on + * MIPS 4K. +@@ -155,6 +157,9 @@ + */ + + mtc0 zero, CP0_TAGLO ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_INVALID_TAG) ++ IFX_CACHE_EXTRA_INVALID_TAG ++#endif + + /* + * The caches are probably in an indeterminate state, +@@ -171,6 +176,9 @@ + move a1, a2 + icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill)) + ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_EXTRA_OPERATION) ++ IFX_CACHE_EXTRA_OPERATION ++#else + /* To support Orion/R4600, we initialise the data cache in 3 passes. + */ + +@@ -200,6 +208,7 @@ + move a3, t5 # dcacheLineSize + move a1, a2 + icacheop(a0,a1,a2,a3,Index_Store_Tag_D) ++#endif + + j ra + .end mips_cache_reset +--- a/cpu/mips/config.mk ++++ b/cpu/mips/config.mk +@@ -20,20 +20,26 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, + # MA 02111-1307 USA + # +-v=$(shell \ +-$(CROSS_COMPILE)as --version|grep "GNU assembler"|awk '{print $$3}'|awk -F . '{print $$2}') +-MIPSFLAGS=$(shell \ +-if [ "$v" -lt "14" ]; then \ +- echo "-mcpu=4kc"; \ +-else \ +- echo "-march=4kc -mtune=4kc"; \ +-fi) + ++ifndef PLATFORM_CPU ++PLATFORM_CPU = mips32 ++endif ++ ++MIPSFLAGS +=$(call cc-option,-march=$(PLATFORM_CPU) -mtune=$(PLATFORM_CPU),-mcpu=$(PLATFORM_CPU)) ++ ++ifeq ($(CROSS_COMPILE_UCLIBC),1) ++ifneq (,$(findstring mipsel,$(CROSS_COMIPLE))) ++ENDIANNESS = -el ++else ++ENDIANNESS = -eb ++endif ++else + ifneq (,$(findstring 4KCle,$(CROSS_COMPILE))) + ENDIANNESS = -EL + else + ENDIANNESS = -EB + endif ++endif + + MIPSFLAGS += $(ENDIANNESS) -mabicalls + +--- a/cpu/mips/cpu.c ++++ b/cpu/mips/cpu.c +@@ -23,7 +23,12 @@ + + #include <common.h> + #include <command.h> +-#include <asm/inca-ip.h> ++#if defined(CONFIG_INCA_IP) ++# include <asm/inca-ip.h> ++#elif defined(CONFIG_IFX_MIPS) ++# include <asm/danube.h> ++# include "danube/ifx_cpu.c" ++#endif + #include <asm/mipsregs.h> + + int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) +@@ -34,6 +39,8 @@ + void (*f)(void) = (void *) 0xbfc00000; + + f(); ++#elif defined(CONFIG_IFX_MIPS) ++ IFX_CPU_RESET; + #endif + fprintf(stderr, "*** reset failed ***\n"); + return 0; +--- a/cpu/mips/incaip_clock.c ++++ b/cpu/mips/incaip_clock.c +@@ -22,8 +22,9 @@ + */ + + #include <common.h> +-#include <asm/inca-ip.h> + ++#ifdef CONFIG_INCA_IP ++#include <asm/inca-ip.h> + + /******************************************************************************* + * +@@ -114,3 +115,5 @@ + + return 0; + } ++ ++#endif /* CONFIG_INCA_IP */ +--- a/cpu/mips/start.S ++++ b/cpu/mips/start.S +@@ -27,7 +27,9 @@ + #include <version.h> + #include <asm/regdef.h> + #include <asm/mipsregs.h> +- ++#if defined(CONFIG_IFX_MIPS) ++# include "danube/ifx_start.S" ++#endif + + #define RVECENT(f,n) \ + b f; nop +@@ -36,15 +38,24 @@ + li k0,bev + + .set noreorder +- ++#ifdef CFG_BOOTSTRAP_CODE ++ .globl _start_bootstrap ++#else + .globl _start ++#endif + .text ++#ifdef CFG_BOOTSTRAP_CODE ++_start_bootstrap: ++#else + _start: ++#endif + RVECENT(reset,0) /* U-boot entry point */ + RVECENT(reset,1) /* software reboot */ +-#if defined(CONFIG_INCA_IP) ++#if defined(CONFIG_INCA_IP) || defined(CONFIG_INCA_IP2) + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */ + .word 0x00000000 /* phase of the flash */ ++#elif defined(CONFIG_IFX_MIPS) && defined(IFX_EBU_BOOTCFG_DWORD) ++ IFX_EBU_BOOTCFG_DWORD + #elif defined(CONFIG_PURPLE) + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */ + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */ +@@ -181,6 +192,9 @@ + * 128 * 8 == 1024 == 0x400 + * so this is address R_VEC+0x400 == 0xbfc00400 + */ ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_MORE_RESERVED_VECTORS) ++ IFX_MORE_RESERVED_VECTORS ++#else + #ifdef CONFIG_PURPLE + /* 0xbfc00400 */ + .word 0xdc870000 +@@ -205,8 +219,12 @@ + .word 0x00000000 + .word 0x00000000 + #endif /* CONFIG_PURPLE */ ++#endif /* CONFIG_IFX_MIPS */ + .align 4 + reset: ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_RESET_PRECHECK) ++ IFX_RESET_PRECHECK ++#endif + + /* Clear watch registers. + */ +@@ -226,6 +244,10 @@ + /* CAUSE register */ + mtc0 zero, CP0_CAUSE + ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU_EXTRA_INIT) ++ IFX_CPU_EXTRA_INIT ++#endif ++ + /* Init Timer */ + mtc0 zero, CP0_COUNT + mtc0 zero, CP0_COMPARE +@@ -252,12 +274,26 @@ + nop + #endif + ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_SKIP_LOWLEVEL_INIT) ++ IFX_SKIP_LOWLEVEL_INIT ++#endif ++#ifdef CFG_BOOTSTRAP_CODE + /* Initialize any external memory. + */ + la t9, lowlevel_init + jalr t9 + nop ++#endif ++lowlevel_init_done: ++ ++ beq s0, zero, init_cache_0 ++ nop ++ ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_CPU1_INIT) ++ IFX_CPU1_INIT ++#endif + ++init_cache_0: + /* Initialize caches... + */ + la t9, mips_cache_reset +@@ -266,7 +302,11 @@ + + /* ... and enable them. + */ ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CACHE_OPER_MODE) ++ IFX_CACHE_OPER_MODE ++#else + li t0, CONF_CM_CACHABLE_NONCOHERENT ++#endif + mtc0 t0, CP0_CONFIG + + +@@ -280,13 +320,38 @@ + li t0, CFG_SDRAM_BASE + CFG_INIT_SP_OFFSET + la sp, 0(t0) + ++#if defined(CONFIG_IFX_MIPS) && defined(IFX_CPU1_SUPPORT) && defined(IFX_BOOT_CLEAR) ++ IFX_BOOT_CLEAR ++#endif ++ ++#ifdef CFG_BOOTSTRAP_CODE ++ la t9, bootstrap_board_init_f ++#else + la t9, board_init_f ++#endif + j t9 + nop + ++#ifdef CFG_BOOTSTRAP_CODE ++/* ++ * void jump_unconditional (addr) ++ * This function simply jumps to the location pointed by a0. ++ * a0 = target_location ++ * ++ */ ++ .globl jump_unconditional ++ .ent jump_unconditional ++jump_unconditional: ++ move t9, a0 ++ j t9 ++ nop ++ .end jump_unconditional ++ ++#endif + + /* + * void relocate_code (addr_sp, gd, addr_moni) ++ * void bootstrap_relocate_code (addr_sp, gd, addr_moni) + * + * This "function" does not return, instead it continues in RAM + * after relocating the monitor code. +@@ -295,12 +360,22 @@ + * a1 = gd + * a2 = destination address + */ ++#ifdef CFG_BOOTSTRAP_CODE ++ .globl bootstrap_relocate_code ++ .ent bootstrap_relocate_code ++bootstrap_relocate_code: ++#else + .globl relocate_code + .ent relocate_code + relocate_code: ++#endif + move sp, a0 /* Set new stack pointer */ + ++#ifdef CFG_BOOTSTRAP_CODE ++ li t0, BOOTSTRAP_CFG_MONITOR_BASE ++#else + li t0, CFG_MONITOR_BASE ++#endif + la t3, in_ram + lw t2, -12(t3) /* t2 <-- uboot_end_data */ + move t1, a2 +@@ -311,7 +386,11 @@ + * New GOT-PTR = (old GOT-PTR - CFG_MONITOR_BASE) + Destination Address + */ + move t6, gp ++#ifdef CFG_BOOTSTRAP_CODE ++ sub gp, BOOTSTRAP_CFG_MONITOR_BASE ++#else + sub gp, CFG_MONITOR_BASE ++#endif + add gp, a2 /* gp now adjusted */ + sub t6, gp, t6 /* t6 <-- relocation offset */ + +@@ -337,12 +416,21 @@ + + /* Jump to where we've relocated ourselves. + */ ++#ifdef CFG_BOOTSTRAP_CODE ++ addi t0, a2, in_ram - _start_bootstrap ++#else + addi t0, a2, in_ram - _start ++#endif + j t0 + nop + ++#ifdef CFG_BOOTSTRAP_CODE ++ .word uboot_end_data_bootstrap ++ .word uboot_end_bootstrap ++#else + .word uboot_end_data + .word uboot_end ++#endif + .word num_got_entries + + in_ram: +@@ -374,12 +462,19 @@ + sw zero, 0(t1) /* delay slot */ + + move a0, a1 ++#ifdef CFG_BOOTSTRAP_CODE ++ la t9, bootstrap_board_init_r ++#else + la t9, board_init_r ++#endif + j t9 + move a1, a2 /* delay slot */ + ++#ifdef CFG_BOOTSTRAP_CODE ++ .end bootstrap_relocate_code ++#else + .end relocate_code +- ++#endif + + /* Exception handlers. + */ +@@ -388,3 +483,20 @@ + + romExcHandle: + b romExcHandle ++ ++romEjtagHandle: ++#ifdef CFG_BOOTSTRAP_CODE ++ deret ++ nop ++#endif /* CFG_BOOTSTRAP_CODE */ ++1: ++ b 1b ++ ++ /* Additional handlers. ++ */ ++#if defined(CONFIG_IFX_MIPS) ++#if defined(IFX_MIPS_HANDLER_1) ++ifx_mips_handler_1: ++ IFX_MIPS_HANDLER_1 ++#endif ++#endif |