From patchwork Thu Jun 2 19:34:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew McClintock X-Patchwork-Id: 98474 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 D7E6EB6FAF for ; Fri, 3 Jun 2011 05:35:34 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 111D928135; Thu, 2 Jun 2011 21:35:31 +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 H6ufFwXOEAgg; Thu, 2 Jun 2011 21:35:30 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D71C22810F; Thu, 2 Jun 2011 21:35:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 290E528103 for ; Thu, 2 Jun 2011 21:35:18 +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 mGZ+y9d7pxGA for ; Thu, 2 Jun 2011 21:35:14 +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 CH1EHSOBE003.bigfish.com (ch1ehsobe003.messaging.microsoft.com [216.32.181.183]) by theia.denx.de (Postfix) with ESMTPS id 09D96280E6 for ; Thu, 2 Jun 2011 21:35:10 +0200 (CEST) Received: from mail51-ch1-R.bigfish.com (216.32.181.169) by CH1EHSOBE003.bigfish.com (10.43.70.53) with Microsoft SMTP Server id 14.1.225.22; Thu, 2 Jun 2011 19:35:06 +0000 Received: from mail51-ch1 (localhost.localdomain [127.0.0.1]) by mail51-ch1-R.bigfish.com (Postfix) with ESMTP id CF20913500E6 for ; Thu, 2 Jun 2011 19:35:06 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1082kzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail51-ch1 (localhost.localdomain [127.0.0.1]) by mail51-ch1 (MessageSwitch) id 1307043306126192_26928; Thu, 2 Jun 2011 19:35:06 +0000 (UTC) Received: from CH1EHSMHS033.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.241]) by mail51-ch1.bigfish.com (Postfix) with ESMTP id 12584110004B for ; Thu, 2 Jun 2011 19:35:06 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS033.bigfish.com (10.43.70.33) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 2 Jun 2011 19:35:05 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.289.8; Thu, 2 Jun 2011 14:35:04 -0500 Received: from right.am.freescale.net (right.am.freescale.net [10.82.193.13]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p52JZ3b7022211 for ; Thu, 2 Jun 2011 14:35:04 -0500 (CDT) Received: from right.am.freescale.net (localhost.localdomain [127.0.0.1]) by right.am.freescale.net (8.14.4/8.14.4) with ESMTP id p52JZ3lR011300; Thu, 2 Jun 2011 14:35:03 -0500 Received: (from mattsm@localhost) by right.am.freescale.net (8.14.4/8.14.4/Submit) id p52JZ3jW011299; Thu, 2 Jun 2011 14:35:03 -0500 From: Matthew McClintock To: Date: Thu, 2 Jun 2011 14:34:59 -0500 Message-ID: <1307043300-11253-3-git-send-email-msm@freescale.com> X-Mailer: git-send-email 1.7.5 In-Reply-To: <1307043300-11253-1-git-send-email-msm@freescale.com> References: <1307043300-11253-1-git-send-email-msm@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.net Cc: Matthew McClintock Subject: [U-Boot] [PATCH 3/4] nand_spl/spiboot/sdboot: Add ability to have smaller middle loader X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 This patch allows some boards do define CONFIG_BOOTSTRAP to let them build a MPL or middle program loader to setup the board before booting to the full u-boot build. The advantage is that we are using the same build system and linker scripts that would be used in a normal u-boot build. This is used on powerpc/85xx parts that only have 256kB of cache and also need to perform DDR SPD. So, the nand_spl will load the MPL to L2 SRAM and there DDR will be configured. Afterwards the MPL uses the CONFIG_BOOTCOMMAND environment variable to boot to the appropriate media. This also works with SD and SPI via the on chip rom but instead it goes from on-chip-rom to MPL to full version of u-boot. Depends on previous icache/dcache command changes and various build fixes for add cases that occur when trying to build an extremely minimal image Signed-off-by: Matthew McClintock --- Makefile | 38 +++++++++++++++++++++++++++++++++++++- mkconfig | 1 + 2 files changed, 38 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 0400930..7a9cae7 100644 --- a/Makefile +++ b/Makefile @@ -317,6 +317,16 @@ ifeq ($(CONFIG_NAND_U_BOOT),y) ALL += $(obj)u-boot-nand.bin endif +ifndef CONFIG_IN_BOOTSTRAP +ifeq ($(CONFIG_SPIFLASH), y) +ALL += $(obj)u-boot-spi.bin +endif + +ifeq ($(CONFIG_SDCARD), y) +ALL += $(obj)u-boot-sd.bin +endif +endif + ifeq ($(CONFIG_ONENAND_U_BOOT),y) ALL += $(obj)u-boot-onenand.bin ONENAND_BIN ?= $(obj)onenand_ipl/onenand-ipl-2k.bin @@ -404,8 +414,16 @@ $(obj)u-boot.lds: $(LDSCRIPT) nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend $(MAKE) -C nand_spl/board/$(BOARDDIR) all +NAND_SPL_OBJS-y += $(obj)nand_spl/u-boot-spl-16k.bin +NAND_SPL_OBJS-$(CONFIG_BOOTSTRAP) += $(obj)u-boot-bootstrap.bin +NAND_SPL_OBJS-y += $(obj)u-boot.bin + +ifeq ($(CONFIG_BOOTSTRAP),y) +$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin +else $(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 +endif + cat $(NAND_SPL_OBJS-y) > $(obj)u-boot-nand.bin onenand_ipl: $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk $(MAKE) -C onenand_ipl/board/$(BOARDDIR) all @@ -413,6 +431,23 @@ onenand_ipl: $(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk $(obj)u-boot-onenand.bin: onenand_ipl $(obj)u-boot.bin cat $(ONENAND_BIN) $(obj)u-boot.bin > $(obj)u-boot-onenand.bin +ifdef CONFIG_BOOTSTRAP +$(obj)u-boot-spi.bin: $(obj)u-boot.bin $(obj)u-boot-bootstrap.bin + cat $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin > $(obj)u-boot-spi.bin +$(obj)u-boot-sd.bin: $(obj)u-boot.bin $(obj)u-boot-bootstrap.bin + cat $(obj)u-boot-bootstrap.bin $(obj)u-boot.bin > $(obj)u-boot-sd.bin +else +$(obj)u-boot-spi.bin: $(obj)u-boot.bin + ln -s u-boot.bin u-boot-spi.bin +$(obj)u-boot-sd.bin: $(obj)u-boot.bin + ln -s u-boot.bin u-boot-sd.bin +endif + +$(obj)u-boot-bootstrap.bin: + rm -rf $(BUILD_DIR)bootstrap + $(MAKE) $(CONFIG_BOARD_NAME) O=bootstrap/ EXTRA_OPTS=IN_BOOTSTRAP + cp $(BUILD_DIR)bootstrap/u-boot.bin u-boot-bootstrap.bin + $(VERSION_FILE): @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ printf '#define PLAIN_VERSION "%s%s"\n' \ @@ -1130,6 +1165,7 @@ clean: \( -name 'core' -o -name '*.bak' -o -name '*~' \ -o -name '*.o' -o -name '*.a' -o -name '*.exe' \) -print \ | xargs rm -f + @rm -fr $(BUILD_DIR)bootstrap/ clobber: clean @find $(OBJTREE) -type f \( -name '*.depend' \ diff --git a/mkconfig b/mkconfig index e72ec3d..74294ec 100755 --- a/mkconfig +++ b/mkconfig @@ -159,6 +159,7 @@ for i in ${TARGETS} ; do done cat << EOF >> config.h +#define CONFIG_BOARD_NAME $BOARD_NAME #define CONFIG_BOARDDIR board/$BOARDDIR #include #include