add u-boot sources for danube
[openwrt.git] / target / linux / ifxmips / image / u-boot / patches / 100-ifx.patch
1 diff -urN u-boot-1.1.5.a/Makefile u-boot/Makefile
2 --- u-boot-1.1.5.a/Makefile 2006-10-20 16:54:33.000000000 +0100
3 +++ u-boot/Makefile 2008-05-11 14:14:55.000000000 +0100
4 @@ -24,7 +24,7 @@
5 VERSION = 1
6 PATCHLEVEL = 1
7 SUBLEVEL = 5
8 -EXTRAVERSION =
9 +EXTRAVERSION = -IFX-LXDB
10 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
11 VERSION_FILE = $(obj)include/version_autogenerated.h
12
13 @@ -44,6 +44,25 @@
14 # Deal with colliding definitions from tcsh etc.
15 VENDOR=
16
17 +# Default algorithm form compressing u-boot.bin
18 +ifndef COMPRESS
19 +COMPRESS=none
20 +COMPRESS_FILE=$(obj)u-boot.img
21 +else
22 +ifeq ($(COMPRESS),lzma)
23 +COMPRESS_FILE=$(obj)u-boot.limg
24 +endif
25 +ifeq ($(COMPRESS),bz2)
26 +COMPRESS_FILE=$(obj)u-boot.bzimg
27 +endif
28 +ifeq ($(COMPRESS),gzip)
29 +COMPRESS_FILE=$(obj)u-boot.zimg
30 +endif
31 +ifeq ($(COMPRESS),none)
32 +COMPRESS_FILE=$(obj)u-boot.img
33 +endif
34 +endif
35 +
36 #########################################################################
37 #
38 # U-boot build supports producing a object files to the separate external
39 @@ -155,6 +174,11 @@
40 endif
41 endif
42
43 +
44 +
45 +
46 +
47 +
48 export CROSS_COMPILE
49
50 # load other configuration
51 @@ -163,7 +187,9 @@
52 #########################################################################
53 # U-Boot objects....order is important (i.e. start must be first)
54
55 -OBJS = cpu/$(CPU)/start.o
56 +OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o
57 +OBJS_BOOTSTRAP = cpu/$(CPU)/$(BOARDDIR)/start_bootstrap.o
58 +
59 ifeq ($(CPU),i386)
60 OBJS += cpu/$(CPU)/start16.o
61 OBJS += cpu/$(CPU)/reset.o
62 @@ -186,11 +212,11 @@
63
64 LIBS = lib_generic/libgeneric.a
65 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
66 -LIBS += cpu/$(CPU)/lib$(CPU).a
67 +LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
68 ifdef SOC
69 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
70 endif
71 -LIBS += lib_$(ARCH)/lib$(ARCH).a
72 +LIBS += lib_$(ARCH)/$(BOARDIR)/lib$(ARCH).a
73 LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
74 fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
75 LIBS += net/libnet.a
76 @@ -198,27 +224,54 @@
77 LIBS += rtc/librtc.a
78 LIBS += dtt/libdtt.a
79 LIBS += drivers/libdrivers.a
80 -LIBS += drivers/nand/libnand.a
81 -LIBS += drivers/nand_legacy/libnand_legacy.a
82 +#LIBS += drivers/nand_$(BOARDDIR)/libnand.a
83 +#LIBS += drivers/nand_legacy/libnand_legacy.a
84 LIBS += drivers/sk98lin/libsk98lin.a
85 LIBS += post/libpost.a post/cpu/libcpu.a
86 LIBS += common/libcommon.a
87 LIBS += $(BOARDLIBS)
88
89 LIBS := $(addprefix $(obj),$(LIBS))
90 +
91 +
92 +LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
93 +LIBS_BOOTSTRAP+= board/$(BOARDDIR)/lib$(BOARD).a
94 +#LIBS_BOOTSTRAP+= board/ifx/libifx.a
95 +LIBS_BOOTSTRAP+= cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
96 +
97 +#HEAD_OBJS = cpu/$(CPU)/$(BOARDDIR)/start.o lib_$(ARCH)/board.o
98 +
99 +#HEAD_LIBS = board/$(BOARDDIR)/lib$(BOARD).a
100 +#HEAD_LIBS += cpu/$(CPU)/$(BOARDDIR)/lib$(CPU).a
101 +#HEAD_LIBS += lib_$(ARCH)/lib$(ARCH).a
102 +#HEAD_LIBS += lib_generic/libgeneric.a
103 +#HEAD_LIBS += common/console.o
104 +#HEAD_LIBS += common/devices.o
105 +#HEAD_LIBS += common/cmd_bootm.o
106 +
107 +#.PHONY : $(LIBS) $(HEAD_LIBS)
108 .PHONY : $(LIBS)
109 +.PHONY : $(LIBS_BOOTSTRAP)
110
111 # Add GCC lib
112 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
113
114 # The "tools" are needed early, so put this first
115 # Don't include stuff already done in $(LIBS)
116 + #examples
117 SUBDIRS = tools \
118 - examples \
119 post \
120 post/cpu
121 .PHONY : $(SUBDIRS)
122
123 +# HEAD_SUBDIRS = tools
124 +#HEAD_SUBDIRS = lib_generic \
125 +# cpu/$(CPU) \
126 +# board/$(BOARDDIR) \
127 +# common \
128 +# lib_$(ARCH)
129 +#.PHONY : $(HEAD_SUBDIRS)
130 +
131 ifeq ($(CONFIG_NAND_U_BOOT),y)
132 NAND_SPL = nand_spl
133 U_BOOT_NAND = $(obj)u-boot-nand.bin
134 @@ -227,13 +280,76 @@
135 __OBJS := $(subst $(obj),,$(OBJS))
136 __LIBS := $(subst $(obj),,$(LIBS))
137
138 +#__HEAD_OBJS := $(subst $(obj),,$(HEAD_OBJS))
139 +#__HEAD_LIBS := $(subst $(obj),,$(HEAD_LIBS))
140 +
141 #########################################################################
142 #########################################################################
143
144 ALL = $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND)
145 +#IFX_ALL = $(obj)u-boot.ifx $(obj)head.srec $(obj)head.bin $(obj)head $(obj)head.map $(COMPRESS_FILE) $(obj)u-boot.srec
146 +IFX_ALL = $(obj)u-boot.srec $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin
147
148 all: $(ALL)
149
150 +ifx_all: $(IFX_ALL)
151 +
152 +
153 +$(obj)u-boot.ifx: $(obj)System.map $(obj)bootstrap.bin $(obj)u-boot.lzimg
154 + @cat $(obj)bootstrap.bin > $(obj)u-boot.ifx
155 + @cat $(obj)u-boot.lzimg >> $(obj)u-boot.ifx
156 +
157 +$(obj)u-boot.lzimg: $(obj)u-boot.bin System.map
158 +# @lzma -f -z --best -v $(obj)u-boot.bin
159 + @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma
160 + @./tools/mkimage -A mips -T firmware -C lzma \
161 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
162 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
163 + -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@
164 +
165 +$(obj)ld_uboot.img: $(obj)u-boot.ifx $(obj)u-boot.lzimg $(obj)System.map $(obj)bootstrap.bin
166 + @ cp -f $(obj)u-boot.ifx $(obj)u-boot.bin
167 + @ ./mkbootimg.incaip2 $(obj)ld_uboot.img < ld_uboot.conf
168 +
169 +
170 +
171 +
172 +$(obj)u-boot.zimg: $(obj)u-boot.bin $(obj)System.map
173 + gzip $(obj)u-boot.bin
174 + ./tools/mkimage -A $(ARCH) -T firmware -C gzip \
175 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
176 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
177 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
178 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
179 + -d u-boot.gz $@
180 +
181 +$(obj)u-boot.bzimg: $(obj)u-boot.bin $(obj)System.map
182 + bzip $(obj)u-boot.bin
183 + ./tools/mkimage -A $(ARCH) -T firmware -C bzip2 \
184 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
185 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
186 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
187 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
188 + -d u-boot.bz2 $@
189 +
190 +$(obj)u-boot.limg: $(obj)u-boot.bin $(obj)System.map
191 +# @lzma -f -z --best -v $(obj)u-boot.bin
192 + @lzma e $(obj)u-boot.bin $(obj)u-boot.bin.lzma
193 + ./tools/mkimage -A $(ARCH) -T firmware -C lzma \
194 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
195 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
196 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
197 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
198 + -d u-boot.bin.lzma $@
199 +
200 +$(obj)u-boot.img: $(obj)u-boot.bin $(obj)System.map
201 + ./tools/mkimage -A $(ARCH) -T firmware -C none \
202 + -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
203 + -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
204 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
205 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
206 + -d u-boot.bin $@
207 +
208 $(obj)u-boot.hex: $(obj)u-boot
209 $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
210
211 @@ -243,28 +359,36 @@
212 $(obj)u-boot.bin: $(obj)u-boot
213 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
214
215 -$(obj)u-boot.img: $(obj)u-boot.bin
216 - ./tools/mkimage -A $(ARCH) -T firmware -C none \
217 - -a $(TEXT_BASE) -e 0 \
218 - -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
219 - sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
220 - -d $< $@
221 -
222 $(obj)u-boot.dis: $(obj)u-boot
223 $(OBJDUMP) -d $< > $@
224
225 -$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
226 +$(obj)u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
227 UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
228 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
229 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
230 -Map u-boot.map -o u-boot
231
232 +
233 +
234 +$(obj)bootstrap.bin: $(obj)bootstrap
235 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
236 +
237 +$(obj)bootstrap : depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
238 + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
239 + $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
240 + --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
241 + -Map bootstrap.map -o bootstrap
242 +
243 $(OBJS):
244 - $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
245 + $(MAKE) -C cpu/$(CPU)/$(BOARDDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@))
246
247 $(LIBS):
248 $(MAKE) -C $(dir $(subst $(obj),,$@))
249
250 +
251 +$(LIBS_BOOTSTRAP):
252 + $(MAKE) -C `dirname $@`
253 +
254 $(SUBDIRS):
255 $(MAKE) -C $@ all
256
257 @@ -295,14 +419,14 @@
258
259 tags ctags:
260 ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \
261 - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
262 + lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \
263 fs/cramfs fs/fat fs/fdos fs/jffs2 \
264 net disk rtc dtt drivers drivers/sk98lin common \
265 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
266
267 etags:
268 etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \
269 - lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
270 + lib_generic board/$(BOARDDIR) cpu/$(CPU)/$(BOARDDIR) lib_$(ARCH) \
271 fs/cramfs fs/fat fs/fdos fs/jffs2 \
272 net disk rtc dtt drivers drivers/sk98lin common \
273 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
274 @@ -2032,7 +2156,20 @@
275 # MIPS
276 #========================================================================
277 #########################################################################
278 -## MIPS32 4Kc
279 +## Infineon MIPS generic u-boot config
280 +#########################################################################
281 +danube_config: unconfig
282 + @$(MKCONFIG) $(@:_config=) mips mips danube
283 +
284 +amazon_config: unconfig
285 + @$(MKCONFIG) $(@:_config=) mips mips amazon
286 +
287 +
288 +incaip2_config: unconfig
289 + @$(MKCONFIG) $(@:_config=) mips mips incaip2
290 +
291 +#########################################################################
292 +## MIPS32 4kc
293 #########################################################################
294
295 xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
296 @@ -2246,6 +2383,8 @@
297 rm -f $(obj)include/bmp_logo.h
298 find nand_spl -lname "*" -print | xargs rm -f
299 rm -f nand_spl/u-boot-spl nand_spl/u-boot-spl.map
300 + rm -f lib_bootstrap/*.o
301 + rm -f lib_bootstrap/*.a
302
303 clobber: clean
304 find $(OBJTREE) -type f \( -name .depend \
305 @@ -2254,7 +2393,7 @@
306 | xargs -0 rm -f
307 rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS $(obj)include/version_autogenerated.h
308 rm -fr $(obj)*.*~
309 - rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
310 + rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) $(IFX_ALL)
311 rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
312 rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
313 rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
314 Binary files u-boot-1.1.5.a/bootstrap and u-boot/bootstrap differ
315 diff -urN u-boot-1.1.5.a/build_danube.sh u-boot/build_danube.sh
316 --- u-boot-1.1.5.a/build_danube.sh 1970-01-01 01:00:00.000000000 +0100
317 +++ u-boot/build_danube.sh 2008-05-11 14:02:24.000000000 +0100
318 @@ -0,0 +1,28 @@
319 +#!/bin/sh
320 +IFX_CONFIG_FLASH_SIZE=8
321 +IFX_CONFIG_MEMORY_SIZE=30
322 +CONFIG_RAM_TEXT_BASE=0xA0400000
323 +
324 +#prepare_headers()
325 +#{
326 +# cp -f include/flash_$1.h \
327 +# include/flash.h
328 +# cp -f include/net_$1.h \
329 +# include/net.h
330 +# cp -f include/asm-mips/cacheops_$1.h \
331 +# include/asm-mips/cacheops.h
332 +# cp -f include/asm-mips/mipsregs_$1.h \
333 +# include/asm-mips/mipsregs.h
334 +#}
335 +#prepare_headers "danube"
336 +UBOOT_COMPRESS=lzma
337 +UBOOT_CFLAGS="-DCONFIG_IFX_MIPS -DCONFIG_LZMA -DIFX_CONFIG_MEMORY_SIZE=${IFX_CONFIG_MEMORY_SIZE} -DIFX_CONFIG_FLASH_SIZE=${IFX_CONFIG_FLASH_SIZE}"
338 +
339 +rm -f .config_ok
340 +
341 +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
342 +
343 +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
344 + echo -n > .config_ok
345 +
346 +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
347 diff -urN u-boot-1.1.5.a/common/Makefile u-boot/common/Makefile
348 --- u-boot-1.1.5.a/common/Makefile 2006-10-20 16:54:33.000000000 +0100
349 +++ u-boot/common/Makefile 2008-05-11 14:53:59.000000000 +0100
350 @@ -46,7 +46,7 @@
351 env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
352 env_nvram.o env_nowhere.o \
353 exports.o \
354 - flash.o fpga.o ft_build.o \
355 + flash_$(BOARD).o fpga.o ft_build.o \
356 hush.o kgdb.o lcd.o lists.o lynxkdi.o \
357 memsize.o miiphybb.o miiphyutil.o \
358 s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
359 @@ -60,7 +60,7 @@
360
361 all: $(LIB) $(AOBJS)
362
363 -$(LIB): $(obj).depend $(OBJS)
364 +$(LIB): $(OBJS)
365 $(AR) $(ARFLAGS) $@ $(OBJS)
366
367 $(obj)environment.o: $(src)environment.c $(obj)../tools/envcrc
368 diff -urN u-boot-1.1.5.a/common/cmd_bootm.c u-boot/common/cmd_bootm.c
369 --- u-boot-1.1.5.a/common/cmd_bootm.c 2006-10-20 16:54:33.000000000 +0100
370 +++ u-boot/common/cmd_bootm.c 2007-03-09 09:47:46.000000000 +0000
371 @@ -31,6 +31,7 @@
372 #include <malloc.h>
373 #include <zlib.h>
374 #include <bzlib.h>
375 +#include <LzmaWrapper.h>
376 #include <environment.h>
377 #include <asm/byteorder.h>
378
379 @@ -79,6 +80,8 @@
380 # define CHUNKSZ (64 * 1024)
381 #endif
382
383 +#ifndef CFG_HEAD_CODE
384 +
385 int gunzip (void *, int, unsigned char *, unsigned long *);
386
387 static void *zalloc(void *, unsigned, unsigned);
388 @@ -341,6 +344,7 @@
389 #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
390 }
391 break;
392 +#ifndef CONFIG_REMOVE_GZIP
393 case IH_COMP_GZIP:
394 printf (" Uncompressing %s ... ", name);
395 if (gunzip ((void *)ntohl(hdr->ih_load), unc_len,
396 @@ -350,6 +354,7 @@
397 do_reset (cmdtp, flag, argc, argv);
398 }
399 break;
400 +#endif /* CONFIG_REMOVE_GZIP */
401 #ifdef CONFIG_BZIP2
402 case IH_COMP_BZIP2:
403 printf (" Uncompressing %s ... ", name);
404 @@ -369,6 +374,18 @@
405 }
406 break;
407 #endif /* CONFIG_BZIP2 */
408 +#ifdef CONFIG_LZMA
409 + case IH_COMP_LZMA:
410 + printf (" Uncompressing %s ... ", name);
411 + i = lzma_inflate ((unsigned char *)data, len, (unsigned char*)ntohl(hdr->ih_load), &unc_len);
412 + if (i != LZMA_RESULT_OK) {
413 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
414 + SHOW_BOOT_PROGRESS (-6);
415 + udelay(100000);
416 + do_reset (cmdtp, flag, argc, argv);
417 + }
418 + break;
419 +#endif /* CONFIG_LZMA */
420 default:
421 if (iflag)
422 enable_interrupts();
423 @@ -1176,6 +1193,8 @@
424 );
425 #endif /* CFG_CMD_IMLS */
426
427 +#endif /* ! CFG_HEAD_CODE */
428 +
429 void
430 print_image_hdr (image_header_t *hdr)
431 {
432 @@ -1270,12 +1289,15 @@
433 case IH_COMP_NONE: comp = "uncompressed"; break;
434 case IH_COMP_GZIP: comp = "gzip compressed"; break;
435 case IH_COMP_BZIP2: comp = "bzip2 compressed"; break;
436 + case IH_COMP_LZMA: comp = "lzma compressed"; break;
437 default: comp = "unknown compression"; break;
438 }
439
440 printf ("%s %s %s (%s)", arch, os, type, comp);
441 }
442
443 +#ifndef CFG_HEAD_CODE
444 +
445 #define ZALLOC_ALIGNMENT 16
446
447 static void *zalloc(void *x, unsigned items, unsigned size)
448 @@ -1427,3 +1449,5 @@
449 }
450
451 #endif /* CONFIG_LYNXKDI */
452 +
453 +#endif /* ! CFG_HEAD_CODE */
454 diff -urN u-boot-1.1.5.a/common/cmd_flash.c u-boot/common/cmd_flash.c
455 --- u-boot-1.1.5.a/common/cmd_flash.c 2006-10-20 16:54:33.000000000 +0100
456 +++ u-boot/common/cmd_flash.c 2007-03-09 09:47:46.000000000 +0000
457 @@ -196,9 +196,17 @@
458 }
459
460 static int
461 -flash_fill_sect_ranges (ulong addr_first, ulong addr_last,
462 - int *s_first, int *s_last,
463 - int *s_count )
464 +flash_fill_sect_ranges(
465 + ulong *addr_first_sect_start,
466 + ulong addr_first,
467 + ulong *addr_last_sect_end,
468 + ulong addr_last,
469 + int *s_first,
470 + int *s_last,
471 + int *bPartialStart,
472 + int *bPartialEnd,
473 + int *s_count,
474 + unsigned int bPartialErase)
475 {
476 flash_info_t *info;
477 ulong bank;
478 @@ -211,9 +219,7 @@
479 s_last [bank] = -1; /* last sector to erase */
480 }
481
482 - for (bank=0,info=&flash_info[0];
483 - (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last);
484 - ++bank, ++info) {
485 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (addr_first <= addr_last); ++bank, ++info) {
486 ulong b_end;
487 int sect;
488 short s_end;
489 @@ -225,7 +231,6 @@
490 b_end = info->start[0] + info->size - 1; /* bank end addr */
491 s_end = info->sector_count - 1; /* last sector */
492
493 -
494 for (sect=0; sect < info->sector_count; ++sect) {
495 ulong end; /* last address in current sect */
496
497 @@ -238,11 +243,21 @@
498
499 if (addr_first == info->start[sect]) {
500 s_first[bank] = sect;
501 + } else if (addr_first > info->start[sect] && addr_first <= end && bPartialErase) {
502 + *addr_first_sect_start = info->start[sect];
503 + s_first[bank] = sect;
504 + *bPartialStart = 1;
505 }
506 +
507 if (addr_last == end) {
508 s_last[bank] = sect;
509 + } else if (addr_last >= info->start[sect] && addr_last < end && bPartialErase) {
510 + *addr_last_sect_end = end;
511 + s_last[bank] = sect;
512 + *bPartialEnd = 1;
513 }
514 }
515 +
516 if (s_first[bank] >= 0) {
517 if (s_last[bank] < 0) {
518 if (addr_last > b_end) {
519 @@ -316,6 +331,8 @@
520 struct part_info *part;
521 u8 dev_type, dev_num, pnum;
522 #endif
523 + unsigned int bPartialErase = 0;
524 +
525 int rcode = 0;
526
527 if (argc < 2) {
528 @@ -368,8 +385,8 @@
529 }
530 }
531 #endif
532 -
533 - if (argc != 3) {
534 +
535 + if (argc != 4) {
536 printf ("Usage:\n%s\n", cmdtp->usage);
537 return 1;
538 }
539 @@ -397,11 +414,117 @@
540 return 1;
541 }
542
543 - rcode = flash_sect_erase(addr_first, addr_last);
544 + printf ("Erase Flash from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
545 + if(argc == 4) {
546 + bPartialErase = simple_strtoul(argv[3], NULL, 10);
547 + }
548 +
549 + rcode = flash_sect_erase(addr_first, addr_last, bPartialErase);
550 return rcode;
551 }
552
553 -int flash_sect_erase (ulong addr_first, ulong addr_last)
554 +int flerase_Partial(
555 + ulong addr_first_sect_start,
556 + ulong addr_first,
557 + ulong addr_last_sect_end,
558 + ulong addr_last,
559 + flash_info_t *info,
560 + int first_sect,
561 + int last_sect,
562 + int bFirstPartial,
563 + int bLastPartial) {
564 + unsigned int firstMemLen = 0;
565 + unsigned int lastMemLen = 0;
566 + unsigned int sectMemLen = 0;
567 + uchar *pSavedFirstMem = NULL;
568 + uchar *pSavedLastMem = NULL;
569 + uchar *pSavedSectMem = NULL;
570 + int bSectPartial = 0;
571 + int rt_code = 0;
572 +
573 + debug("%s ... 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%p, %d, %d, %d, %d\n", __FUNCTION__, addr_first_sect_start, addr_first, addr_last_sect_end, addr_last, info, first_sect, last_sect, bFirstPartial, bLastPartial);
574 +
575 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
576 + {
577 + ulong b_end = info->start[0] + info->size - 1;
578 + ulong end = (first_sect == (info->sector_count - 1)) ? b_end : info->start[first_sect + 1] - 1;
579 + sectMemLen = end - info->start[first_sect] + 1;
580 + pSavedSectMem = (uchar *)calloc(sectMemLen, sizeof(char));
581 + if (pSavedSectMem == NULL)
582 + {
583 + debug("calloc %u FAILED\n", sectMemLen);
584 + rt_code = 1;
585 + goto ret;
586 + }
587 + memset(pSavedSectMem, 0xff, sectMemLen);
588 + bSectPartial = 1;
589 + memcpy(pSavedSectMem, (uchar *)addr_first_sect_start, addr_first - addr_first_sect_start);
590 + memcpy(pSavedSectMem + (addr_last - info->start[first_sect]) + 1, addr_last + 1, end - addr_last);
591 + }
592 + else
593 + {
594 + if (bFirstPartial){
595 + firstMemLen = addr_first - addr_first_sect_start + 1;
596 + pSavedFirstMem = (uchar *)calloc(firstMemLen,sizeof(char));
597 + memcpy(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1);
598 + }
599 + if (bLastPartial){
600 + lastMemLen = addr_last_sect_end - addr_last + 1;
601 + pSavedLastMem = (uchar *)calloc(lastMemLen,sizeof(char));
602 + memcpy(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1);
603 + }
604 + }
605 +
606 + if (bFirstPartial){
607 + if(flash_erase (info, first_sect, first_sect)) {
608 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, first_sect);
609 + rt_code = 1;
610 + goto ret;
611 + }
612 + debug("%s ... erase sector %d done!\n", __FUNCTION__, first_sect);
613 + }
614 +
615 + if (bLastPartial && first_sect != last_sect){
616 + if(flash_erase (info, last_sect, last_sect)) {
617 + printf("%s ... Couldn't erase sector %d\n", __FUNCTION__, last_sect);
618 + rt_code = 1;
619 + goto ret;
620 + }
621 + debug("%s ... erase sector %d done!\n", __FUNCTION__, last_sect);
622 + }
623 +
624 + if (bFirstPartial && bLastPartial && (first_sect == last_sect))
625 + {
626 + flash_write(pSavedSectMem, (uchar *)addr_first_sect_start, sectMemLen);
627 + debug("flash_write from 0x%08x with len %u\n", addr_first_sect_start, sectMemLen);
628 + }
629 + else
630 + {
631 + if (bFirstPartial){
632 + if(flash_write(pSavedFirstMem,(uchar *)addr_first_sect_start,firstMemLen - 1)) {
633 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_first_sect_start,firstMemLen - 1);
634 + rt_code = 1;
635 + goto ret;
636 + }
637 + }
638 + if (bLastPartial){
639 + if(flash_write(pSavedLastMem,(uchar *)addr_last + 1,lastMemLen - 1)) {
640 + printf("%s ... Couldn't write at 0x%08lx length %d\n", __FUNCTION__, addr_last, lastMemLen - 1);
641 + rt_code = 1;
642 + }
643 + }
644 + }
645 +ret:
646 + if (bFirstPartial)
647 + free(pSavedFirstMem);
648 + if (bLastPartial)
649 + free(pSavedLastMem);
650 + if (bSectPartial)
651 + free(pSavedSectMem);
652 + return rt_code;
653 +}
654 +
655 +int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase)
656 {
657 flash_info_t *info;
658 ulong bank;
659 @@ -413,27 +536,66 @@
660 int erased = 0;
661 int planned;
662 int rcode = 0;
663 -
664 - rcode = flash_fill_sect_ranges (addr_first, addr_last,
665 - s_first, s_last, &planned );
666 + int bPartialStart = 0; // Start sector has to be erased partially
667 + int bPartialEnd = 0; // End sector has to be erased partially
668 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
669 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
670 +
671 + rcode = flash_fill_sect_ranges (
672 + &addr_first_sect_start,
673 + addr_first,
674 + &addr_last_sect_end,
675 + addr_last,
676 + s_first,
677 + s_last,
678 + &bPartialStart,
679 + &bPartialEnd,
680 + &planned,
681 + bPartialErase );
682
683 if (planned && (rcode == 0)) {
684 - for (bank=0,info=&flash_info[0];
685 - (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0);
686 - ++bank, ++info) {
687 + for (bank=0, info=&flash_info[0]; (bank < CFG_MAX_FLASH_BANKS) && (rcode == 0); ++bank, ++info) {
688 + ulong b_end = info->start[0] + info->size - 1; /* bank end addr */
689 if (s_first[bank]>=0) {
690 - erased += s_last[bank] - s_first[bank] + 1;
691 - debug ("Erase Flash from 0x%08lx to 0x%08lx "
692 - "in Bank # %ld ",
693 - info->start[s_first[bank]],
694 - (s_last[bank] == info->sector_count) ?
695 - info->start[0] + info->size - 1:
696 - info->start[s_last[bank]+1] - 1,
697 - bank+1);
698 - rcode = flash_erase (info, s_first[bank], s_last[bank]);
699 + if(bPartialErase) {
700 + rcode = flerase_Partial(
701 + addr_first_sect_start,
702 + addr_first,
703 + addr_last_sect_end,
704 + addr_last,
705 + info,
706 + s_first[bank],
707 + s_last[bank],
708 + bPartialStart,
709 + bPartialEnd);
710 + }
711 +
712 + //Erase full sectores
713 + if (bPartialStart)
714 + s_first[bank] += 1;
715 + if (bPartialEnd)
716 + s_last[bank] -= 1;
717 + if (s_last[bank] >= s_first[bank]) {
718 + erased += s_last[bank] - s_first[bank] + 1;
719 + debug ("Erase Flash from 0x%08lx to 0x%08lx in Bank # %ld ",
720 + info->start[s_first[bank]],
721 + (s_last[bank] == info->sector_count) ?
722 + info->start[0] + info->size - 1:
723 + info->start[s_last[bank]+1] - 1,
724 + bank + 1);
725 + rcode = flash_erase (info, s_first[bank], s_last[bank]);
726 + }
727 }
728 }
729 - printf ("Erased %d sectors\n", erased);
730 +
731 + if (erased && !bPartialErase) {
732 + printf ("Erased %d sectors\n", erased);
733 + } else if (bPartialErase){
734 + printf ("Partial erased from 0x%08lx to 0x%08lx\n", addr_first, addr_last);
735 + } else {
736 + printf ("Error: start and/or end address not on sector boundary\n");
737 + rcode = 1;
738 + }
739 } else if (rcode == 0) {
740 puts ("Error: start and/or end address"
741 " not on sector boundary\n");
742 @@ -629,8 +791,22 @@
743 int protected, i;
744 int planned;
745 int rcode;
746 -
747 - rcode = flash_fill_sect_ranges( addr_first, addr_last, s_first, s_last, &planned );
748 + int bPartialStart = 0; // Start sector has to be erased partially
749 + int bPartialEnd = 0; // End sector has to be erased partially
750 + ulong addr_first_sect_start = 0;// Sector start address of location addr_start
751 + ulong addr_last_sect_end = 0; // Sector end address of location addr_last
752 +
753 + rcode = flash_fill_sect_ranges (
754 + &addr_first_sect_start,
755 + addr_first,
756 + &addr_last_sect_end,
757 + addr_last,
758 + s_first,
759 + s_last,
760 + &bPartialStart,
761 + &bPartialEnd,
762 + &planned,
763 + 1 );
764
765 protected = 0;
766
767 @@ -690,7 +866,7 @@
768 );
769
770 U_BOOT_CMD(
771 - erase, 3, 1, do_flerase,
772 + erase, 4, 1, do_flerase,
773 "erase - erase FLASH memory\n",
774 "start end\n"
775 " - erase FLASH from addr 'start' to addr 'end'\n"
776 diff -urN u-boot-1.1.5.a/common/cmd_nvedit.c u-boot/common/cmd_nvedit.c
777 --- u-boot-1.1.5.a/common/cmd_nvedit.c 2006-10-20 16:54:33.000000000 +0100
778 +++ u-boot/common/cmd_nvedit.c 2007-03-09 09:47:46.000000000 +0000
779 @@ -540,8 +540,19 @@
780 extern char * env_name_spec;
781
782 printf ("Saving Environment to %s...\n", env_name_spec);
783 -
784 +#if 1
785 + if(saveenv() == 0) {
786 +#ifdef UBOOT_ENV_COPY
787 + saveenv_copy();
788 +#else
789 + ;
790 +#endif //UBOOT_ENV_COPY
791 + } else
792 + return 1;
793 + return 0;
794 +#else
795 return (saveenv() ? 1 : 0);
796 +#endif
797 }
798
799
800 diff -urN u-boot-1.1.5.a/common/console.c u-boot/common/console.c
801 --- u-boot-1.1.5.a/common/console.c 2006-10-20 16:54:33.000000000 +0100
802 +++ u-boot/common/console.c 2007-03-09 09:47:46.000000000 +0000
803 @@ -324,7 +324,7 @@
804 #endif
805
806 /** U-Boot INIT FUNCTIONS *************************************************/
807 -
808 +#ifndef CFG_HEAD_CODE
809 int console_assign (int file, char *devname)
810 {
811 int flag, i;
812 @@ -357,7 +357,7 @@
813
814 return -1;
815 }
816 -
817 +#endif //CFG_HEAD_CODE
818 /* Called before relocation - use serial functions */
819 int console_init_f (void)
820 {
821 @@ -392,6 +392,7 @@
822 }
823 #endif /* CFG_CONSOLE_IS_IN_ENV || CONFIG_SPLASH_SCREEN */
824
825 +#ifndef CFG_HEAD_CODE
826 #ifdef CFG_CONSOLE_IS_IN_ENV
827 /* Called after the relocation - use desired console functions */
828 int console_init_r (void)
829 @@ -570,3 +571,4 @@
830 }
831
832 #endif /* CFG_CONSOLE_IS_IN_ENV */
833 +#endif //CFG_HEAD_CODE
834 diff -urN u-boot-1.1.5.a/common/devices.c u-boot/common/devices.c
835 --- u-boot-1.1.5.a/common/devices.c 2006-10-20 16:54:33.000000000 +0100
836 +++ u-boot/common/devices.c 2007-03-09 09:47:46.000000000 +0000
837 @@ -39,6 +39,7 @@
838 list_t devlist = 0;
839 device_t *stdio_devices[] = { NULL, NULL, NULL };
840 char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
841 +#ifndef CFG_HEAD_CODE
842
843 #if defined(CONFIG_SPLASH_SCREEN) && !defined(CFG_DEVICE_NULLDEV)
844 #define CFG_DEVICE_NULLDEV 1
845 @@ -214,3 +215,5 @@
846
847 return 0;
848 }
849 +#endif //CFG_HEAD_CODE
850 +
851 diff -urN u-boot-1.1.5.a/common/env_common.c u-boot/common/env_common.c
852 --- u-boot-1.1.5.a/common/env_common.c 2006-10-20 16:54:33.000000000 +0100
853 +++ u-boot/common/env_common.c 2008-05-11 13:26:45.000000000 +0100
854 @@ -219,7 +219,9 @@
855 * We must allocate a buffer for the environment
856 */
857 env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
858 - DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
859 + if(!env_ptr)
860 + DEBUGF ("malloc env_ptr error!!\n");
861 + DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__, __LINE__, env_ptr);
862 #endif
863
864 /*
865 @@ -227,6 +229,10 @@
866 */
867 env_get_char = env_get_char_memory;
868
869 + //leejack
870 + DEBUGF ("%s[%d] gd->env_valid=%d\n", __FUNCTION__, __LINE__, gd->env_valid);
871 + DEBUGF ("%s[%d] CFG_ENV_SIZE=%d\n", __FUNCTION__, __LINE__, CFG_ENV_SIZE);
872 +
873 if (gd->env_valid == 0) {
874 #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */
875 puts ("Using default environment\n\n");
876 @@ -242,18 +248,17 @@
877 }
878
879 memset (env_ptr, 0, sizeof(env_t));
880 - memcpy (env_ptr->data,
881 - default_environment,
882 - sizeof(default_environment));
883 + memcpy (env_ptr->data, default_environment, sizeof(default_environment));
884 +
885 #ifdef CFG_REDUNDAND_ENVIRONMENT
886 env_ptr->flags = 0xFF;
887 #endif
888 env_crc_update ();
889 gd->env_valid = 1;
890 - }
891 - else {
892 + } else {
893 env_relocate_spec ();
894 }
895 +
896 gd->env_addr = (ulong)&(env_ptr->data);
897
898 #ifdef CONFIG_AMIGAONEG3SE
899 diff -urN u-boot-1.1.5.a/common/env_flash.c u-boot/common/env_flash.c
900 --- u-boot-1.1.5.a/common/env_flash.c 2006-10-20 16:54:33.000000000 +0100
901 +++ u-boot/common/env_flash.c 2008-05-11 14:55:45.000000000 +0100
902 @@ -66,7 +66,6 @@
903 #endif
904
905 #else /* ! ENV_IS_EMBEDDED */
906 -
907 env_t *env_ptr = (env_t *)CFG_ENV_ADDR;
908 #ifdef CMD_SAVEENV
909 static env_t *flash_addr = (env_t *)CFG_ENV_ADDR;
910 @@ -201,6 +200,7 @@
911 debug (" %08lX ... %08lX ...",
912 (ulong)&(flash_addr_new->data),
913 sizeof(env_ptr->data)+(ulong)&(flash_addr_new->data));
914 +
915 if ((rc = flash_write((char *)env_ptr->data,
916 (ulong)&(flash_addr_new->data),
917 sizeof(env_ptr->data))) ||
918 @@ -256,7 +256,6 @@
919 #endif /* CMD_SAVEENV */
920
921 #else /* ! CFG_ENV_ADDR_REDUND */
922 -
923 int env_init(void)
924 {
925 #ifdef CONFIG_OMAP2420H4
926 @@ -280,8 +279,55 @@
927
928 #ifdef CMD_SAVEENV
929
930 +#ifdef UBOOT_ENV_COPY
931 +int saveenv_copy(void) {
932 + uchar *env_buffer = (char *)env_ptr;
933 + char *kernel_addr;
934 + char *rootfs_addr;
935 + char *rootfs_size;
936 + ulong start_addr,end_addr,rootfs_end_addr;
937 + ulong flash_start;
938 +
939 + kernel_addr = getenv("f_kernel_addr");
940 + end_addr = simple_strtoul(kernel_addr,NULL,16) - 1;
941 + start_addr = end_addr - CFG_ENV_SIZE - sizeof(UBOOTCONFIG_COPY_HEADER) + 1;
942 +
943 + rootfs_addr = getenv("f_rootfs_addr");
944 + rootfs_size = getenv("f_rootfs_size");
945 + rootfs_end_addr = simple_strtoul(rootfs_addr,NULL,16) + simple_strtoul(rootfs_size,NULL,16);
946 +
947 + if(rootfs_end_addr >= start_addr)
948 + {
949 + printf("Can not copy the environment at 0x%08lx as no space left.\nf_kernel_addr = 0x%08lx while rootfs_end_addr = 0x%08lx\n",start_addr,end_addr,rootfs_end_addr);
950 + return 1;
951 + }
952 +
953 + debug ("Protect off %08lX ... %08lX\n", (ulong)rootfs_end_addr, end_addr);
954 + if (flash_sect_protect (0, rootfs_end_addr, end_addr))
955 + return 1;
956 +
957 + //delete the old environment copy, if found
958 + flash_start = rootfs_end_addr;
959 + while(flash_start + sizeof(UBOOTCONFIG_COPY_HEADER) + ENV_SIZE < end_addr)
960 + {
961 + if(strncmp((char *)flash_start,UBOOTCONFIG_COPY_HEADER,sizeof(UBOOTCONFIG_COPY_HEADER)) == 0)
962 + {
963 + flash_sect_erase(flash_start,flash_start + sizeof(UBOOTCONFIG_COPY_HEADER),1);
964 + }
965 + flash_start += 1;
966 + }
967 + flash_sect_erase(start_addr,end_addr,1);
968 + flash_write(UBOOTCONFIG_COPY_HEADER,start_addr,sizeof(UBOOTCONFIG_COPY_HEADER));
969 + flash_write(env_buffer,start_addr + sizeof(UBOOTCONFIG_COPY_HEADER), CFG_ENV_SIZE);
970 + flash_sect_protect (1, rootfs_end_addr, end_addr);
971 + printf("saved copy of the env at 0x%08lx\n",start_addr);
972 + return 0;
973 +}
974 +#endif //UBOOT_ENV_COPY
975 +
976 int saveenv(void)
977 {
978 +#define debug printf
979 int len, rc;
980 ulong end_addr;
981 ulong flash_sect_addr;
982 @@ -331,7 +377,7 @@
983 return 1;
984
985 puts ("Erasing Flash...");
986 - if (flash_sect_erase (flash_sect_addr, end_addr))
987 + if (flash_sect_erase (flash_sect_addr, end_addr, 1))
988 return 1;
989
990 puts ("Writing to Flash... ");
991 diff -urN u-boot-1.1.5.a/common/hush.c u-boot/common/hush.c
992 --- u-boot-1.1.5.a/common/hush.c 2006-10-20 16:54:33.000000000 +0100
993 +++ u-boot/common/hush.c 2008-05-10 18:56:37.000000000 +0100
994 @@ -3167,9 +3167,11 @@
995 int code = 0;
996 #endif
997 do {
998 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
999 ctx.type = flag;
1000 initialize_context(&ctx);
1001 update_ifs_map();
1002 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1003 if (!(flag & FLAG_PARSE_SEMICOLON) || (flag & FLAG_REPARSING)) mapset((uchar *)";$&|", 0);
1004 inp->promptmode=1;
1005 rcode = parse_stream(&temp, &ctx, inp, '\n');
1006 @@ -3180,9 +3182,12 @@
1007 syntax();
1008 #ifdef __U_BOOT__
1009 flag_repeat = 0;
1010 +printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1011 #endif
1012 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1013 }
1014 if (rcode != 1 && ctx.old_flag == 0) {
1015 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1016 done_word(&temp, &ctx);
1017 done_pipe(&ctx,PIPE_SEQ);
1018 #ifndef __U_BOOT__
1019 @@ -3202,6 +3207,7 @@
1020 if (code == -1)
1021 flag_repeat = 0;
1022 #endif
1023 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1024 } else {
1025 if (ctx.old_flag != 0) {
1026 free(ctx.stack);
1027 @@ -3215,6 +3221,7 @@
1028 temp.quote = 0;
1029 inp->p = NULL;
1030 free_pipe_list(ctx.list_head,0);
1031 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1032 }
1033 b_free(&temp);
1034 } while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP)); /* loop on syntax errors, return on EOF */
1035 @@ -3235,9 +3242,12 @@
1036 #ifdef __U_BOOT__
1037 char *p = NULL;
1038 int rcode;
1039 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1040 if ( !s || !*s)
1041 return 1;
1042 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1043 if (!(p = strchr(s, '\n')) || *++p) {
1044 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1045 p = xmalloc(strlen(s) + 2);
1046 strcpy(p, s);
1047 strcat(p, "\n");
1048 @@ -3247,6 +3257,7 @@
1049 return rcode;
1050 } else {
1051 #endif
1052 + printf("%s:%s[%d]\n", __FILE__, __func__, __LINE__);
1053 setup_string_in_str(&input, s);
1054 return parse_stream_outer(&input, flag);
1055 #ifdef __U_BOOT__
1056 diff -urN u-boot-1.1.5.a/config.mk u-boot/config.mk
1057 --- u-boot-1.1.5.a/config.mk 2006-10-20 16:54:33.000000000 +0100
1058 +++ u-boot/config.mk 2008-05-11 12:23:31.000000000 +0100
1059 @@ -77,7 +77,7 @@
1060 sinclude $(TOPDIR)/$(ARCH)_config.mk # include architecture dependend rules
1061 endif
1062 ifdef CPU
1063 -sinclude $(TOPDIR)/cpu/$(CPU)/config.mk # include CPU specific rules
1064 +sinclude $(TOPDIR)/cpu/$(CPU)/$(BOARD)/config.mk # include CPU specific rules
1065 endif
1066 ifdef SOC
1067 sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk # include SoC specific rules
1068 @@ -130,7 +130,8 @@
1069 ARFLAGS = crv
1070 RELFLAGS= $(PLATFORM_RELFLAGS)
1071 DBGFLAGS= -g # -DDEBUG
1072 -OPTFLAGS= -Os #-fomit-frame-pointer
1073 +OPTFLAGS= -Os
1074 +#-O2 #-fomit-frame-pointer
1075 ifndef LDSCRIPT
1076 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
1077 ifeq ($(CONFIG_NAND_U_BOOT),y)
1078 @@ -139,12 +140,15 @@
1079 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
1080 endif
1081 endif
1082 +
1083 +LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
1084 +
1085 OBJCFLAGS += --gap-fill=0xff
1086
1087 gccincdir := $(shell $(CC) -print-file-name=include)
1088
1089 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
1090 - -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
1091 + -D__KERNEL__ -DUBOOT_RAM_TEXT_BASE=$(UBOOT_RAM_TEXT_BASE) \
1092
1093 ifneq ($(OBJTREE),$(SRCTREE))
1094 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
1095 @@ -180,7 +184,10 @@
1096
1097 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
1098
1099 -LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
1100 +LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(UBOOT_RAM_TEXT_BASE) $(PLATFORM_LDFLAGS)
1101 +LDFLAGS_BOOTSTRAP += -Bstatic -T $(LDSCRIPT_BOOTSTRAP) -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
1102 +
1103 +#HEAD_LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(HEAD_FLASH_TEXT_BASE) $(PLATFORM_LDFLAGS)
1104
1105 # Location of a usable BFD library, where we define "usable" as
1106 # "built for ${HOST}, supports ${TARGET}". Sensible values are
1107 @@ -211,10 +218,17 @@
1108
1109 #########################################################################
1110
1111 +AFLAGS := $(AFLAGS) $(IFX_CFLAGS)
1112 +CFLAGS := $(CFLAGS) $(IFX_CFLAGS)
1113 +CPPFLAGS := $(CPPFLAGS) $(IFX_CFLAGS)
1114 +
1115 +#########################################################################
1116 +
1117 export CONFIG_SHELL HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE \
1118 AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP \
1119 MAKE
1120 -export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1121 +#export UBOOT_RAM_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1122 +export UBOOT_RAM_TEXT_BASE BOOTSTRAP_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
1123
1124 #########################################################################
1125
1126 diff -urN u-boot-1.1.5.a/drivers/Makefile u-boot/drivers/Makefile
1127 --- u-boot-1.1.5.a/drivers/Makefile 2006-10-20 16:54:33.000000000 +0100
1128 +++ u-boot/drivers/Makefile 2008-05-11 14:54:11.000000000 +0100
1129 @@ -50,14 +50,14 @@
1130 videomodes.o w83c553f.o \
1131 ks8695eth.o \
1132 pxa_pcmcia.o mpc8xx_pcmcia.o tqm8xx_pcmcia.o \
1133 - rpx_pcmcia.o
1134 + rpx_pcmcia.o ifx_sw.o
1135
1136 SRCS := $(COBJS:.o=.c)
1137 OBJS := $(addprefix $(obj),$(COBJS))
1138
1139 all: $(LIB)
1140
1141 -$(LIB): $(obj).depend $(OBJS)
1142 +$(LIB): $(OBJS)
1143 $(AR) $(ARFLAGS) $@ $(OBJS)
1144
1145 #########################################################################
1146 diff -urN u-boot-1.1.5.a/include/asm-mips/mipsregs.h u-boot/include/asm-mips/mipsregs.h
1147 --- u-boot-1.1.5.a/include/asm-mips/mipsregs.h 2006-10-20 16:54:33.000000000 +0100
1148 +++ u-boot/include/asm-mips/mipsregs.h 2008-05-11 12:31:57.000000000 +0100
1149 @@ -48,6 +48,7 @@
1150 #define CP0_CAUSE $13
1151 #define CP0_EPC $14
1152 #define CP0_PRID $15
1153 +#define CP0_EBASE $15,1
1154 #define CP0_CONFIG $16
1155 #define CP0_LLADDR $17
1156 #define CP0_WATCHLO $18
1157 @@ -330,11 +331,32 @@
1158 # define KSU_USER 0x00000010
1159 # define KSU_SUPERVISOR 0x00000008
1160 # define KSU_KERNEL 0x00000000
1161 +#ifdef CONFIG_DANUBE /* MIPS 24KE */
1162 +/* bits 5 & 6 & 7: reserved */
1163 +/* bits 8~15: IM0~7 */
1164 +/* bits 16: reserved */
1165 +#define ST0_CEE 0x00020000
1166 +/* bits 18: always 0 */
1167 +#define ST0_NMI 0x00080000
1168 +#define ST0_SR 0x00100000
1169 +#define ST0_TS 0x00200000
1170 +#define ST0_BEV 0x00400000
1171 +/* bits 23: reserved */
1172 +#define ST0_MX 0x01000000
1173 +#define ST0_RE 0x02000000
1174 +#define ST0_FR 0x04000000
1175 +#define ST0_RP 0x08000000
1176 +#define ST0_CU0 0x10000000
1177 +#define ST0_CU1 0x20000000
1178 +#define ST0_CU2 0x40000000
1179 +#define ST0_CU3 0x80000000
1180 +#else
1181 #define ST0_UX 0x00000020
1182 #define ST0_SX 0x00000040
1183 #define ST0_KX 0x00000080
1184 #define ST0_DE 0x00010000
1185 #define ST0_CE 0x00020000
1186 +#endif
1187
1188 /*
1189 * Bitfields in the R[23]000 cp0 status register.
1190 @@ -471,6 +493,14 @@
1191 #define CAUSEF_BD (1 << 31)
1192
1193 /*
1194 + * Bits in the coprocessor 0 EBase register
1195 + */
1196 +#define EBASEB_CPUNUM 0
1197 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
1198 +#define EBASEB_EXPBASE 12
1199 +#define EBASEF_EXPBASE (0x3ffff << EBASEB_EXPBASE)
1200 +
1201 +/*
1202 * Bits in the coprozessor 0 config register.
1203 */
1204 #define CONF_CM_CACHABLE_NO_WA 0
1205 @@ -544,4 +574,10 @@
1206 #define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
1207 #define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
1208
1209 +/*
1210 + * Bits in ErrCtl register
1211 + */
1212 +#define ECCB_WST 29
1213 +#define ECCF_WST (0x1 << ECCB_WST)
1214 +
1215 #endif /* _ASM_MIPSREGS_H */
1216 diff -urN u-boot-1.1.5.a/include/cmd_confdefs.h u-boot/include/cmd_confdefs.h
1217 --- u-boot-1.1.5.a/include/cmd_confdefs.h 2006-10-20 16:54:33.000000000 +0100
1218 +++ u-boot/include/cmd_confdefs.h 2007-03-09 09:47:46.000000000 +0000
1219 @@ -94,6 +94,7 @@
1220 #define CFG_CMD_EXT2 0x1000000000000000ULL /* EXT2 Support */
1221 #define CFG_CMD_SNTP 0x2000000000000000ULL /* SNTP support */
1222 #define CFG_CMD_DISPLAY 0x4000000000000000ULL /* Display support */
1223 +#define CFG_CMD_DHRYSTONE 0x8000000000000000ULL /* Dhrystone benchmark support */
1224
1225 #define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFFULL /* ALL commands */
1226
1227 @@ -141,6 +142,7 @@
1228 CFG_CMD_SPI | \
1229 CFG_CMD_UNIVERSE | \
1230 CFG_CMD_USB | \
1231 + CFG_CMD_DHRYSTONE | \
1232 CFG_CMD_VFD )
1233
1234 /* Default configuration
1235 diff -urN u-boot-1.1.5.a/include/config.h u-boot/include/config.h
1236 --- u-boot-1.1.5.a/include/config.h 1970-01-01 01:00:00.000000000 +0100
1237 +++ u-boot/include/config.h 2008-05-11 14:02:25.000000000 +0100
1238 @@ -0,0 +1,2 @@
1239 +/* Automatically generated - do not edit */
1240 +#include <configs/danube.h>
1241 diff -urN u-boot-1.1.5.a/include/config.mk u-boot/include/config.mk
1242 --- u-boot-1.1.5.a/include/config.mk 1970-01-01 01:00:00.000000000 +0100
1243 +++ u-boot/include/config.mk 2008-05-11 14:02:25.000000000 +0100
1244 @@ -0,0 +1,3 @@
1245 +ARCH = mips
1246 +CPU = mips
1247 +BOARD = danube
1248 diff -urN u-boot-1.1.5.a/include/flash.h u-boot/include/flash.h
1249 --- u-boot-1.1.5.a/include/flash.h 2006-10-20 16:54:33.000000000 +0100
1250 +++ u-boot/include/flash.h 2008-05-11 12:31:57.000000000 +0100
1251 @@ -79,7 +79,7 @@
1252 extern unsigned long flash_init (void);
1253 extern void flash_print_info (flash_info_t *);
1254 extern int flash_erase (flash_info_t *, int, int);
1255 -extern int flash_sect_erase (ulong addr_first, ulong addr_last);
1256 +extern int flash_sect_erase (ulong addr_first, ulong addr_last, unsigned int bPartialErase);
1257 extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
1258
1259 /* common/flash.c */
1260 @@ -299,6 +299,10 @@
1261 #define TOSH_ID_FVT160 0xC2 /* TC58FVT160 ID (16 M, top ) */
1262 #define TOSH_ID_FVB160 0x43 /* TC58FVT160 ID (16 M, bottom ) */
1263
1264 +#define MX_ID_29LV320AB 0x22A822A8 /* MXIC MX29LV320AB ID (32 M, bottom ) joelin */
1265 +#define MX_ID_29LV160BB 0x22492249 /* MXIC MX29LV160BB ID (16 M, bottom ) joelin */
1266 +#define MX_ID_29LV640BB 0x22cb22cb /* MXIC MX29LV640BB ID (64 M, bottom ) joelin */
1267 +
1268 /*-----------------------------------------------------------------------
1269 * Internal FLASH identification codes
1270 *
1271 @@ -422,6 +426,10 @@
1272 #define FLASH_S29GL064M 0x00F0 /* Spansion S29GL064M-R6 */
1273 #define FLASH_S29GL128N 0x00F1 /* Spansion S29GL128N */
1274
1275 +#define FLASH_29LV320AB 0x00B0 /* MXIC MX29LV320AB( 32M = 4M x 16 ) joelin 10/07/2004*/
1276 +#define FLASH_29LV160BB 0x00B1 /* MXIC MX29LV160BB( 16M = 2M x 16 ) joelin 11/22/2004*/
1277 +#define FLASH_29LV640BB 0x00B2 /* MXIC MX29LV640BB( 64M = 8M x 16 ) liupeng*/
1278 +
1279 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
1280
1281
1282 diff -urN u-boot-1.1.5.a/include/image.h u-boot/include/image.h
1283 --- u-boot-1.1.5.a/include/image.h 2006-10-20 16:54:33.000000000 +0100
1284 +++ u-boot/include/image.h 2007-03-09 09:47:46.000000000 +0000
1285 @@ -132,6 +132,7 @@
1286 #define IH_COMP_NONE 0 /* No Compression Used */
1287 #define IH_COMP_GZIP 1 /* gzip Compression Used */
1288 #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
1289 +#define IH_COMP_LZMA 3 /* lzma Compression Used */
1290
1291 #define IH_MAGIC 0x27051956 /* Image Magic Number */
1292 #define IH_NMLEN 32 /* Image Name Length */
1293 diff -urN u-boot-1.1.5.a/include/syscall.h u-boot/include/syscall.h
1294 --- u-boot-1.1.5.a/include/syscall.h 1970-01-01 01:00:00.000000000 +0100
1295 +++ u-boot/include/syscall.h 2007-03-09 09:47:46.000000000 +0000
1296 @@ -0,0 +1,42 @@
1297 +#ifndef __MON_SYS_CALL_H__
1298 +#define __MON_SYS_CALL_H__
1299 +
1300 +#ifndef __ASSEMBLY__
1301 +
1302 +#include <common.h>
1303 +
1304 +/* These are declarations of system calls available in C code */
1305 +int mon_getc(void);
1306 +int mon_tstc(void);
1307 +void mon_putc(const char);
1308 +void mon_puts(const char*);
1309 +void mon_printf(const char* fmt, ...);
1310 +void mon_install_hdlr(int, interrupt_handler_t*, void*);
1311 +void mon_free_hdlr(int);
1312 +void *mon_malloc(size_t);
1313 +void mon_free(void*);
1314 +void mon_udelay(unsigned long);
1315 +unsigned long mon_get_timer(unsigned long);
1316 +
1317 +#endif /* ifndef __ASSEMBLY__ */
1318 +
1319 +#define NR_SYSCALLS 11 /* number of syscalls */
1320 +
1321 +
1322 +/*
1323 + * Make sure these functions are in the same order as they
1324 + * appear in the "examples/syscall.S" file !!!
1325 + */
1326 +#define SYSCALL_GETC 0
1327 +#define SYSCALL_TSTC 1
1328 +#define SYSCALL_PUTC 2
1329 +#define SYSCALL_PUTS 3
1330 +#define SYSCALL_PRINTF 4
1331 +#define SYSCALL_INSTALL_HDLR 5
1332 +#define SYSCALL_FREE_HDLR 6
1333 +#define SYSCALL_MALLOC 7
1334 +#define SYSCALL_FREE 8
1335 +#define SYSCALL_UDELAY 9
1336 +#define SYSCALL_GET_TIMER 10
1337 +
1338 +#endif
1339 diff -urN u-boot-1.1.5.a/include/version_autogenerated.h u-boot/include/version_autogenerated.h
1340 --- u-boot-1.1.5.a/include/version_autogenerated.h 1970-01-01 01:00:00.000000000 +0100
1341 +++ u-boot/include/version_autogenerated.h 2008-05-11 14:02:26.000000000 +0100
1342 @@ -0,0 +1 @@
1343 +#define U_BOOT_VERSION "U-Boot 1.1.5-IFX-LXDB"
1344 diff -urN u-boot-1.1.5.a/ld_uboot.conf u-boot/ld_uboot.conf
1345 --- u-boot-1.1.5.a/ld_uboot.conf 1970-01-01 01:00:00.000000000 +0100
1346 +++ u-boot/ld_uboot.conf 2006-11-04 15:03:01.000000000 +0000
1347 @@ -0,0 +1,8 @@
1348 +TAG_DWNLD()
1349 +{
1350 + 0xA0B00000 "u-boot.bin" /* Download u-boot image */
1351 +};
1352 +TAG_START()
1353 +{
1354 + 0xA0B00000
1355 +}; /* Start u-boot image */
1356 diff -urN u-boot-1.1.5.a/lib_generic/Makefile u-boot/lib_generic/Makefile
1357 --- u-boot-1.1.5.a/lib_generic/Makefile 2006-10-20 16:54:33.000000000 +0100
1358 +++ u-boot/lib_generic/Makefile 2007-03-09 09:47:46.000000000 +0000
1359 @@ -28,7 +28,7 @@
1360 COBJS = bzlib.o bzlib_crctable.o bzlib_decompress.o \
1361 bzlib_randtable.o bzlib_huffman.o \
1362 crc32.o ctype.o display_options.o ldiv.o \
1363 - string.o vsprintf.o zlib.o
1364 + string.o vsprintf.o zlib.o LzmaDecode.o LzmaWrapper.o
1365
1366 SRCS := $(COBJS:.o=.c)
1367 OBJS := $(addprefix $(obj),$(COBJS))
1368 diff -urN u-boot-1.1.5.a/lib_mips/board.c u-boot/lib_mips/board.c
1369 --- u-boot-1.1.5.a/lib_mips/board.c 2006-10-20 16:54:33.000000000 +0100
1370 +++ u-boot/lib_mips/board.c 2008-05-11 13:17:00.000000000 +0100
1371 @@ -29,6 +29,25 @@
1372 #include <net.h>
1373 #include <environment.h>
1374
1375 +#ifdef CFG_HEAD_CODE
1376 +#undef CONFIG_MICROBZIP2
1377 +
1378 +#ifdef CONFIG_BZIP2
1379 +#include <bzlib.h>
1380 +#endif
1381 +
1382 +#ifdef CONFIG_MICROBZIP2
1383 +#include <micro_bzlib.h>
1384 +#endif
1385 +
1386 +#ifdef CONFIG_LZMA
1387 +#include <LzmaWrapper.h>
1388 +#endif
1389 +
1390 +#include <image.h>
1391 +#include "head.h"
1392 +#endif //CFG_HEAD_CODE
1393 +
1394 DECLARE_GLOBAL_DATA_PTR;
1395
1396 #if ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || \
1397 @@ -39,8 +58,6 @@
1398 #define TOTAL_MALLOC_LEN CFG_MALLOC_LEN
1399 #endif
1400
1401 -#undef DEBUG
1402 -
1403 extern int timer_init(void);
1404
1405 extern int incaip_set_cpuclk(void);
1406 @@ -79,6 +96,25 @@
1407 mem_malloc_end - mem_malloc_start);
1408 }
1409
1410 +#ifdef CFG_HEAD_CODE
1411 +void *malloc(unsigned int size) {
1412 + if(size < (mem_malloc_end - mem_malloc_start)) {
1413 + mem_malloc_start += size;
1414 + //printf("malloc : size required = 0x%08lx and pointer = 0x%08lx\n",size,mem_malloc_start - size);
1415 + return (void *)(mem_malloc_start - size);
1416 + }
1417 + return NULL;
1418 +}
1419 +
1420 +void *realloc(void *src,unsigned int size) {
1421 + return NULL;
1422 +}
1423 +
1424 +void free(void *src) {
1425 + return;
1426 +}
1427 +#endif //CFG_HEAD_CODE
1428 +
1429 void *sbrk (ptrdiff_t increment)
1430 {
1431 ulong old = mem_malloc_brk;
1432 @@ -99,7 +135,11 @@
1433 #else
1434 int board_type = 0; /* use dummy arg */
1435 #endif
1436 +#ifdef CONFIG_USE_DDR_RAM
1437 + puts ("DDR-DRAM: ");
1438 +#else
1439 puts ("DRAM: ");
1440 +#endif
1441
1442 if ((gd->ram_size = initdram (board_type)) > 0) {
1443 print_size (gd->ram_size, "\n");
1444 @@ -116,26 +156,29 @@
1445 return (0);
1446 }
1447
1448 +#ifndef CFG_HEAD_CODE
1449 static void display_flash_config(ulong size)
1450 {
1451 puts ("Flash: ");
1452 print_size (size, "\n");
1453 }
1454 -
1455 +#endif
1456
1457 static int init_baudrate (void)
1458 {
1459 +#ifndef CFG_HEAD_CODE
1460 char tmp[64]; /* long enough for environment variables */
1461 int i = getenv_r ("baudrate", tmp, sizeof (tmp));
1462
1463 gd->baudrate = (i > 0)
1464 ? (int) simple_strtoul (tmp, NULL, 10)
1465 : CONFIG_BAUDRATE;
1466 -
1467 +#else //CFG_HEAD_CODE
1468 + gd->baudrate = CONFIG_BAUDRATE;
1469 +#endif //CFG_HEAD_CODE
1470 return (0);
1471 }
1472
1473 -
1474 /*
1475 * Breath some life into the board...
1476 *
1477 @@ -160,7 +203,9 @@
1478
1479 init_fnc_t *init_sequence[] = {
1480 timer_init,
1481 +#ifndef CFG_HEAD_CODE
1482 env_init, /* initialize environment */
1483 +#endif //CFG_HEAD_CODE
1484 #ifdef CONFIG_INCA_IP
1485 incaip_set_cpuclk, /* set cpu clock according to environment variable */
1486 #endif
1487 @@ -179,7 +224,11 @@
1488 gd_t gd_data, *id;
1489 bd_t *bd;
1490 init_fnc_t **init_fnc_ptr;
1491 +#ifdef CFG_HEAD_CODE
1492 + ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_HEAD_BASE;
1493 +#else //CFG_HEAD_CODE
1494 ulong addr, addr_sp, len = (ulong)&uboot_end - CFG_MONITOR_BASE;
1495 +#endif //CFG_HEAD_CODE
1496 ulong *s;
1497 #ifdef CONFIG_PURPLE
1498 void copy_code (ulong);
1499 @@ -278,7 +327,8 @@
1500 #ifdef CONFIG_PURPLE
1501 copy_code(addr);
1502 #endif
1503 -
1504 +
1505 + puts("\n relocate_code start");
1506 relocate_code (addr_sp, id, addr);
1507
1508 /* NOTREACHED - relocate_code() does not return */
1509 @@ -292,7 +342,93 @@
1510 *
1511 ************************************************************************
1512 */
1513 +#ifdef CFG_HEAD_CODE
1514 +
1515 +extern void print_image_hdr (image_header_t *hdr);
1516 +extern void jump_unconditional (ulong addr);
1517 +
1518 +void board_init_r (gd_t *id, ulong dest_addr) {
1519 + int i;
1520 + ulong addr;
1521 + ulong data, len, checksum;
1522 + ulong *len_ptr;
1523 + image_header_t header;
1524 + image_header_t *hdr = &header;
1525 + unsigned int destLen;
1526
1527 + puts("\n relocate code finish.\n");
1528 +
1529 + /* initialize malloc() area */
1530 + mem_malloc_init();
1531 +
1532 + addr = CFG_HEAD_BASE + CFG_UBOOT_OFFSET;
1533 + memmove (&header, (char *)addr, sizeof(image_header_t));
1534 +
1535 + if (ntohl(hdr->ih_magic) != IH_MAGIC) {
1536 + printf ("Bad Magic Number at address 0x%08lx\n",addr);
1537 + return;
1538 + }
1539 +
1540 + data = (ulong)&header;
1541 + len = sizeof(image_header_t);
1542 +
1543 + checksum = ntohl(hdr->ih_hcrc);
1544 + hdr->ih_hcrc = 0;
1545 + if (crc32 (0, (char *)data, len) != checksum) {
1546 + printf ("Bad Header Checksum\n");
1547 + return;
1548 + }
1549 +
1550 + print_image_hdr (hdr);
1551 +
1552 + data = addr + sizeof(image_header_t);
1553 + len = ntohl(hdr->ih_size);
1554 + len_ptr = (ulong *)data;
1555 +
1556 + debug ("Disabling all the interrupts\n");
1557 + disable_interrupts();
1558 +
1559 + debug (" Uncompressing UBoot Image ... \n" );
1560 + /*
1561 + * If we've got less than 4 MB of malloc() space,
1562 + * use slower decompression algorithm which requires
1563 + * at most 2300 KB of memory.
1564 + */
1565 + destLen = 0x0;
1566 +
1567 +#ifdef CONFIG_BZIP2
1568 + i = BZ2_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1569 + 0x400000, (char *)data, len,
1570 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1571 + if (i != BZ_OK) {
1572 + printf ("BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1573 + return;
1574 + }
1575 +#elif CONFIG_MICROBZIP2
1576 + i = micro_bzBuffToBuffDecompress ((char*)ntohl(hdr->ih_load),
1577 + &destLen, (char *)data, len,
1578 + CFG_MALLOC_LEN < (4096 * 1024), 0);
1579 + if (i != RETVAL_OK) {
1580 + printf ("MICRO_BUNZIP2 ERROR %d - must RESET board to recover\n", i);
1581 + return;
1582 + }
1583 +#elif CONFIG_LZMA
1584 + i = lzma_inflate ((char *)data, len, (char*)ntohl(hdr->ih_load), &destLen);
1585 + if (i != LZMA_RESULT_OK) {
1586 + printf ("LZMA ERROR %d - must RESET board to recover\n", i);
1587 + return;
1588 + }
1589 +#else
1590 + printf ("NONE Compressing u-boot body!!\n");
1591 + memmove ((void *)ntohl(hdr->ih_load), (uchar *)data, len);
1592 + destLen = len;
1593 +#endif
1594 + debug (" Uncompression completed successfully with destLen %d.\n ",destLen );
1595 + debug ("Head: Jumping to u-boot in the ram at 0x%08lx\n", CFG_MONITOR_BASE);
1596 +
1597 + jump_unconditional(CFG_MONITOR_BASE);
1598 +}
1599 +#else //CFG_HEAD_CODE
1600 void board_init_r (gd_t *id, ulong dest_addr)
1601 {
1602 cmd_tbl_t *cmdtp;
1603 @@ -305,6 +441,8 @@
1604 bd_t *bd;
1605 int i;
1606
1607 + puts("\n relocate code finish.\n");
1608 +
1609 gd = id;
1610 gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1611
1612 @@ -321,10 +459,10 @@
1613 ulong addr;
1614
1615 addr = (ulong) (cmdtp->cmd) + gd->reloc_off;
1616 -#if 0
1617 - printf ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1618 +
1619 + debug ("Command \"%s\": 0x%08lx => 0x%08lx\n",
1620 cmdtp->name, (ulong) (cmdtp->cmd), addr);
1621 -#endif
1622 +
1623 cmdtp->cmd =
1624 (int (*)(struct cmd_tbl_s *, int, int, char *[]))addr;
1625
1626 @@ -424,6 +562,7 @@
1627
1628 /* NOTREACHED - no way out of command loop except booting */
1629 }
1630 +#endif //CFG_HEAD_CODE
1631
1632 void hang (void)
1633 {
1634 diff -urN u-boot-1.1.5.a/lib_mips/head.h u-boot/lib_mips/head.h
1635 --- u-boot-1.1.5.a/lib_mips/head.h 1970-01-01 01:00:00.000000000 +0100
1636 +++ u-boot/lib_mips/head.h 2007-03-09 09:47:46.000000000 +0000
1637 @@ -0,0 +1,3 @@
1638 +
1639 +//#define CFG_HEAD_LEN 0x00006000
1640 +#define CFG_UBOOT_OFFSET CFG_HEAD_LEN
1641 diff -urN u-boot-1.1.5.a/lib_mips/time.c u-boot/lib_mips/time.c
1642 --- u-boot-1.1.5.a/lib_mips/time.c 2006-10-20 16:54:33.000000000 +0100
1643 +++ u-boot/lib_mips/time.c 2007-03-09 09:47:46.000000000 +0000
1644 @@ -80,6 +80,17 @@
1645 /*NOP*/;
1646 }
1647
1648 +void mdelay (unsigned long msec)
1649 +{
1650 + int i,j;
1651 + for(i=0;i<msec;i++)
1652 + {
1653 + udelay(1000);
1654 +
1655 + }
1656 +
1657 +}
1658 +
1659 /*
1660 * This function is derived from PowerPC code (read timebase as long long).
1661 * On MIPS it just returns the timer value.
1662 Binary files u-boot-1.1.5.a/mkbootimg.incaip2 and u-boot/mkbootimg.incaip2 differ
1663 diff -urN u-boot-1.1.5.a/net/eth.c u-boot/net/eth.c
1664 --- u-boot-1.1.5.a/net/eth.c 2006-10-20 16:54:33.000000000 +0100
1665 +++ u-boot/net/eth.c 2008-05-11 12:58:45.000000000 +0100
1666 @@ -25,6 +25,9 @@
1667 #include <command.h>
1668 #include <net.h>
1669 #include <miiphy.h>
1670 +#if defined(CONFIG_IFX_MIPS)
1671 +# include "ifx_eth.c"
1672 +#endif
1673
1674 #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI)
1675
1676 @@ -54,6 +57,9 @@
1677 extern int skge_initialize(bd_t*);
1678 extern int tsec_initialize(bd_t*, int, char *);
1679 extern int npe_initialize(bd_t *);
1680 +#if defined(CONFIG_IFX_MIPS)
1681 + IFX_ETH_INITIALIZE_EXTERN
1682 +#endif
1683
1684 static struct eth_device *eth_devices, *eth_current;
1685
1686 @@ -235,7 +241,9 @@
1687 #if defined(CONFIG_RTL8169)
1688 rtl8169_initialize(bis);
1689 #endif
1690 -
1691 +#if defined(CONFIG_IFX_MIPS)
1692 + IFX_ETH_INITIALIZE(bis)
1693 +#endif
1694 if (!eth_devices) {
1695 puts ("No ethernet found.\n");
1696 } else {
1697 Binary files u-boot-1.1.5.a/post/cache.o and u-boot/post/cache.o differ
1698 Binary files u-boot-1.1.5.a/post/cache_8xx.o and u-boot/post/cache_8xx.o differ
1699 Binary files u-boot-1.1.5.a/post/codec.o and u-boot/post/codec.o differ
1700 Binary files u-boot-1.1.5.a/post/cpu/andi.o and u-boot/post/cpu/andi.o differ
1701 Binary files u-boot-1.1.5.a/post/cpu/asm.o and u-boot/post/cpu/asm.o differ
1702 Binary files u-boot-1.1.5.a/post/cpu/b.o and u-boot/post/cpu/b.o differ
1703 Binary files u-boot-1.1.5.a/post/cpu/cmp.o and u-boot/post/cpu/cmp.o differ
1704 Binary files u-boot-1.1.5.a/post/cpu/cmpi.o and u-boot/post/cpu/cmpi.o differ
1705 Binary files u-boot-1.1.5.a/post/cpu/complex.o and u-boot/post/cpu/complex.o differ
1706 Binary files u-boot-1.1.5.a/post/cpu/cr.o and u-boot/post/cpu/cr.o differ
1707 Binary files u-boot-1.1.5.a/post/cpu/libcpu.a and u-boot/post/cpu/libcpu.a differ
1708 Binary files u-boot-1.1.5.a/post/cpu/load.o and u-boot/post/cpu/load.o differ
1709 Binary files u-boot-1.1.5.a/post/cpu/multi.o and u-boot/post/cpu/multi.o differ
1710 Binary files u-boot-1.1.5.a/post/cpu/rlwimi.o and u-boot/post/cpu/rlwimi.o differ
1711 Binary files u-boot-1.1.5.a/post/cpu/rlwinm.o and u-boot/post/cpu/rlwinm.o differ
1712 Binary files u-boot-1.1.5.a/post/cpu/rlwnm.o and u-boot/post/cpu/rlwnm.o differ
1713 Binary files u-boot-1.1.5.a/post/cpu/srawi.o and u-boot/post/cpu/srawi.o differ
1714 Binary files u-boot-1.1.5.a/post/cpu/store.o and u-boot/post/cpu/store.o differ
1715 Binary files u-boot-1.1.5.a/post/cpu/string.o and u-boot/post/cpu/string.o differ
1716 Binary files u-boot-1.1.5.a/post/cpu/three.o and u-boot/post/cpu/three.o differ
1717 Binary files u-boot-1.1.5.a/post/cpu/threei.o and u-boot/post/cpu/threei.o differ
1718 Binary files u-boot-1.1.5.a/post/cpu/threex.o and u-boot/post/cpu/threex.o differ
1719 Binary files u-boot-1.1.5.a/post/cpu/two.o and u-boot/post/cpu/two.o differ
1720 Binary files u-boot-1.1.5.a/post/cpu/twox.o and u-boot/post/cpu/twox.o differ
1721 Binary files u-boot-1.1.5.a/post/cpu.o and u-boot/post/cpu.o differ
1722 Binary files u-boot-1.1.5.a/post/dsp.o and u-boot/post/dsp.o differ
1723 Binary files u-boot-1.1.5.a/post/ether.o and u-boot/post/ether.o differ
1724 Binary files u-boot-1.1.5.a/post/i2c.o and u-boot/post/i2c.o differ
1725 Binary files u-boot-1.1.5.a/post/libpost.a and u-boot/post/libpost.a differ
1726 Binary files u-boot-1.1.5.a/post/memory.o and u-boot/post/memory.o differ
1727 Binary files u-boot-1.1.5.a/post/post.o and u-boot/post/post.o differ
1728 Binary files u-boot-1.1.5.a/post/rtc.o and u-boot/post/rtc.o differ
1729 Binary files u-boot-1.1.5.a/post/spr.o and u-boot/post/spr.o differ
1730 Binary files u-boot-1.1.5.a/post/sysmon.o and u-boot/post/sysmon.o differ
1731 Binary files u-boot-1.1.5.a/post/tests.o and u-boot/post/tests.o differ
1732 Binary files u-boot-1.1.5.a/post/uart.o and u-boot/post/uart.o differ
1733 Binary files u-boot-1.1.5.a/post/usb.o and u-boot/post/usb.o differ
1734 Binary files u-boot-1.1.5.a/post/watchdog.o and u-boot/post/watchdog.o differ
1735 diff -urN u-boot-1.1.5.a/tools/Makefile u-boot/tools/Makefile
1736 --- u-boot-1.1.5.a/tools/Makefile 2006-10-20 16:54:33.000000000 +0100
1737 +++ u-boot/tools/Makefile 2007-03-09 09:47:46.000000000 +0000
1738 @@ -23,7 +23,7 @@
1739
1740 BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
1741
1742 -OBJ_LINKS = environment.o crc32.o
1743 +OBJ_LINKS = environment_$(BOARDDIR).o crc32_$(BOARDDIR).o
1744 OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o
1745
1746 ifeq ($(ARCH),mips)
1747 @@ -117,7 +117,7 @@
1748 CPPFLAGS = -idirafter $(SRCTREE)/include \
1749 -idirafter $(OBJTREE)/include2 \
1750 -idirafter $(OBJTREE)/include \
1751 - -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC
1752 + -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC $(IFX_CFLAGS)
1753 CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O
1754 AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS)
1755 CC = $(HOSTCC)
1756 @@ -126,14 +126,14 @@
1757
1758 all: $(obj).depend $(BINS) $(LOGO_H) subdirs
1759
1760 -$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o
1761 +$(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32_$(BOARDDIR).o $(obj)environment_$(BOARDDIR).o
1762 $(CC) $(CFLAGS) -o $@ $^
1763
1764 $(obj)img2srec$(SFX): $(obj)img2srec.o
1765 $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
1766 $(STRIP) $@
1767
1768 -$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o
1769 +$(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32_$(BOARDDIR).o
1770 $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
1771 $(STRIP) $@
1772
1773 @@ -160,7 +160,7 @@
1774 $(obj)envcrc.o: $(src)envcrc.c
1775 $(CC) -g $(CFLAGS) -c -o $@ $<
1776
1777 -$(obj)crc32.o: $(obj)crc32.c
1778 +$(obj)crc32_$(BOARDDIR).o: $(obj)crc32_$(BOARDDIR).c
1779 $(CC) -g $(CFLAGS) -c -o $@ $<
1780
1781 $(obj)mkimage.o: $(src)mkimage.c
1782 @@ -192,16 +192,16 @@
1783 done
1784 endif
1785
1786 -$(obj)environment.c:
1787 - @rm -f $(obj)environment.c
1788 - ln -s $(src)../common/environment.c $(obj)environment.c
1789 +$(obj)environment_$(BOARDDIR).c:
1790 + @rm -f $(obj)environment_$(BOARDDIR).c
1791 + ln -s $(src)../common/environment_$(BOARDDIR).c $(obj)environment_$(BOARDDIR).c
1792
1793 -$(obj)environment.o: $(obj)environment.c
1794 +$(obj)environment_$(BOARDDIR).o: $(obj)environment_$(BOARDDIR).c
1795 $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $<
1796
1797 -$(obj)crc32.c:
1798 - @rm -f $(obj)crc32.c
1799 - ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
1800 +$(obj)crc32_$(BOARDDIR).c:
1801 + @rm -f $(obj)crc32_$(BOARDDIR).c
1802 + ln -s $(src)../lib_generic/crc32_$(BOARDDIR).c $(obj)crc32_$(BOARDDIR).c
1803
1804 $(LOGO_H): $(obj)bmp_logo $(LOGO_BMP)
1805 $(obj)./bmp_logo $(LOGO_BMP) >$@
1806 Binary files u-boot-1.1.5.a/tools/bmp_logo and u-boot/tools/bmp_logo differ
1807 Binary files u-boot-1.1.5.a/tools/bmp_logo.o and u-boot/tools/bmp_logo.o differ
1808 Binary files u-boot-1.1.5.a/tools/crc32_danube.o and u-boot/tools/crc32_danube.o differ
1809 Binary files u-boot-1.1.5.a/tools/envcrc and u-boot/tools/envcrc differ
1810 Binary files u-boot-1.1.5.a/tools/envcrc.o and u-boot/tools/envcrc.o differ
1811 Binary files u-boot-1.1.5.a/tools/environment_danube.o and u-boot/tools/environment_danube.o differ
1812 Binary files u-boot-1.1.5.a/tools/gen_eth_addr and u-boot/tools/gen_eth_addr differ
1813 Binary files u-boot-1.1.5.a/tools/gen_eth_addr.o and u-boot/tools/gen_eth_addr.o differ
1814 Binary files u-boot-1.1.5.a/tools/img2srec and u-boot/tools/img2srec differ
1815 Binary files u-boot-1.1.5.a/tools/img2srec.o and u-boot/tools/img2srec.o differ
1816 Binary files u-boot-1.1.5.a/tools/inca-swap-bytes and u-boot/tools/inca-swap-bytes differ
1817 Binary files u-boot-1.1.5.a/tools/inca-swap-bytes.o and u-boot/tools/inca-swap-bytes.o differ
1818 Binary files u-boot-1.1.5.a/tools/mkimage and u-boot/tools/mkimage differ
1819 diff -urN u-boot-1.1.5.a/tools/mkimage.c u-boot/tools/mkimage.c
1820 --- u-boot-1.1.5.a/tools/mkimage.c 2006-10-20 16:54:33.000000000 +0100
1821 +++ u-boot/tools/mkimage.c 2007-03-09 09:47:46.000000000 +0000
1822 @@ -138,6 +138,7 @@
1823 { IH_COMP_NONE, "none", "uncompressed", },
1824 { IH_COMP_BZIP2, "bzip2", "bzip2 compressed", },
1825 { IH_COMP_GZIP, "gzip", "gzip compressed", },
1826 + { IH_COMP_LZMA, "lzma", "lzma compressed", },
1827 { -1, "", "", },
1828 };
1829
1830 Binary files u-boot-1.1.5.a/tools/mkimage.o and u-boot/tools/mkimage.o differ
This page took 0.131192 seconds and 5 git commands to generate.