brcm47xx: update patches
[openwrt.git] / package / uboot-lantiq / patches / 400-lzma.patch
1 --- a/.gitignore
2 +++ b/.gitignore
3 @@ -23,6 +23,11 @@
4 /u-boot.hex
5 /u-boot.map
6 /u-boot.bin
7 +/u-boot.bin.bz2
8 +/u-boot.bin.gz
9 +/u-boot.bin.lzma
10 +/u-boot.bin.lzo
11 +/u-boot.dis
12 /u-boot.srec
13 /u-boot.ldr
14 /u-boot.ldr.hex
15 @@ -30,6 +35,20 @@
16 /u-boot.lds
17 /u-boot-onenand.bin
18 /u-boot-flexonenand.bin
19 +/u-boot-bootstrap
20 +/u-boot-bootstrap.hex
21 +/u-boot-bootstrap.map
22 +/u-boot-bootstrap.bin
23 +/u-boot-bootstrap.bin.bz2
24 +/u-boot-bootstrap.bin.gz
25 +/u-boot-bootstrap.bin.lzma
26 +/u-boot-bootstrap.bin.lzo
27 +/u-boot-bootstrap.dis
28 +/u-boot-bootstrap.srec
29 +/u-boot-bootstrap.ldr
30 +/u-boot-bootstrap.ldr.hex
31 +/u-boot-bootstrap.ldr.srec
32 +/u-boot-bootstrap.lds
33
34 #
35 # Generated files
36 @@ -38,6 +57,7 @@
37 *.depend
38 /LOG
39 /errlog
40 +/.payload.s
41 /reloc_off
42
43 # stgit generated dirs
44 @@ -63,3 +83,6 @@
45 /onenand_ipl/onenand-ipl*
46 /onenand_ipl/board/*/onenand*
47 /onenand_ipl/board/*/*.S
48 +examples/standalone/
49 +
50 +setvars
51 --- a/Makefile
52 +++ b/Makefile
53 @@ -183,6 +183,12 @@
54
55 OBJS := $(addprefix $(obj),$(OBJS))
56
57 +ifeq ($(CONFIG_BOOTSTRAP),y)
58 +BOOTSTRAP_OBJS = cpu/$(ARCH)/start_bootstrap.o
59 +
60 +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_OBJS))
61 +endif
62 +
63 LIBS = lib_generic/libgeneric.a
64 LIBS += lib_generic/lzma/liblzma.a
65 LIBS += lib_generic/lzo/liblzo.a
66 @@ -254,6 +260,25 @@
67 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
68 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
69
70 +ifeq ($(CONFIG_BOOTSTRAP),y)
71 +BOOTSTRAP_LIBS = lib_generic/libgeneric_bootstrap.a
72 +BOOTSTRAP_LIBS += cpu/$(ARCH)/lib$(ARCH)_bootstrap.a
73 +BOOTSTRAP_LIBS += lib_$(ARCH)/lib$(ARCH)_bootstrap.a
74 +BOOTSTRAP_LIBS += common/libcommon_bootstrap.a
75 +BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_SERIAL) += drivers/serial/libserial.a
76 +
77 +BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZMA) += lib_generic/lzma/liblzma.a
78 +BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZO) += lib/lzo/liblzo.a
79 +BOOTSTRAP_LIBS += $(BOOTSTRAP_LIBS-y)
80 +
81 +BOOTSTRAP_LIBS := $(addprefix $(obj),$(BOOTSTRAP_LIBS))
82 +.PHONY : $(BOOTSTRAP_LIBS)
83 +
84 +BOOTSTRAP_LIBBOARD = board/$(BOARDDIR)/lib$(BOARD)_bootstrap.a
85 +BOOTSTRAP_LIBBOARD := $(addprefix $(obj),$(BOOTSTRAP_LIBBOARD))
86 +endif
87 +
88 +
89 # Add GCC lib
90 ifdef USE_PRIVATE_LIBGCC
91 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
92 @@ -267,6 +292,9 @@
93 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
94 export PLATFORM_LIBS
95
96 +BOOTSTRAP_PLATFORM_LIBS += $(PLATFORM_LIBGCC)
97 +export BOOTSTRAP_PLATFORM_LIBS
98 +
99 # Special flags for CPP when processing the linker script.
100 # Pass the version down so we can handle backwards compatibility
101 # on the fly.
102 @@ -289,12 +317,19 @@
103 __OBJS := $(subst $(obj),,$(OBJS))
104 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
105
106 +__BOOTSTRAP_OBJS := $(subst $(obj),,$(BOOTSTRAP_OBJS))
107 +__BOOTSTRAP_LIBS := $(subst $(obj),,$(BOOTSTRAP_LIBS)) $(subst $(obj),,$(BOOTSTRAP_LIBBOARD))
108 +
109 #########################################################################
110 #########################################################################
111
112 # Always append ALL so that arch config.mk's can add custom ones
113 ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) $(U_BOOT_ONENAND)
114
115 +ifeq ($(CONFIG_BOOTSTRAP),y)
116 +ALL += $(obj)u-boot-bootstrap.srec $(obj)u-boot-bootstrap.bin
117 +endif
118 +
119 all: $(ALL)
120
121 $(obj)u-boot.hex: $(obj)u-boot
122 @@ -306,6 +341,19 @@
123 $(obj)u-boot.bin: $(obj)u-boot
124 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
125
126 +$(obj)u-boot.bin.gz: $(obj)u-boot.bin
127 + gzip -c $< > $@
128 +
129 +$(obj)u-boot.bin.lzma: $(obj)u-boot.bin
130 + echo lzma -e -z -c $< $@
131 + lzma e $< $@
132 +
133 +$(obj)u-boot.bin.lzo: $(obj)u-boot.bin
134 + lzop -9 -c $< > $@
135 +
136 +$(obj)u-boot.bin.bz2: $(obj)u-boot.bin
137 + bzip2 --best -z -c $< > $@
138 +
139 $(obj)u-boot.ldr: $(obj)u-boot
140 $(CREATE_LDR_ENV)
141 $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
142 @@ -335,12 +383,12 @@
143 $(obj)tools/ubsha1 $(obj)u-boot.bin
144
145 $(obj)u-boot.dis: $(obj)u-boot
146 - $(OBJDUMP) -d $< > $@
147 + $(OBJDUMP) -S -d $< > $@
148
149 GEN_UBOOT = \
150 UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
151 sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
152 - cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
153 + cd $(LNDIR) && $(LD) --gc-sections $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
154 --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
155 -Map u-boot.map -o u-boot
156 $(obj)u-boot: depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
157 @@ -362,6 +410,120 @@
158 $(LIBBOARD): depend $(LIBS)
159 $(MAKE) -C $(dir $(subst $(obj),,$@))
160
161 +# Bootstrap targets
162 +
163 +ifeq ($(CONFIG_BOOTSTRAP),y)
164 +$(obj)u-boot-bootstrap.hex: $(obj)u-boot-bootstrap
165 + $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
166 +
167 +$(obj)u-boot-bootstrap.srec: $(obj)u-boot-bootstrap
168 + $(OBJCOPY) -O srec $< $@
169 +
170 +$(obj)u-boot-bootstrap.bin: $(obj)u-boot-bootstrap
171 + $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
172 + $(BOARD_SIZE_CHECK)
173 +
174 +$(obj)u-boot-bootstrap.bin.gz: $(obj)u-boot-bootstrap.bin
175 + gzip -c $< > $@
176 +
177 +$(obj)u-boot-bootstrap.bin.lzma: $(obj)u-boot-bootstrap.bin
178 + lzma -e -z -c $< > $@
179 +
180 +$(obj)u-boot.bin-bootstrap.lzo: $(obj)u-boot-bootstrap.bin
181 + lzop -9 -c $< > $@
182 +
183 +$(obj)u-boot.bin-bootstrap.bz2: $(obj)u-boot-bootstrap.bin
184 + bzip2 --best -z -c $< > $@
185 +
186 +$(obj)u-boot-bootstrap.ldr: $(obj)u-boot-bootstrap
187 + $(CREATE_LDR_ENV)
188 + $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
189 + $(BOARD_SIZE_CHECK)
190 +
191 +$(obj)u-boot-bootstrap.ldr.hex: $(obj)u-boot-bootstrap.ldr
192 + $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
193 +
194 +$(obj)u-boot-bootstrap.ldr.srec: $(obj)u-boot-bootstrap.ldr
195 + $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
196 +
197 +$(obj)u-boot-bootstrap.img: $(obj)u-boot-bootstrap.bin
198 + $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
199 + -a $(CONFIG_BOOTSTRAP_BASE) -e 0 \
200 + -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
201 + sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
202 + -d $< $@
203 +
204 +$(obj)u-boot-bootstrap.imx: $(obj)u-boot-bootstrap.bin
205 + $(obj)tools/mkimage -n $(IMX_CONFIG) -T imximage \
206 + -e $(CONFIG_BOOTSTRAP_BASE) -d $< $@
207 +
208 +$(obj)u-boot-bootstrap.kwb: $(obj)u-boot-bootstrap.bin
209 + $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
210 + -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
211 +
212 +$(obj)u-boot-bootstrap.sha1: $(obj)u-boot-bootstrap.bin
213 + $(obj)tools/ubsha1 $(obj)u-boot-bootstrap.bin
214 +
215 +$(obj)u-boot-bootstrap.dis: $(obj)u-boot-bootstrap
216 + echo $(OBJDUMP) -S -d $< > $@
217 + $(OBJDUMP) -S -d $< > $@
218 +
219 +PAYLOAD_FILE_BASE=$(obj)u-boot.bin
220 +ifeq ($(CONFIG_BOOTSTRAP_GZIP),y)
221 +PAYLOAD_FILE_EXT:=.gz
222 +endif
223 +ifeq ($(CONFIG_BOOTSTRAP_LZMA),y)
224 +PAYLOAD_FILE_EXT:=.lzma
225 +endif
226 +ifeq ($(CONFIG_BOOTSTRAP_LZO),y)
227 +PAYLOAD_FILE_EXT:=.lzo
228 +endif
229 +ifeq ($(CONFIG_BOOTSTRAP_BZIP2),y)
230 +PAYLOAD_FILE_EXT:=.bz2
231 +endif
232 +
233 +PAYLOAD_FILE := $(PAYLOAD_FILE_BASE)$(PAYLOAD_FILE_EXT)
234 +
235 +$(obj).payload.s: $(PAYLOAD_FILE)
236 + echo ".globl payload_start" > $@
237 + echo ".globl payload_end" >> $@
238 + echo ".globl payload_size" >> $@
239 + echo ".globl payload_uncsize" >> $@
240 + echo .section .payload,\"a\",@progbits >> $@
241 + echo "payload_size:" >> $@
242 + echo -n ".word " >> $@
243 + wc -c $(PAYLOAD_FILE) | cut -f1 -d' ' >> $@
244 + echo "payload_uncsize:" >> $@
245 + echo -n ".word " >> $@
246 + wc -c $(obj)u-boot.bin | cut -f1 -d' ' >> $@
247 + echo "payload_start:" >> $@
248 + echo .incbin \"$(PAYLOAD_FILE)\" >> $@
249 + echo "payload_end:" >> $@
250 +
251 +
252 +GEN_UBOOT_BOOTSTRAP = \
253 + UNDEF_SYM=`$(OBJDUMP) -x $(BOOTSTRAP_LIBBOARD) $(BOOTSTRAP_LIBS) | \
254 + sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
255 + cd $(LNDIR) && $(LD) --gc-sections $(BOOTSTRAP_LDFLAGS) $$UNDEF_SYM $(obj).payload.o $(__BOOTSTRAP_OBJS) \
256 + --start-group $(__BOOTSTRAP_LIBS) --end-group $(BOOTSTRAP_PLATFORM_LIBS) \
257 + -Map u-boot-bootstrap.map -o u-boot-bootstrap
258 +
259 +$(obj)u-boot-bootstrap: depend $(SUBDIRS) $(BOOTSTRAP_OBJS) $(BOOTSTRAP_LIBS) $(BOOTSTRAP_LDSCRIPT) $(obj)u-boot-bootstrap.lds $(obj).payload.o #$(BOOTSTRAP_LIBBOARD)
260 + #echo "--------$(BOOTSTRAP_LIBBOARD)"
261 + #echo "$(GEN_UBOOT_BOOTSTRAP)"
262 + $(GEN_UBOOT_BOOTSTRAP)
263 +ifeq ($(CONFIG_KALLSYMS),y)
264 + smap=`$(call SYSTEM_MAP,u-boot-bootstrap) | \
265 + awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
266 + $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
267 + -c common/system_map.c -o $(obj)common/system_map.o
268 + $(GEN_UBOOT_BOOTSTRAP) $(obj)common/system_map.o
269 +endif
270 +
271 +$(BOOTSTRAP_LIBBOARD): depend $(BOOTSTRAP_LIBS)
272 + $(MAKE) -C $(dir $(subst $(obj),,$@)) $(notdir $@)
273 +endif
274 +
275 $(SUBDIRS): depend
276 $(MAKE) -C $@ all
277
278 @@ -371,6 +533,9 @@
279 $(obj)u-boot.lds: $(LDSCRIPT)
280 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
281
282 +$(obj)u-boot-bootstrap.lds: $(BOOTSTRAP_LDSCRIPT)
283 + $(CPP) $(CPPFLAGS) $(BOOTSTRAP_LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
284 +
285 $(NAND_SPL): $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
286 $(MAKE) -C nand_spl/board/$(BOARDDIR) all
287
288 @@ -3829,6 +3994,7 @@
289 $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin} \
290 $(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom \
291 $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \
292 + $(obj)u-boot-bootstrap.lds \
293 $(obj)lib_blackfin/u-boot.lds \
294 $(obj)u-boot.lds \
295 $(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
296 @@ -3853,6 +4019,12 @@
297 @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
298 @rm -f $(obj)u-boot.kwb
299 @rm -f $(obj)u-boot.imx
300 + @rm -f $(obj)u-boot.bin{.gz,.lzma,.lzo,.bz2}
301 + @rm -f $(obj)u-boot-bootstrap $(obj)u-boot-bootstrap.map $(obj)u-boot-bootstrap.hex
302 + @rm -f $(obj)u-boot-bootstrap.kwb
303 + @rm -f $(obj)u-boot-bootstrap.imx
304 + @rm -f $(obj)u-boot-bootstrap.bin{.gz,.lzma,.lzo,.bz2}
305 + @rm -f $(obj).payload.s
306 @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
307 @rm -f $(obj)cpu/mpc824x/bedbug_603e.c
308 @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
309 --- a/lib_mips/config.mk
310 +++ b/lib_mips/config.mk
311 @@ -47,6 +47,6 @@
312 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
313 # to RAM. $28 is always used as gp.
314 #
315 -PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic
316 +PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic -g
317 PLATFORM_CPPFLAGS += -msoft-float
318 PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
319 --- /dev/null
320 +++ b/cpu/mips/reset.c
321 @@ -0,0 +1,39 @@
322 +/*
323 + * (C) Copyright 2003
324 + * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
325 + *
326 + * See file CREDITS for list of people who contributed to this
327 + * project.
328 + *
329 + * This program is free software; you can redistribute it and/or
330 + * modify it under the terms of the GNU General Public License as
331 + * published by the Free Software Foundation; either version 2 of
332 + * the License, or (at your option) any later version.
333 + *
334 + * This program is distributed in the hope that it will be useful,
335 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
336 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
337 + * GNU General Public License for more details.
338 + *
339 + * You should have received a copy of the GNU General Public License
340 + * along with this program; if not, write to the Free Software
341 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
342 + * MA 02111-1307 USA
343 + */
344 +
345 +#include <common.h>
346 +#include <command.h>
347 +#include <asm/mipsregs.h>
348 +#include <asm/reboot.h>
349 +
350 +void __attribute__((weak)) _machine_restart(void)
351 +{
352 +}
353 +
354 +int __attribute__((weak)) do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
355 +{
356 + _machine_restart();
357 +
358 + fprintf(stderr, "*** reset failed ***\n");
359 + return 0;
360 +}
361 --- /dev/null
362 +++ b/cpu/mips/reset_bootstrap.c
363 @@ -0,0 +1,39 @@
364 +/*
365 + * (C) Copyright 2003
366 + * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
367 + *
368 + * See file CREDITS for list of people who contributed to this
369 + * project.
370 + *
371 + * This program is free software; you can redistribute it and/or
372 + * modify it under the terms of the GNU General Public License as
373 + * published by the Free Software Foundation; either version 2 of
374 + * the License, or (at your option) any later version.
375 + *
376 + * This program is distributed in the hope that it will be useful,
377 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
378 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379 + * GNU General Public License for more details.
380 + *
381 + * You should have received a copy of the GNU General Public License
382 + * along with this program; if not, write to the Free Software
383 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
384 + * MA 02111-1307 USA
385 + */
386 +
387 +#include <common.h>
388 +#include <command.h>
389 +#include <asm/mipsregs.h>
390 +#include <asm/reboot.h>
391 +
392 +void __attribute__((weak)) _machine_restart(void)
393 +{
394 +}
395 +
396 +int __attribute__((weak)) do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
397 +{
398 + _machine_restart();
399 +
400 + printf("*** reset failed ***\n");
401 + return 0;
402 +}
403 --- /dev/null
404 +++ b/cpu/mips/start_bootstrap.S
405 @@ -0,0 +1,534 @@
406 +/*
407 + * Startup Code for MIPS32 CPU-core base on start.S source
408 + *
409 + * Copyright (c) 2010 Industrie Dial Face S.p.A.
410 + * Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>
411 + *
412 + * Copyright (c) 2003 Wolfgang Denk <wd@denx.de>
413 + *
414 + * See file CREDITS for list of people who contributed to this
415 + * project.
416 + *
417 + * This program is free software; you can redistribute it and/or
418 + * modify it under the terms of the GNU General Public License as
419 + * published by the Free Software Foundation; either version 2 of
420 + * the License, or (at your option) any later version.
421 + *
422 + * This program is distributed in the hope that it will be useful,
423 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
424 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
425 + * GNU General Public License for more details.
426 + *
427 + * You should have received a copy of the GNU General Public License
428 + * along with this program; if not, write to the Free Software
429 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
430 + * MA 02111-1307 USA
431 + */
432 +
433 +//#include <generated/generic-asm-offsets.h>
434 +#include <config.h>
435 +#include <asm/regdef.h>
436 +//#include <asm/mipsregs.h>
437 +#define CP0_INDEX $0
438 +#define CP0_RANDOM $1
439 +#define CP0_ENTRYLO0 $2
440 +#define CP0_ENTRYLO1 $3
441 +#define CP0_CONF $3
442 +#define CP0_CONTEXT $4
443 +#define CP0_PAGEMASK $5
444 +#define CP0_WIRED $6
445 +#define CP0_INFO $7
446 +#define CP0_BADVADDR $8
447 +#define CP0_COUNT $9
448 +#define CP0_ENTRYHI $10
449 +#define CP0_COMPARE $11
450 +#define CP0_STATUS $12
451 +#define CP0_CAUSE $13
452 +#define CP0_EPC $14
453 +#define CP0_PRID $15
454 +#define CP0_EBASE $15,1
455 +#define CP0_CONFIG $16
456 +#define CP0_LLADDR $17
457 +#define CP0_WATCHLO $18
458 +#define CP0_WATCHHI $19
459 +#define CP0_XCONTEXT $20
460 +#define CP0_FRAMEMASK $21
461 +#define CP0_DIAGNOSTIC $22
462 +#define CP0_DEBUG $23
463 +#define CP0_DEPC $24
464 +#define CP0_PERFORMANCE $25
465 +#define CP0_ECC $26
466 +#define CP0_CACHEERR $27
467 +#define CP0_TAGLO $28
468 +#define CP0_TAGHI $29
469 +#define CP0_ERROREPC $30
470 +#define CP0_DESAVE $31
471 +#define ST0_CU0 0x10000000
472 +#define CONF_CM_UNCACHED 2
473 +#define CONF_CM_CACHABLE_NONCOHERENT 3
474 +#define EBASEB_CPUNUM 0
475 +#define EBASEF_CPUNUM (0x3ff << EBASEB_CPUNUM)
476 +#define MIPS_CONF7_RPS 4 //((unsigned long)(1) << 2)
477 +#define CONF_CM_CACHABLE_NONCOHERENT 3
478 +#ifndef CONFIG_SYS_MIPS_CACHE_OPER_MODE
479 +#define CONFIG_SYS_MIPS_CACHE_OPER_MODE CONF_CM_CACHABLE_NONCOHERENT
480 +#endif
481 +
482 + /*
483 + * For the moment disable interrupts, mark the kernel mode and
484 + * set ST0_KX so that the CPU does not spit fire when using
485 + * 64-bit addresses.
486 + */
487 + .macro setup_c0_status set clr
488 + .set push
489 + mfc0 t0, CP0_STATUS
490 + or t0, ST0_CU0 | \set | 0x1f | \clr
491 + xor t0, 0x1f | \clr
492 + mtc0 t0, CP0_STATUS
493 + .set noreorder
494 + sll zero, 3 # ehb
495 + .set pop
496 + .endm
497 +
498 + .macro setup_c0_status_reset
499 +#ifdef CONFIG_64BIT
500 + setup_c0_status ST0_KX 0
501 +#else
502 + setup_c0_status 0 0
503 +#endif
504 + .endm
505 +
506 +#define RVECENT(f,n) \
507 + b f; nop
508 +#define XVECENT(f,bev) \
509 + b f ; \
510 + li k0,bev
511 +
512 + .set noreorder
513 +
514 + .globl _start
515 + .text
516 +_start:
517 + RVECENT(reset,0) /* U-boot entry point */
518 + RVECENT(reset,1) /* software reboot */
519 +#if defined(CONFIG_INCA_IP)
520 + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
521 + .word 0x00000000 /* phase of the flash */
522 +#elif defined(CONFIG_PURPLE)
523 + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
524 + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
525 +#else
526 + .word INFINEON_EBU_BOOTCFG /* EBU init code, fetched during booting */
527 + .word 0x00000000 /* phase of the flash */
528 +#endif
529 + RVECENT(romReserved,3)
530 + RVECENT(romReserved,4)
531 + RVECENT(romReserved,5)
532 + RVECENT(romReserved,6)
533 + RVECENT(romReserved,7)
534 + RVECENT(romReserved,8)
535 + RVECENT(romReserved,9)
536 + RVECENT(romReserved,10)
537 + RVECENT(romReserved,11)
538 + RVECENT(romReserved,12)
539 + RVECENT(romReserved,13)
540 + RVECENT(romReserved,14)
541 + RVECENT(romReserved,15)
542 + RVECENT(romReserved,16)
543 + RVECENT(romReserved,17)
544 + RVECENT(romReserved,18)
545 + RVECENT(romReserved,19)
546 + RVECENT(romReserved,20)
547 + RVECENT(romReserved,21)
548 + RVECENT(romReserved,22)
549 + RVECENT(romReserved,23)
550 + RVECENT(romReserved,24)
551 + RVECENT(romReserved,25)
552 + RVECENT(romReserved,26)
553 + RVECENT(romReserved,27)
554 + RVECENT(romReserved,28)
555 + RVECENT(romReserved,29)
556 + RVECENT(romReserved,30)
557 + RVECENT(romReserved,31)
558 + RVECENT(romReserved,32)
559 + RVECENT(romReserved,33)
560 + RVECENT(romReserved,34)
561 + RVECENT(romReserved,35)
562 + RVECENT(romReserved,36)
563 + RVECENT(romReserved,37)
564 + RVECENT(romReserved,38)
565 + RVECENT(romReserved,39)
566 + RVECENT(romReserved,40)
567 + RVECENT(romReserved,41)
568 + RVECENT(romReserved,42)
569 + RVECENT(romReserved,43)
570 + RVECENT(romReserved,44)
571 + RVECENT(romReserved,45)
572 + RVECENT(romReserved,46)
573 + RVECENT(romReserved,47)
574 + RVECENT(romReserved,48)
575 + RVECENT(romReserved,49)
576 + RVECENT(romReserved,50)
577 + RVECENT(romReserved,51)
578 + RVECENT(romReserved,52)
579 + RVECENT(romReserved,53)
580 + RVECENT(romReserved,54)
581 + RVECENT(romReserved,55)
582 + RVECENT(romReserved,56)
583 + RVECENT(romReserved,57)
584 + RVECENT(romReserved,58)
585 + RVECENT(romReserved,59)
586 + RVECENT(romReserved,60)
587 + RVECENT(romReserved,61)
588 + RVECENT(romReserved,62)
589 + RVECENT(romReserved,63)
590 + XVECENT(romExcHandle,0x200) /* bfc00200: R4000 tlbmiss vector */
591 + RVECENT(romReserved,65)
592 + RVECENT(romReserved,66)
593 + RVECENT(romReserved,67)
594 + RVECENT(romReserved,68)
595 + RVECENT(romReserved,69)
596 + RVECENT(romReserved,70)
597 + RVECENT(romReserved,71)
598 + RVECENT(romReserved,72)
599 + RVECENT(romReserved,73)
600 + RVECENT(romReserved,74)
601 + RVECENT(romReserved,75)
602 + RVECENT(romReserved,76)
603 + RVECENT(romReserved,77)
604 + RVECENT(romReserved,78)
605 + RVECENT(romReserved,79)
606 + XVECENT(romExcHandle,0x280) /* bfc00280: R4000 xtlbmiss vector */
607 + RVECENT(romReserved,81)
608 + RVECENT(romReserved,82)
609 + RVECENT(romReserved,83)
610 + RVECENT(romReserved,84)
611 + RVECENT(romReserved,85)
612 + RVECENT(romReserved,86)
613 + RVECENT(romReserved,87)
614 + RVECENT(romReserved,88)
615 + RVECENT(romReserved,89)
616 + RVECENT(romReserved,90)
617 + RVECENT(romReserved,91)
618 + RVECENT(romReserved,92)
619 + RVECENT(romReserved,93)
620 + RVECENT(romReserved,94)
621 + RVECENT(romReserved,95)
622 + XVECENT(romExcHandle,0x300) /* bfc00300: R4000 cache vector */
623 + RVECENT(romReserved,97)
624 + RVECENT(romReserved,98)
625 + RVECENT(romReserved,99)
626 + RVECENT(romReserved,100)
627 + RVECENT(romReserved,101)
628 + RVECENT(romReserved,102)
629 + RVECENT(romReserved,103)
630 + RVECENT(romReserved,104)
631 + RVECENT(romReserved,105)
632 + RVECENT(romReserved,106)
633 + RVECENT(romReserved,107)
634 + RVECENT(romReserved,108)
635 + RVECENT(romReserved,109)
636 + RVECENT(romReserved,110)
637 + RVECENT(romReserved,111)
638 + XVECENT(romExcHandle,0x380) /* bfc00380: R4000 general vector */
639 + RVECENT(romReserved,113)
640 + RVECENT(romReserved,114)
641 + RVECENT(romReserved,115)
642 + RVECENT(romReserved,116)
643 + RVECENT(romReserved,116)
644 + RVECENT(romReserved,118)
645 + RVECENT(romReserved,119)
646 + RVECENT(romReserved,120)
647 + RVECENT(romReserved,121)
648 + RVECENT(romReserved,122)
649 + RVECENT(romReserved,123)
650 + RVECENT(romReserved,124)
651 + RVECENT(romReserved,125)
652 + RVECENT(romReserved,126)
653 + RVECENT(romReserved,127)
654 +
655 + /* We hope there are no more reserved vectors!
656 + * 128 * 8 == 1024 == 0x400
657 + * so this is address R_VEC+0x400 == 0xbfc00400
658 + */
659 +#if 1
660 + XVECENT(romExcHandle,0x400); /* bfc00400: Int, CauseIV=1 */
661 + RVECENT(romReserved,129);
662 + RVECENT(romReserved,130);
663 + RVECENT(romReserved,131);
664 + RVECENT(romReserved,132);
665 + RVECENT(romReserved,133);
666 + RVECENT(romReserved,134);
667 + RVECENT(romReserved,135);
668 + RVECENT(romReserved,136);
669 + RVECENT(romReserved,137);
670 + RVECENT(romReserved,138);
671 + RVECENT(romReserved,139);
672 + RVECENT(romReserved,140);
673 + RVECENT(romReserved,141);
674 + RVECENT(romReserved,142);
675 + RVECENT(romReserved,143);
676 + XVECENT(romExcHandle,0x480); /* bfc00480: EJTAG debug exception */
677 +#elif defined(CONFIG_PURPLE)
678 +/* 0xbfc00400 */
679 + .word 0xdc870000
680 + .word 0xfca70000
681 + .word 0x20840008
682 + .word 0x20a50008
683 + .word 0x20c6ffff
684 + .word 0x14c0fffa
685 + .word 0x00000000
686 + .word 0x03e00008
687 + .word 0x00000000
688 + .word 0x00000000
689 +/* 0xbfc00428 */
690 + .word 0xdc870000
691 + .word 0xfca70000
692 + .word 0x20840008
693 + .word 0x20a50008
694 + .word 0x20c6ffff
695 + .word 0x14c0fffa
696 + .word 0x00000000
697 + .word 0x03e00008
698 + .word 0x00000000
699 + .word 0x00000000
700 +#endif /* CONFIG_PURPLE */
701 + .align 4
702 +reset:
703 +#ifdef CONFIG_SYS_MIPS_MULTI_CPU
704 + mfc0 k0, CP0_EBASE
705 + and k0, EBASEF_CPUNUM
706 + bne k0, zero, ifx_mips_handler_cpux
707 + nop
708 +#endif
709 + /* Clear watch registers.
710 + */
711 + mtc0 zero, CP0_WATCHLO
712 + mtc0 zero, CP0_WATCHHI
713 +
714 + /* WP(Watch Pending), SW0/1 should be cleared. */
715 + mtc0 zero, CP0_CAUSE
716 +
717 + setup_c0_status_reset
718 +#if defined(CONFIG_MIPS24KEC) || defined(CONFIG_MIPS34KC)
719 + /* CONFIG7 register */
720 + /* Erratum "RPS May Cause Incorrect Instruction Execution"
721 + * for 24KEC and 34KC */
722 + mfc0 k0, CP0_CONFIG, 7
723 + li k1, MIPS_CONF7_RPS
724 + or k0, k1
725 + mtc0 k0, CP0_CONFIG, 7
726 +#endif
727 +
728 + /* Init Timer */
729 + mtc0 zero, CP0_COUNT
730 + mtc0 zero, CP0_COMPARE
731 +
732 + /* CONFIG0 register */
733 + li t0, CONF_CM_UNCACHED
734 + mtc0 t0, CP0_CONFIG
735 +
736 + /* Initialize $gp.
737 + */
738 + bal 1f
739 + nop
740 + .word _gp
741 +1:
742 + lw gp, 0(ra)
743 +
744 + /* Initialize any external memory.
745 + */
746 + la t9, lowlevel_init
747 + jalr t9
748 + nop
749 +
750 + /* Initialize caches...
751 + */
752 + la t9, mips_cache_reset
753 + jalr t9
754 + nop
755 +
756 + /* ... and enable them.
757 + */
758 + li t0, CONF_CM_CACHABLE_NONCOHERENT /*CONFIG_SYS_MIPS_CACHE_OPER_MODE*/
759 + mtc0 t0, CP0_CONFIG
760 +
761 + /* Set up temporary stack.
762 + */
763 +#ifdef CONFIG_SYS_INIT_RAM_LOCK_MIPS
764 + li a0, CONFIG_SYS_INIT_SP_OFFSET
765 + la t9, mips_cache_lock
766 + jalr t9
767 + nop
768 +#endif
769 +
770 + li t0, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET
771 + la sp, 0(t0)
772 +
773 + la t9, bootstrap_board_init_f
774 + jr t9
775 + nop
776 +
777 +/*
778 + * void relocate_code (addr_sp, gd, addr_moni)
779 + *
780 + * This "function" does not return, instead it continues in RAM
781 + * after relocating the monitor code.
782 + *
783 + * a0 = addr_sp
784 + * a1 = gd
785 + * a2 = destination address
786 + */
787 + .globl relocate_code
788 + .ent relocate_code
789 +relocate_code:
790 + move sp, a0 /* Set new stack pointer */
791 +
792 + li t0, CONFIG_BOOTSTRAP_TEXT_BASE
793 + la t3, in_ram
794 + lw t2, -12(t3) /* t2 <-- uboot_end_data */
795 + move t1, a2
796 + move s2, a2 /* s2 <-- destination address */
797 +
798 + /*
799 + * Fix $gp:
800 + *
801 + * New $gp = (Old $gp - CONFIG_SYS_MONITOR_BASE) + Destination Address
802 + */
803 + move t6, gp
804 + sub gp, CONFIG_BOOTSTRAP_TEXT_BASE
805 + add gp, a2 /* gp now adjusted */
806 + sub s1, gp, t6 /* s1 <-- relocation offset */
807 +
808 + /*
809 + * t0 = source address
810 + * t1 = target address
811 + * t2 = source end address
812 + */
813 +
814 + /*
815 + * Save destination address and size for later usage in flush_cache()
816 + */
817 + move s0, a1 /* save gd in s0 */
818 + move a0, t1 /* a0 <-- destination addr */
819 + sub a1, t2, t0 /* a1 <-- size */
820 +
821 + /* On the purple board we copy the code earlier in a special way
822 + * in order to solve flash problems
823 + */
824 +#ifndef CONFIG_PURPLE
825 +1:
826 + lw t3, 0(t0)
827 + sw t3, 0(t1)
828 + addu t0, 4
829 + ble t0, t2, 1b
830 + addu t1, 4 /* delay slot */
831 +#endif
832 +
833 + /* If caches were enabled, we would have to flush them here.
834 + */
835 +
836 + /* a0 & a1 are already set up for flush_cache(start, size) */
837 + la t9, flush_cache
838 + jalr t9
839 + nop
840 +
841 + /* Jump to where we've relocated ourselves.
842 + */
843 + addi t0, s2, in_ram - _start
844 + jr t0
845 + nop
846 +
847 + .word _gp
848 + .word _GLOBAL_OFFSET_TABLE_
849 + .word uboot_end_data
850 + .word uboot_end
851 + .word num_got_entries
852 +
853 +in_ram:
854 + /*
855 + * Now we want to update GOT.
856 + *
857 + * GOT[0] is reserved. GOT[1] is also reserved for the dynamic object
858 + * generated by GNU ld. Skip these reserved entries from relocation.
859 + */
860 + lw t3, -4(t0) /* t3 <-- num_got_entries */
861 + lw t4, -16(t0) /* t4 <-- _GLOBAL_OFFSET_TABLE_ */
862 + lw t5, -20(t0) /* t5 <-- _gp */
863 + sub t4, t5 /* compute offset*/
864 + add t4, t4, gp /* t4 now holds relocated _GLOBAL_OFFSET_TABLE_ */
865 + addi t4, t4, 8 /* Skipping first two entries. */
866 + li t2, 2
867 +1:
868 + lw t1, 0(t4)
869 + beqz t1, 2f
870 + add t1, s1
871 + sw t1, 0(t4)
872 +2:
873 + addi t2, 1
874 + blt t2, t3, 1b
875 + addi t4, 4 /* delay slot */
876 +
877 + /* Clear BSS.
878 + */
879 + lw t1, -12(t0) /* t1 <-- uboot_end_data */
880 + lw t2, -8(t0) /* t2 <-- uboot_end */
881 + add t1, s1 /* adjust pointers */
882 + add t2, s1
883 +
884 + sub t1, 4
885 +1:
886 + addi t1, 4
887 + bltl t1, t2, 1b
888 + sw zero, 0(t1) /* delay slot */
889 +
890 + move a0, s0 /* a0 <-- gd */
891 + la t9, bootstrap_board_init_r
892 + jr t9
893 + move a1, s2 /* delay slot */
894 +
895 + .end relocate_code
896 +
897 +/*
898 + * void copy_and_jump (void)
899 + *
900 + * This function copies/unzips the u-boot image and runs it.
901 + * This "function" does not return
902 + *
903 +*/
904 + .globl copy_and_jump
905 + .ent copy_and_jump
906 +copy_and_jump:
907 +
908 + /* copy_uboot(CONFIG_SYS_MONITOR_BASE, payload_uncsize, payload_start, payload_size) */
909 + li a0, CONFIG_SYS_MONITOR_BASE
910 + la a1, payload_uncsize
911 + lw a1, 0(a1)
912 + la a2, payload_start
913 + la a3, payload_size
914 + la t9, copy_uboot
915 + jalr t9
916 + lw a3, 0(a3) /* delay slot */
917 +
918 + li t9, CONFIG_SYS_MONITOR_BASE
919 + jr t9
920 + nop
921 +
922 + .end copy_and_jump
923 +
924 + /* Exception handlers.
925 + */
926 +romReserved:
927 + b romReserved
928 +
929 +romExcHandle:
930 + b romExcHandle
931 +#ifdef CONFIG_SYS_MIPS_MULTI_CPU
932 +/*
933 + * Stop Slave CPUs
934 + */
935 +ifx_mips_handler_cpux:
936 + wait;
937 + b ifx_mips_handler_cpux;
938 + nop;
939 +#endif
940 --- a/lib_mips/Makefile
941 +++ b/lib_mips/Makefile
942 @@ -24,6 +24,9 @@
943 include $(TOPDIR)/config.mk
944
945 LIB = $(obj)lib$(ARCH).a
946 +BOOTSTRAP_LIB = $(obj)lib$(ARCH)_bootstrap.a
947 +
948 +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
949
950 SOBJS-y +=
951
952 @@ -35,12 +38,21 @@
953 endif
954 COBJS-y += time.o
955
956 -SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
957 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += board_bootstrap.o
958 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += time.o
959 +
960 +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y))
961 +
962 +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c)
963 OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
964
965 +all: $(obj).depend $(LIB) $(BOOTSTRAP_LIB)
966 $(LIB): $(obj).depend $(OBJS)
967 $(AR) $(ARFLAGS) $@ $(OBJS)
968
969 +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS)
970 + $(AR) $(ARFLAGS) $@ $(BOOTSTRAP_OBJS)
971 +
972 #########################################################################
973
974 # defines $(obj).depend target
975 --- /dev/null
976 +++ b/lib_mips/board_bootstrap.c
977 @@ -0,0 +1,270 @@
978 +/*
979 + * (C) Copyright 2010 Industrie Dial Face S.p.A.
980 + * Luigi 'Comio' Mantellini, luigi.mantellini@idf-hit.com
981 + *
982 + * (C) Copyright 2003
983 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
984 + *
985 + * See file CREDITS for list of people who contributed to this
986 + * project.
987 + *
988 + * This program is free software; you can redistribute it and/or
989 + * modify it under the terms of the GNU General Public License as
990 + * published by the Free Software Foundation; either version 2 of
991 + * the License, or (at your option) any later version.
992 + *
993 + * This program is distributed in the hope that it will be useful,
994 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
995 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
996 + * GNU General Public License for more details.
997 + *
998 + * You should have received a copy of the GNU General Public License
999 + * along with this program; if not, write to the Free Software
1000 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1001 + * MA 02111-1307 USA
1002 + */
1003 +
1004 +#include <common.h>
1005 +#include <command.h>
1006 +#include <malloc.h>
1007 +#include <stdio_dev.h>
1008 +
1009 +DECLARE_GLOBAL_DATA_PTR;
1010 +
1011 +extern int timer_init(void);
1012 +
1013 +extern int incaip_set_cpuclk(void);
1014 +
1015 +extern ulong uboot_end_data;
1016 +extern ulong uboot_end;
1017 +
1018 +#ifdef CONFIG_BOOTSTRAP_SERIAL
1019 +static char *failed = "*** failed ***\n";
1020 +#endif
1021 +/*
1022 + * mips_io_port_base is the begin of the address space to which x86 style
1023 + * I/O ports are mapped.
1024 + */
1025 +unsigned long mips_io_port_base = -1;
1026 +
1027 +int __board_early_init_f(void)
1028 +{
1029 + /*
1030 + * Nothing to do in this dummy implementation
1031 + */
1032 + return 0;
1033 +}
1034 +
1035 +int board_early_init_f(void) __attribute__((weak, alias("__board_early_init_f")));
1036 +int bootstrap_board_early_init_f(void) __attribute__((weak, alias("board_early_init_f")));
1037 +
1038 +static int bootstrap_init_func_ram (void)
1039 +{
1040 + if ((gd->ram_size = bootstrap_initdram (0)) > 0) {
1041 + return (0);
1042 + }
1043 +#ifdef CONFIG_BOOTSTRAP_SERIAL
1044 + puts (failed);
1045 +#endif
1046 + return (1);
1047 +}
1048 +
1049 +static int bootstrap_display_banner(void)
1050 +{
1051 +#ifdef CONFIG_BOOTSTRAP_SERIAL
1052 + puts ("bootstrap...");
1053 +#endif
1054 + return (0);
1055 +}
1056 +
1057 +static int bootstrap_init_baudrate (void)
1058 +{
1059 +#if defined(CONFIG_BOOTSTRAP_BAUDRATE)
1060 + gd->baudrate = CONFIG_BOOTSTRAP_BAUDRATE;
1061 +#else
1062 + gd->baudrate = CONFIG_BAUDRATE;
1063 +#endif
1064 + return 0;
1065 +}
1066 +
1067 +/*
1068 + * Breath some life into the board...
1069 + *
1070 + * The first part of initialization is running from Flash memory;
1071 + * its main purpose is to initialize the RAM so that we
1072 + * can relocate the monitor code to RAM.
1073 + */
1074 +
1075 +/*
1076 + * All attempts to come up with a "common" initialization sequence
1077 + * that works for all boards and architectures failed: some of the
1078 + * requirements are just _too_ different. To get rid of the resulting
1079 + * mess of board dependend #ifdef'ed code we now make the whole
1080 + * initialization sequence configurable to the user.
1081 + *
1082 + * The requirements for any new initalization function is simple: it
1083 + * receives a pointer to the "global data" structure as it's only
1084 + * argument, and returns an integer return code, where 0 means
1085 + * "continue" and != 0 means "fatal error, hang the system".
1086 + */
1087 +typedef int (init_fnc_t) (void);
1088 +
1089 +static init_fnc_t *init_sequence[] = {
1090 + bootstrap_board_early_init_f,
1091 + timer_init,
1092 + bootstrap_init_baudrate,/* initialze baudrate settings */
1093 +#ifdef CONFIG_BOOTSTRAP_SERIAL
1094 + serial_init, /* serial communications setup */
1095 +#endif
1096 + bootstrap_display_banner, /* say that we are here */
1097 + bootstrap_checkboard,
1098 + bootstrap_init_func_ram,
1099 + NULL,
1100 +};
1101 +
1102 +
1103 +void bootstrap_board_init_f(ulong bootflag)
1104 +{
1105 + gd_t gd_data, *id;
1106 + bd_t *bd;
1107 + init_fnc_t **init_fnc_ptr;
1108 + ulong addr, addr_sp, len = (ulong)&uboot_end - CONFIG_BOOTSTRAP_TEXT_BASE;
1109 + ulong *s;
1110 +
1111 + /* Pointer is writable since we allocated a register for it.
1112 + */
1113 + gd = &gd_data;
1114 + /* compiler optimization barrier needed for GCC >= 3.4 */
1115 + __asm__ __volatile__("": : :"memory");
1116 +
1117 + memset ((void *)gd, 0, sizeof (gd_t));
1118 +
1119 + for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
1120 + if ((*init_fnc_ptr)() != 0) {
1121 + bootstrap_hang ();
1122 + }
1123 + }
1124 +
1125 + /*
1126 + * Now that we have DRAM mapped and working, we can
1127 + * relocate the code and continue running from DRAM.
1128 + */
1129 + addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;
1130 +
1131 + /* We can reserve some RAM "on top" here.
1132 + */
1133 +
1134 + /* round down to next 4 kB limit.
1135 + */
1136 + addr &= ~(4096 - 1);
1137 + debug ("Top of RAM usable for U-Boot at: %08lx\n", addr);
1138 +
1139 + /* Reserve memory for U-Boot code, data & bss
1140 + * round down to next 16 kB limit
1141 + */
1142 + addr -= len;
1143 + addr &= ~(16 * 1024 - 1);
1144 +
1145 + debug ("Reserving %ldk for U-Boot at: %08lx\n", len >> 10, addr);
1146 +
1147 + /* Reserve memory for malloc() arena.
1148 + */
1149 + addr_sp = addr - CONFIG_SYS_MALLOC_LEN;
1150 + debug ("Reserving %dk for malloc() at: %08lx\n",
1151 + CONFIG_SYS_MALLOC_LEN >> 10, addr_sp);
1152 +
1153 + /*
1154 + * (permanently) allocate a Board Info struct
1155 + * and a permanent copy of the "global" data
1156 + */
1157 + addr_sp -= sizeof(bd_t);
1158 + bd = (bd_t *)addr_sp;
1159 + gd->bd = bd;
1160 + debug ("Reserving %zu Bytes for Board Info at: %08lx\n",
1161 + sizeof(bd_t), addr_sp);
1162 +
1163 + addr_sp -= sizeof(gd_t);
1164 + id = (gd_t *)addr_sp;
1165 + debug ("Reserving %zu Bytes for Global Data at: %08lx\n",
1166 + sizeof (gd_t), addr_sp);
1167 +
1168 + /* Reserve memory for boot params.
1169 + */
1170 + addr_sp -= CONFIG_SYS_BOOTPARAMS_LEN;
1171 + bd->bi_boot_params = addr_sp;
1172 + debug ("Reserving %dk for boot params() at: %08lx\n",
1173 + CONFIG_SYS_BOOTPARAMS_LEN >> 10, addr_sp);
1174 +
1175 + /*
1176 + * Finally, we set up a new (bigger) stack.
1177 + *
1178 + * Leave some safety gap for SP, force alignment on 16 byte boundary
1179 + * Clear initial stack frame
1180 + */
1181 + addr_sp -= 16;
1182 + addr_sp &= ~0xF;
1183 + s = (ulong *)addr_sp;
1184 + *s-- = 0;
1185 + *s-- = 0;
1186 + addr_sp = (ulong)s;
1187 + debug ("Stack Pointer at: %08lx\n", addr_sp);
1188 +
1189 + /*
1190 + * Save local variables to board info struct
1191 + */
1192 + bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */
1193 + bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
1194 + bd->bi_baudrate = gd->baudrate; /* Console Baudrate */
1195 +
1196 + memcpy (id, (void *)gd, sizeof (gd_t));
1197 +
1198 + /* On the purple board we copy the code in a special way
1199 + * in order to solve flash problems
1200 + */
1201 + relocate_code (addr_sp, id, addr);
1202 +
1203 + /* NOTREACHED - relocate_code() does not return */
1204 +}
1205 +/************************************************************************
1206 + *
1207 + * This is the next part if the initialization sequence: we are now
1208 + * running from RAM and have a "normal" C environment, i. e. global
1209 + * data can be written, BSS has been cleared, the stack size in not
1210 + * that critical any more, etc.
1211 + *
1212 + ************************************************************************
1213 + */
1214 +
1215 +void bootstrap_board_init_r (gd_t *id, ulong dest_addr)
1216 +{
1217 + extern void malloc_bin_reloc (void);
1218 + extern void copy_and_jump(void);
1219 +
1220 + bd_t *bd;
1221 +
1222 + gd = id;
1223 + gd->flags |= GD_FLG_RELOC; /* tell others: relocation done */
1224 +
1225 + debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
1226 +
1227 + gd->reloc_off = dest_addr - CONFIG_BOOTSTRAP_TEXT_BASE;
1228 +
1229 + bd = gd->bd;
1230 +
1231 + /* The Malloc area is immediately below the monitor copy in DRAM */
1232 + mem_malloc_init(CONFIG_BOOTSTRAP_BASE + gd->reloc_off -
1233 + CONFIG_SYS_MALLOC_LEN, CONFIG_SYS_MALLOC_LEN);
1234 + malloc_bin_reloc();
1235 +
1236 + copy_and_jump();
1237 +
1238 + /* NOTREACHED - no way out of command loop except booting */
1239 +}
1240 +
1241 +void bootstrap_hang (void)
1242 +{
1243 +#ifdef CONFIG_BOOTSTRAP_SERIAL
1244 + puts ("### ERROR ### Please RESET the board ###\n");
1245 +#endif
1246 + for (;;);
1247 +}
1248 --- a/common/Makefile
1249 +++ b/common/Makefile
1250 @@ -24,6 +24,9 @@
1251 include $(TOPDIR)/config.mk
1252
1253 LIB = $(obj)libcommon.a
1254 +BOOTSTRAP_LIB = $(obj)libcommon_bootstrap.a
1255 +
1256 +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
1257
1258 AOBJS =
1259
1260 @@ -168,18 +171,27 @@
1261 COBJS-$(CONFIG_UPDATE_TFTP) += update.o
1262 COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
1263
1264 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += dlmalloc.o
1265 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_SERIAL) += console_bootstrap.o
1266 +
1267 +BOOTSTRAP_COBJS := $(sort $(BOOTSTRAP_COBJS-y))
1268 +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS))
1269 +
1270
1271 COBJS := $(sort $(COBJS-y))
1272 -SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c)
1273 +SRCS := $(AOBJS:.o=.S) $(COBJS:.o=.c) $(BOOTSTRAP_COBJS:.o=.c)
1274 OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS))
1275
1276 CPPFLAGS += -I..
1277
1278 -all: $(LIB) $(AOBJS)
1279 +all: $(LIB) $(BOOTSTRAP_LIB-y) $(AOBJS)
1280
1281 $(LIB): $(obj).depend $(OBJS)
1282 $(AR) $(ARFLAGS) $@ $(OBJS)
1283
1284 +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS)
1285 + $(AR) $(ARFLAGS) $@ $(BOOTSTRAP_OBJS)
1286 +
1287 $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc
1288 $(CC) $(AFLAGS) -Wa,--no-warn \
1289 -DENV_CRC=$(shell $(obj)../tools/envcrc) \
1290 --- /dev/null
1291 +++ b/common/console_bootstrap.c
1292 @@ -0,0 +1,81 @@
1293 +/*
1294 + * (C) Copyright 2000
1295 + * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
1296 + *
1297 + * See file CREDITS for list of people who contributed to this
1298 + * project.
1299 + *
1300 + * This program is free software; you can redistribute it and/or
1301 + * modify it under the terms of the GNU General Public License as
1302 + * published by the Free Software Foundation; either version 2 of
1303 + * the License, or (at your option) any later version.
1304 + *
1305 + * This program is distributed in the hope that it will be useful,
1306 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1307 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1308 + * GNU General Public License for more details.
1309 + *
1310 + * You should have received a copy of the GNU General Public License
1311 + * along with this program; if not, write to the Free Software
1312 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1313 + * MA 02111-1307 USA
1314 + */
1315 +
1316 +#include <common.h>
1317 +#include <stdarg.h>
1318 +#include <malloc.h>
1319 +
1320 +/** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/
1321 +
1322 +int getc(void)
1323 +{
1324 + /* Send directly to the handler */
1325 + return serial_getc();
1326 +}
1327 +
1328 +int tstc(void)
1329 +{
1330 + /* Send directly to the handler */
1331 + return serial_tstc();
1332 +}
1333 +
1334 +void putc(const char c)
1335 +{
1336 + /* Send directly to the handler */
1337 + serial_putc(c);
1338 +}
1339 +
1340 +void puts(const char *s)
1341 +{
1342 + serial_puts(s);
1343 +}
1344 +
1345 +void printf(const char *fmt, ...)
1346 +{
1347 + va_list args;
1348 + char printbuffer[CONFIG_SYS_PBSIZE];
1349 +
1350 + va_start(args, fmt);
1351 +
1352 + /* For this to work, printbuffer must be larger than
1353 + * anything we ever want to print.
1354 + */
1355 + vsprintf(printbuffer, fmt, args);
1356 + va_end(args);
1357 +
1358 + /* Print the string */
1359 + puts(printbuffer);
1360 +}
1361 +
1362 +void vprintf(const char *fmt, va_list args)
1363 +{
1364 + char printbuffer[CONFIG_SYS_PBSIZE];
1365 +
1366 + /* For this to work, printbuffer must be larger than
1367 + * anything we ever want to print.
1368 + */
1369 + vsprintf(printbuffer, fmt, args);
1370 +
1371 + /* Print the string */
1372 + puts(printbuffer);
1373 +}
1374 --- a/config.mk
1375 +++ b/config.mk
1376 @@ -136,7 +136,7 @@
1377 ARFLAGS = crv
1378 endif
1379 RELFLAGS= $(PLATFORM_RELFLAGS)
1380 -DBGFLAGS= -g # -DDEBUG
1381 +DBGFLAGS= -g
1382 OPTFLAGS= -Os #-fomit-frame-pointer
1383 ifndef LDSCRIPT
1384 #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
1385 @@ -146,6 +146,11 @@
1386 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
1387 endif
1388 endif
1389 +ifeq ($(CONFIG_BOOTSTRAP),y)
1390 +ifndef BOOTSTRAP_LDSCRIPT
1391 +BOOTSTRAP_LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
1392 +endif
1393 +endif
1394 OBJCFLAGS += --gap-fill=0xff
1395
1396 gccincdir := $(shell $(CC) -print-file-name=include)
1397 @@ -156,6 +161,10 @@
1398 CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
1399 endif
1400
1401 +ifneq ($(CONFIG_BOOTSTRAP_TEXT_BASE),)
1402 +CPPFLAGS += -DCONFIG_BOOTSTRAP_TEXT_BASE=$(CONFIG_BOOTSTRAP_TEXT_BASE)
1403 +endif
1404 +
1405 ifneq ($(RESET_VECTOR_ADDRESS),)
1406 CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS)
1407 endif
1408 @@ -176,6 +185,7 @@
1409 endif
1410
1411 CFLAGS += $(call cc-option,-fno-stack-protector)
1412 +CFLAGS += $(call cc-option,-ffunction-sections)
1413
1414 # avoid trigraph warnings while parsing pci.h (produced by NIOS gcc-2.9)
1415 # this option have to be placed behind -Wall -- that's why it is here
1416 @@ -203,6 +213,13 @@
1417 LDFLAGS += -Ttext $(TEXT_BASE)
1418 endif
1419
1420 +ifeq ($(CONFIG_BOOTSTRAP),y)
1421 +BOOTSTRAP_LDFLAGS += -Bstatic -T $(obj)u-boot-bootstrap.lds $(PLATFORM_LDFLAGS)
1422 +ifneq ($(CONFIG_BOOTSTRAP_TEXT_BASE),)
1423 +BOOTSTRAP_LDFLAGS += -Ttext $(CONFIG_BOOTSTRAP_TEXT_BASE)
1424 +endif
1425 +endif
1426 +
1427 # Location of a usable BFD library, where we define "usable" as
1428 # "built for ${HOST}, supports ${TARGET}". Sensible values are
1429 # - When cross-compiling: the root of the cross-environment
1430 --- a/include/common.h
1431 +++ b/include/common.h
1432 @@ -722,6 +722,27 @@
1433 int cpu_release(int nr, int argc, char *argv[]);
1434 #endif
1435
1436 +/* Bootstrap specific code */
1437 +#ifdef CONFIG_BOOTSTRAP
1438 +void bootstrap_hang(void) __attribute__ ((noreturn));
1439 +void bootstrap_board_init_f(ulong) __attribute__ ((noreturn));
1440 +void bootstrap_board_init_r(gd_t *, ulong) __attribute__ ((noreturn));
1441 +int bootstrap_checkboard(void);
1442 +
1443 +int bootstrap_serial_init(void);
1444 +void bootstrap_serial_exit(void);
1445 +void bootstrap_serial_setbrg(void);
1446 +void bootstrap_serial_putc(const char);
1447 +void bootstrap_serial_putc_raw(const char);
1448 +void bootstrap_serial_puts(const char *);
1449 +int bootstrap_serial_getc(void);
1450 +int bootstrap_serial_tstc(void);
1451 +
1452 +phys_size_t bootstrap_initdram (int);
1453 +
1454 +int copy_uboot(void *dst, size_t unc_size, void *src, size_t size);
1455 +#endif
1456 +
1457 #endif /* __ASSEMBLY__ */
1458
1459 /* Put only stuff here that the assembler can digest */
1460 --- a/lib_generic/Makefile
1461 +++ b/lib_generic/Makefile
1462 @@ -24,6 +24,9 @@
1463 include $(TOPDIR)/config.mk
1464
1465 LIB = $(obj)libgeneric.a
1466 +BOOTSTRAP_LIB = $(obj)libgeneric_bootstrap.a
1467 +
1468 +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
1469
1470 COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
1471 COBJS-$(CONFIG_BZIP2) += bzlib.o
1472 @@ -50,14 +53,37 @@
1473 COBJS-y += vsprintf.o
1474 COBJS-$(CONFIG_ZLIB) += zlib.o
1475 COBJS-$(CONFIG_RBTREE) += rbtree.o
1476 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += string.o
1477 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += vsprintf.o
1478 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += div64.o
1479 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += ctype.o
1480 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += time.o
1481 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += bootstrap.o
1482 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += zlib.o
1483 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += gunzip.o
1484 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_GZIP) += crc32.o
1485 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib.o
1486 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_crctable.o
1487 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_decompress.o
1488 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_randtable.o
1489 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_BZIP2) += bzlib_huffman.o
1490 +
1491 +BOOTSTRAP_COBJS := $(BOOTSTRAP_COBJS-y)
1492 +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS))
1493
1494 COBJS := $(COBJS-y)
1495 -SRCS := $(COBJS:.o=.c)
1496 +SRCS := $(COBJS:.o=.c) $(BOOTSTRAP_COBJS:.o=.c)
1497 OBJS := $(addprefix $(obj),$(COBJS))
1498
1499 +all: $(obj).depend $(LIB) $(BOOTSTRAP_LIB-y)
1500 +
1501 $(LIB): $(obj).depend $(OBJS)
1502 $(AR) $(ARFLAGS) $@ $(OBJS)
1503
1504 +$(BOOTSTRAP_LIB): $(obj).depend $(BOOTSTRAP_OBJS)
1505 + $(AR) $(ARFLAGS) $@ $(BOOTSTRAP_OBJS)
1506 +
1507 +
1508 #########################################################################
1509
1510 # defines $(obj).depend target
1511 --- /dev/null
1512 +++ b/lib_generic/bootstrap.c
1513 @@ -0,0 +1,95 @@
1514 +/*
1515 + * (C) Copyright 2010 Industrie Dial Face S.p.A.
1516 + * Luigi 'Comio' Mantellini, luigi.mantellini@idf-hit.com
1517 + *
1518 + * (C) Copyright 2003
1519 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
1520 + *
1521 + * See file CREDITS for list of people who contributed to this
1522 + * project.
1523 + *
1524 + * This program is free software; you can redistribute it and/or
1525 + * modify it under the terms of the GNU General Public License as
1526 + * published by the Free Software Foundation; either version 2 of
1527 + * the License, or (at your option) any later version.
1528 + *
1529 + * This program is distributed in the hope that it will be useful,
1530 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1531 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1532 + * GNU General Public License for more details.
1533 + *
1534 + * You should have received a copy of the GNU General Public License
1535 + * along with this program; if not, write to the Free Software
1536 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1537 + * MA 02111-1307 USA
1538 + */
1539 +
1540 +#include <common.h>
1541 +#include <command.h>
1542 +#include <stdio_dev.h>
1543 +
1544 +#ifdef CONFIG_BOOTSTRAP_LZMA
1545 +#include <lzma/LzmaTypes.h>
1546 +#include <lzma/LzmaDec.h>
1547 +#include <lzma/LzmaTools.h>
1548 +#endif /* CONFIG_BOOTSTRAP_LZMA */
1549 +
1550 +#ifdef CONFIG_BOOTSTRAP_LZO
1551 +#include <linux/lzo.h>
1552 +#endif /* CONFIG_BOOTSTRAP_LZO */
1553 +
1554 +#ifdef CONFIG_BOOTSTRAP_BZIP2
1555 +#include <bzlib.h>
1556 +#endif
1557 +
1558 +DECLARE_GLOBAL_DATA_PTR;
1559 +
1560 +#if defined(CONFIG_BOOTSTRAP_SERIAL)
1561 +static const char *algo =
1562 +#if defined(CONFIG_BOOTSTRAP_GZIP)
1563 + "gzip";
1564 +#elif defined(CONFIG_BOOTSTRAP_LZMA)
1565 + "lzma";
1566 +#elif defined(CONFIG_BOOTSTRAP_LZO)
1567 + "lzo";
1568 +#elif defined(CONFIG_BOOTSTRAP_BZIP2)
1569 + "bzip2";
1570 +#else
1571 + "flat";
1572 +#endif
1573 +#endif
1574 +
1575 +int copy_uboot(void *dst, size_t unc_size, void *src, size_t size)
1576 +{
1577 + int ret;
1578 + debug("copy from %p (%d) to %p (%d)\n", src, size, dst, unc_size);
1579 +#if defined(CONFIG_BOOTSTRAP_SERIAL)
1580 + printf("Uncompressing payload (%s)...", algo);
1581 +#endif
1582 +#if defined(CONFIG_BOOTSTRAP_GZIP)
1583 + ret = gunzip(dst, unc_size, src, &size);
1584 +#elif defined(CONFIG_BOOTSTRAP_LZMA)
1585 + SizeT outsize = unc_size;
1586 + ret = lzmaBuffToBuffDecompress(dst, &outsize, src, size);
1587 +#elif defined(CONFIG_BOOTSTRAP_LZO)
1588 + uint unc_len = unc_size;
1589 + ret = lzop_decompress(src, size, dst, &unc_len);
1590 +#elif defined(CONFIG_BOOTSTRAP_BZIP2)
1591 + uint unc_len = unc_size;
1592 + ret = BZ2_bzBuffToBuffDecompress ((char*)dst, &unc_len, (char *)src, size, CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
1593 +#else
1594 + memcpy(dst, src, size);
1595 + ret = 0;
1596 +#endif
1597 + if (ret) {
1598 +#if defined(CONFIG_BOOTSTRAP_SERIAL)
1599 + printf("failed with error %d.\n", ret);
1600 +#endif
1601 + bootstrap_hang();
1602 + } else {
1603 +#if defined(CONFIG_BOOTSTRAP_SERIAL)
1604 + puts("done.\n");
1605 +#endif
1606 + }
1607 + return ret;
1608 +}
1609 --- a/lib_generic/lzma/Makefile
1610 +++ b/lib_generic/lzma/Makefile
1611 @@ -32,7 +32,9 @@
1612
1613 CFLAGS += -D_LZMA_PROB32
1614
1615 -COBJS-$(CONFIG_LZMA) += LzmaDec.o LzmaTools.o
1616 +COBJS-$(CONFIG_LZMA)$(CONFIG_BOOTSTRAP_LZMA) += LzmaDec.o LzmaTools.o
1617 +
1618 +COBJS-y += $(COBJS-yy)
1619
1620 COBJS = $(COBJS-y)
1621 SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
1622 --- a/lib_generic/lzo/Makefile
1623 +++ b/lib_generic/lzo/Makefile
1624 @@ -27,7 +27,9 @@
1625
1626 SOBJS =
1627
1628 -COBJS-$(CONFIG_LZO) += lzo1x_decompress.o
1629 +COBJS-$(CONFIG_LZO)$(CONFIG_BOOTSTRAP_LZO) += lzo1x_decompress.o
1630 +
1631 +COBJS-y += $(OBJS-yy)
1632
1633 COBJS = $(COBJS-y)
1634 SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
1635 --- a/cpu/mips/Makefile
1636 +++ b/cpu/mips/Makefile
1637 @@ -24,25 +24,46 @@
1638 include $(TOPDIR)/config.mk
1639
1640 LIB = $(obj)lib$(CPU).a
1641 +BOOTSTRAP_LIB = $(obj)lib$(CPU)_bootstrap.a
1642 +
1643 +BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
1644
1645 START = start.o
1646 SOBJS-y = cache.o
1647 -COBJS-y = cpu.o interrupts.o
1648 +COBJS-y = cpu.o reset.o interrupts.o
1649
1650 SOBJS-$(CONFIG_INCA_IP) += incaip_wdt.o
1651 COBJS-$(CONFIG_INCA_IP) += asc_serial.o incaip_clock.o
1652 +#COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o
1653 COBJS-$(CONFIG_PURPLE) += asc_serial.o
1654 COBJS-$(CONFIG_SOC_AU1X00) += au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o
1655
1656 -SRCS := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
1657 +#BOOTSTRAP_START = start_bootstrap.o
1658 +BOOTSTRAP_START-$(CONFIG_BOOTSTRAP) += start_bootstrap.o #$(BOOTSTRAP_START)
1659 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += cpu.o interrupts.o reset_bootstrap.o
1660 +BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) += cache.o
1661 +BOOTSTRAP_COBJS-$(CONFIG_DANUBE) += danube-clock.o
1662 +BOOTSTRAP_COBJS-$(CONFIG_AR9) += ar9-clock.o
1663 +BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP_SERIAL) += ifx_asc.o
1664 +
1665 +BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y))
1666 +BOOTSTRAP_START := $(addprefix $(obj),$(BOOTSTRAP_START-y))
1667 +
1668 +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) $(BOOTSTRAP_START-y:.o=.S) $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c)
1669 OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
1670 START := $(addprefix $(obj),$(START))
1671
1672 -all: $(obj).depend $(START) $(LIB)
1673 +all: $(obj).depend $(START) $(LIB) $(BOOTSTRAP_START-y) $(BOOTSTRAP_LIB-y)
1674
1675 -$(LIB): $(OBJS)
1676 +$(LIB): $(OBJS)
1677 $(AR) $(ARFLAGS) $@ $(OBJS)
1678
1679 +#$(BOOTSTRAP_START): $(obj).depend
1680 +
1681 +$(BOOTSTRAP_LIB): $(BOOTSTRAP_OBJS)
1682 + $(AR) $(ARFLAGS) $@ $(BOOTSTRAP_OBJS)
1683 +
1684 +
1685 #########################################################################
1686
1687 # defines $(obj).depend target
This page took 0.12341 seconds and 5 git commands to generate.