TPL : introduce the TPL based on the SPL
Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that is loaded
by the code from the SPL. It initializes the DDR with the SPD or other
operations.
The TPL's size is sizeable, the maximum size is decided by the memory's
size that TPL runs. It initializes the DDR through SPD code, and copys
final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image
Signed-off-by: Ying Zhang <b40530@freescale.com>
Acked-by: York Sun <yorksun@freescale.com>
diff --git a/spl/Makefile b/spl/Makefile
index a9a8564..339e5e8 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -17,10 +17,22 @@
CONFIG_SPL_BUILD := y
export CONFIG_SPL_BUILD
+ifeq ($(CONFIG_TPL_BUILD),y)
+export CONFIG_TPL_BUILD
+SPL_BIN := u-boot-tpl
+else
+SPL_BIN := u-boot-spl
+endif
+
include $(TOPDIR)/config.mk
# We want the final binaries in this directory
+ifeq ($(CONFIG_TPL_BUILD),y)
+obj := $(OBJTREE)/tpl/
+SPLTREE := $(TPLTREE)
+else
obj := $(OBJTREE)/spl/
+endif
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(SRCTREE)/board/$(VENDOR)/common/Makefile),y,n)
@@ -161,7 +173,7 @@
$(OBJTREE)/SPL : $(obj)u-boot-spl.bin depend
$(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@
-ALL-y += $(obj)u-boot-spl.bin
+ALL-y += $(obj)$(SPL_BIN).bin
ifdef CONFIG_SAMSUNG
ALL-y += $(obj)$(BOARD)-spl.bin
@@ -175,15 +187,15 @@
$(obj)u-boot-spl.bin $(obj)$(BOARD)-spl.bin
endif
-$(obj)u-boot-spl.bin: $(obj)u-boot-spl
+$(obj)$(SPL_BIN).bin: $(obj)$(SPL_BIN)
$(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
GEN_UBOOT = \
cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
- -Map u-boot-spl.map -o u-boot-spl
+ -Map $(SPL_BIN).map -o $(SPL_BIN)
-$(obj)u-boot-spl: depend $(START) $(LIBS) $(obj)u-boot-spl.lds
+$(obj)$(SPL_BIN): depend $(START) $(LIBS) $(obj)u-boot-spl.lds
$(GEN_UBOOT)
$(START): depend