From patchwork Tue Jul 9 09:50:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ying.zhang@freescale.com X-Patchwork-Id: 257705 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 99F4E2C0084 for ; Tue, 9 Jul 2013 21:35:14 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A1814A16C; Tue, 9 Jul 2013 13:35:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J3pD86miUeMe; Tue, 9 Jul 2013 13:35:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B78274A120; Tue, 9 Jul 2013 13:34:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 65C5D4A3AB for ; Tue, 9 Jul 2013 12:44:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qqmUMUPUix35 for ; Tue, 9 Jul 2013 12:44:03 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from ch1outboundpool.messaging.microsoft.com (ch1ehsobe003.messaging.microsoft.com [216.32.181.183]) by theia.denx.de (Postfix) with ESMTPS id 883644A3AE for ; Tue, 9 Jul 2013 12:43:54 +0200 (CEST) Received: from mail110-ch1-R.bigfish.com (10.43.68.239) by CH1EHSOBE009.bigfish.com (10.43.70.59) with Microsoft SMTP Server id 14.1.225.22; Tue, 9 Jul 2013 10:43:51 +0000 Received: from mail110-ch1 (localhost [127.0.0.1]) by mail110-ch1-R.bigfish.com (Postfix) with ESMTP id 9E611420130; Tue, 9 Jul 2013 10:43:51 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zz8b9ckzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e23h1155h) Received: from mail110-ch1 (localhost.localdomain [127.0.0.1]) by mail110-ch1 (MessageSwitch) id 1373366629684013_23775; Tue, 9 Jul 2013 10:43:49 +0000 (UTC) Received: from CH1EHSMHS032.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.245]) by mail110-ch1.bigfish.com (Postfix) with ESMTP id A27203E0045; Tue, 9 Jul 2013 10:43:49 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS032.bigfish.com (10.43.70.32) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 9 Jul 2013 10:43:48 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.3.136.1; Tue, 9 Jul 2013 10:45:58 +0000 Received: from localhost.localdomain (tank.ap.freescale.net [10.193.20.104]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r69AhSbW006581; Tue, 9 Jul 2013 03:43:45 -0700 From: To: Date: Tue, 9 Jul 2013 17:50:49 +0800 Message-ID: <1373363450-16932-6-git-send-email-ying.zhang@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1373363450-16932-1-git-send-email-ying.zhang@freescale.com> References: <1373363450-16932-1-git-send-email-ying.zhang@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Mailman-Approved-At: Tue, 09 Jul 2013 13:34:39 +0200 Cc: scottwood@freescale.com, afleming@gmail.com, X.Xie@freescale.com, Ying Zhang Subject: [U-Boot] [PATCH 6/7 v7] NAND: TPL : introduce the TPL based on the SPL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Ying Zhang 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 This patch is on top of the patch: SPL: Makefile: Build a separate autoconf.mk for SPL Signed-off-by: Ying Zhang --- Change from v6: - Modify the description of the patch. - Add the separate the autoconf.mk for TPL. - Delete the file tpl/Makefile and the directory tpl. - Reuse the spl/Makefie in TPL. Change from v5: - Use ifdef to define "nand_load_image" to non-static for non-SPL. Change from v4: - No change. Change from v3: - No change. Change from v2: - No change. Change from v1: - Split from "powerpc/p1022ds: nand: introduce the TPL based on the SPL". Makefile | 43 ++++++++++++++++++++++-- README | 9 +++++ config.mk | 17 +++++++++ doc/README.TPL | 69 +++++++++++++++++++++++++++++++++++++++ drivers/mtd/nand/Makefile | 8 ++++ drivers/mtd/nand/fsl_elbc_spl.c | 5 ++- include/nand.h | 3 ++ spl/Makefile | 37 ++++++++++++++++++++- 8 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 doc/README.TPL diff --git a/Makefile b/Makefile index 7de687c..e3b7a1b 100644 --- a/Makefile +++ b/Makefile @@ -413,6 +413,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin +ALL-$(CONFIG_TPL) += $(obj)spl/u-boot-tpl.bin ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin ifneq ($(CONFIG_SPL_TARGET),) ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET)) @@ -492,12 +493,25 @@ $(obj)u-boot.dis: $(obj)u-boot $(OBJDUMP) -d $< > $@ - +ifdef CONFIG_TPL +$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-tpl.bin \ + $(obj)u-boot.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \ + -I binary -O binary \ + $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl-pad.bin + $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \ + -I binary -O binary \ + $(obj)spl/u-boot-tpl.bin $(obj)spl/u-boot-tpl-pad.bin + cat $(obj)spl/u-boot-spl-pad.bin $(obj)spl/u-boot-tpl-pad.bin \ + $(obj)u-boot.bin > $@ +# rm $(obj)spl/u-boot-spl-pad.bin $(obj)spl/u-boot-tpl-pad.bin +else $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \ -I binary -O binary $< $(obj)spl/u-boot-spl-pad.bin cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@ rm $(obj)spl/u-boot-spl-pad.bin +endif $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(MAKE) -C $(SRCTREE)/arch/arm/imx-common \ @@ -621,7 +635,12 @@ $(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin $(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend - $(MAKE) -C spl all + $(MAKE) -C spl clean + $(MAKE) -C spl all CONFIG_SPL_BUILD=y + +$(obj)spl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend + $(MAKE) -C spl clean + $(MAKE) -C spl all CONFIG_TPL_BUILD=y CONFIG_SPL_BUILD=y updater: $(MAKE) -C tools/updater all @@ -630,6 +649,7 @@ updater: # parallel sub-makes creating .depend files simultaneously. depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk \ $(obj)include/autoconf.mk \ $(obj)include/generated/generic-asm-offsets.h \ $(obj)include/generated/asm-offsets.h @@ -705,6 +725,15 @@ $(obj)include/autoconf.mk: $(obj)include/config.h sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ mv $@.tmp $@ # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) +$(obj)include/tpl-autoconf.mk: $(obj)include/config.h + @$(XECHO) Generating $@ ; \ + set -e ; \ + : Extract the config macros ; \ + $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\ + -DDO_DEPS_ONLY -dM include/common.h | \ + sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ + mv $@.tmp $@ + $(obj)include/spl-autoconf.mk: $(obj)include/config.h @$(XECHO) Generating $@ ; \ set -e ; \ @@ -715,12 +744,14 @@ $(obj)include/spl-autoconf.mk: $(obj)include/config.h $(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk \ $(obj)lib/asm-offsets.s @$(XECHO) Generating $@ tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk \ $(src)lib/asm-offsets.c @mkdir -p $(obj)lib $(CC) -DDO_DEPS_ONLY \ @@ -729,12 +760,14 @@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ $(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \ $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk \ $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s @$(XECHO) Generating $@ tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@ $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep \ - $(obj)include/spl-autoconf.mk + $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk @mkdir -p $(obj)$(CPUDIR)/$(SOC) if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ $(CC) -DDO_DEPS_ONLY \ @@ -807,7 +840,8 @@ unconfig: @rm -f $(obj)include/config.h $(obj)include/config.mk \ $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ - $(obj)include/spl-autoconf.mk + $(obj)include/spl-autoconf.mk \ + $(obj)include/tpl-autoconf.mk %_config:: unconfig @$(MKCONFIG) -A $(@:_config=) @@ -893,6 +927,7 @@ clobber: tidy @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map} @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map} @rm -f $(obj)spl/u-boot-spl.lds + @rm -f $(obj)spl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map} @rm -f $(obj)MLO MLO.byteswap @rm -f $(obj)SPL @rm -f $(obj)tools/xway-swap-bytes diff --git a/README b/README index 5872b5e..753975f 100644 --- a/README +++ b/README @@ -3100,6 +3100,10 @@ FIT uImage format: option to re-enable it. This will affect the output of the bootm command when booting a FIT image. +- TPL framework + CONFIG_TPL + Enable building of TPL globally. + Modem Support: -------------- @@ -4137,6 +4141,11 @@ Low Level (hardware related) configuration options: that is executed before the actual U-Boot. E.g. when compiling a NAND SPL. +- CONFIG_TPL_BUILD + Modifies the behaviour of start.S when compiling a loader + that is executed after the SPL and before the actual U-Boot. + It is loaded by the SPL. + - CONFIG_SYS_MPC85XX_NO_RESETVEC Only for 85xx systems. If this variable is specified, the section .resetvec is not kept and the section .bootpg is placed in the diff --git a/config.mk b/config.mk index f42b655..6c0976d 100644 --- a/config.mk +++ b/config.mk @@ -161,6 +161,10 @@ CHECK = sparse ######################################################################### # Load generated board configuration +ifeq ($(CONFIG_TPL_BUILD),y) +# Include TPL autoconf +sinclude $(OBJTREE)/include/tpl-autoconf.mk +else ifeq ($(CONFIG_SPL_BUILD),y) # Include SPL autoconf sinclude $(OBJTREE)/include/spl-autoconf.mk @@ -168,6 +172,7 @@ else # Include normal autoconf sinclude $(OBJTREE)/include/autoconf.mk endif +endif sinclude $(OBJTREE)/include/config.mk # Some architecture config.mk files need to know what CPUDIR is set to, @@ -239,6 +244,9 @@ endif ifeq ($(CONFIG_SPL_BUILD),y) CPPFLAGS += -DCONFIG_SPL_BUILD +ifeq ($(CONFIG_TPL_BUILD),y) +CPPFLAGS += -DCONFIG_TPL_BUILD +endif endif # Does this architecture support generic board init? @@ -310,10 +318,19 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) endif +ifeq ($(CONFIG_TPL_BUILD),y) +LDFLAGS_u-boot-tpl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL) +ifneq ($(CONFIG_SPL_TEXT_BASE),) +LDFLAGS_u-boot-tpl += -Ttext $(CONFIG_SPL_TEXT_BASE) +endif +else +ifeq ($(CONFIG_SPL_BUILD),y) LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL) ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE) endif +endif +endif # Linus' kernel sanity checking tool CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ diff --git a/doc/README.TPL b/doc/README.TPL new file mode 100644 index 0000000..dc135af --- /dev/null +++ b/doc/README.TPL @@ -0,0 +1,69 @@ +Generic TPL framework +===================== + +Overview +-------- + +Due to the SPL on some boards(powerpc mpc85xx) has a size limit and cannot +be compatible with all the external device(e.g. DDR). So add a tertiary +program loader (TPL) to enable a loader stub that runs in the L2 SRAM, +after being loaded by the code from the SPL. It loads the final uboot image +into DDR, then jump to it to begin execution. Now, only the powerpc mpc85xx +has this requirement and will implemente it. + +Keep consistent with SPL, with this framework almost all source files for a +board can be reused. No code duplication or symlinking is necessary anymore. + +How it works +------------ + +There is a new directory TOPDIR/tpl which contains only a Makefile. +The object files are built separately for TPL and placed in this directory. +The final binaries which are generated are u-boot-tpl, u-boot-tpl.bin and +u-boot-tpl.map. + +During the TPL build a variable named CONFIG_TPL_BUILD is exported +in the make environment and also appended to CPPFLAGS with -DCONFIG_TPL_BUILD. +Source files can therefore be compiled for TPL with different settings. + +For example: + +ifeq ($(CONFIG_TPL_BUILD),y) +COBJS-y += board_tpl.o +else +COBJS-y += board.o +endif + +COBJS-$(CONFIG_TPL_BUILD) += foo.o + +#ifdef CONFIG_TPL_BUILD + foo(); +#endif + + +The building of TPL images can be with: + +#define CONFIG_TPL + +Because TPL images normally have a different text base, one has to be +configured by defining CONFIG_TPL_TEXT_BASE. The linker script has to be +defined with CONFIG_TPL_LDSCRIPT. + +To support generic U-Boot libraries and drivers in the TPL binary one can +optionally define CONFIG_SYS_XXX_SUPPORT. Currently following options +are supported: + +CONFIG_SYS_LIBCOMMON_SUPPORT (common/libcommon.o) +CONFIG_SYS_LIBDISK_SUPPORT (disk/libdisk.o) +CONFIG_SYS_I2C_SUPPORT (drivers/i2c/libi2c.o) +CONFIG_SYS_GPIO_SUPPORT (drivers/gpio/libgpio.o) +CONFIG_SYS_MMC_SUPPORT (drivers/mmc/libmmc.o) +CONFIG_SYS_SERIAL_SUPPORT (drivers/serial/libserial.o) +CONFIG_SYS_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o) +CONFIG_SYS_SPI_SUPPORT (drivers/spi/libspi.o) +CONFIG_SYS_FAT_SUPPORT (fs/fat/libfat.o) +CONFIG_SYS_LIBGENERIC_SUPPORT (lib/libgeneric.o) +CONFIG_SYS_POWER_SUPPORT (drivers/power/libpower.o) +CONFIG_SYS_NAND_SUPPORT (drivers/mtd/nand/libnand.o) +CONFIG_SYS_DMA_SUPPORT (drivers/dma/libdma.o) +CONFIG_SYS_POST_MEM_SUPPORT (post/drivers/memory.o) diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index bb81e84..6507fcf 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -29,6 +29,8 @@ ifdef CONFIG_CMD_NAND ifdef CONFIG_SPL_BUILD +ifndef CONFIG_TPL_BUILD + ifdef CONFIG_SPL_NAND_DRIVERS NORMAL_DRIVERS=y endif @@ -40,6 +42,10 @@ COBJS-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o COBJS-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o COBJS-$(CONFIG_SPL_NAND_BASE) += nand_base.o +else +COBJS-y += nand.o +endif + else # not spl NORMAL_DRIVERS=y @@ -82,9 +88,11 @@ COBJS-$(CONFIG_NAND_DOCG4) += docg4.o else # minimal SPL drivers +ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o COBJS-$(CONFIG_NAND_MXC) += mxc_nand_spl.o +endif endif # drivers endif # nand diff --git a/drivers/mtd/nand/fsl_elbc_spl.c b/drivers/mtd/nand/fsl_elbc_spl.c index 50ff4fe..d00a13a 100644 --- a/drivers/mtd/nand/fsl_elbc_spl.c +++ b/drivers/mtd/nand/fsl_elbc_spl.c @@ -47,7 +47,10 @@ static void nand_wait(void) } } -static int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) +#ifndef CONFIG_TPL_BUILD +static +#endif +int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst) { fsl_lbc_t *regs = LBC_BASE_ADDR; uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE; diff --git a/include/nand.h b/include/nand.h index 228d871..2aa7238 100644 --- a/include/nand.h +++ b/include/nand.h @@ -153,6 +153,9 @@ int nand_unlock(nand_info_t *meminfo, loff_t start, size_t length, int nand_get_lock_status(nand_info_t *meminfo, loff_t offset); int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst); +#ifdef CONFIG_TPL_BUILD +int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst); +#endif void nand_deselect(void); #ifdef CONFIG_SYS_NAND_SELECT_DEVICE diff --git a/spl/Makefile b/spl/Makefile index eef8c87..efdfe1a 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -15,14 +15,24 @@ # Based on top-level Makefile. # -CONFIG_SPL_BUILD := y +ifeq ($(CONFIG_SPL_BUILD),y) export CONFIG_SPL_BUILD +endif +ifeq ($(CONFIG_TPL_BUILD),y) +export CONFIG_TPL_BUILD +endif include $(TOPDIR)/config.mk # We want the final binaries in this directory obj := $(OBJTREE)/spl/ +clean: + @find $(obj) -type f \ + \( -name 'core' -o -name '*.bak' -o -name '*~' \ + -o -name '*.o' -o -name '*.a' \) -print \ + | xargs rm -f + HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(SRCTREE)/board/$(VENDOR)/common/Makefile),y,n) ifdef CONFIG_SPL_START_S_PATH @@ -150,6 +160,7 @@ LDPPFLAGS += \ $(shell $(LD) --version | \ sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') +ifndef CONFIG_TPL_BUILD $(OBJTREE)/MLO: $(obj)u-boot-spl.bin $(OBJTREE)/tools/mkimage -T omapimage \ -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ @@ -162,6 +173,17 @@ $(OBJTREE)/SPL : $(obj)u-boot-spl.bin depend $(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@ ALL-y += $(obj)u-boot-spl.bin +else +$(OBJTREE)/MLO: $(obj)u-boot-tpl.bin + $(OBJTREE)/tools/mkimage -T omapimage \ + -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ + +$(OBJTREE)/MLO.byteswap: $(obj)u-boot-tpl.bin + $(OBJTREE)/tools/mkimage -T omapimage -n byteswap \ + -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ + +ALL-y += $(obj)u-boot-tpl.bin +endif ifdef CONFIG_SAMSUNG ALL-y += $(obj)$(BOARD)-spl.bin @@ -175,6 +197,7 @@ $(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin $(obj)u-boot-spl.bin $(obj)$(BOARD)-spl.bin endif +ifndef CONFIG_TPL_BUILD $(obj)u-boot-spl.bin: $(obj)u-boot-spl $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@ @@ -185,6 +208,18 @@ GEN_UBOOT = \ $(obj)u-boot-spl: depend $(START) $(LIBS) $(obj)u-boot-spl.lds $(GEN_UBOOT) +else +$(obj)u-boot-tpl.bin: $(obj)u-boot-tpl + $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@ + +GEN_UBOOT = \ + cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \ + --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ + -Map u-boot-tpl.map -o u-boot-tpl + +$(obj)u-boot-tpl: depend $(START) $(LIBS) $(obj)u-boot-spl.lds + $(GEN_UBOOT) +endif $(START): depend $(MAKE) -C $(SRCTREE)/$(START_PATH) $@