From patchwork Tue Jun 21 10:59:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aneesh V X-Patchwork-Id: 101274 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 4DCACB6F83 for ; Tue, 21 Jun 2011 21:07:26 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CC87728085; Tue, 21 Jun 2011 13:07:22 +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 b-oyNWi1DFcb; Tue, 21 Jun 2011 13:07:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9CC3428086; Tue, 21 Jun 2011 13:07:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A6A0E28086 for ; Tue, 21 Jun 2011 13:07:17 +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 XHH7LTqSVF-R for ; Tue, 21 Jun 2011 13:07:15 +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 na3sys009aog112.obsmtp.com (na3sys009aog112.obsmtp.com [74.125.149.207]) by theia.denx.de (Postfix) with ESMTPS id 91B1D28085 for ; Tue, 21 Jun 2011 13:07:12 +0200 (CEST) Received: from mail-gy0-f179.google.com ([209.85.160.179]) (using TLSv1) by na3sys009aob112.postini.com ([74.125.148.12]) with SMTP ID DSNKTgB7XhS1EuEWdd9BgjOH93S/LKvong8a@postini.com; Tue, 21 Jun 2011 04:07:14 PDT Received: by mail-gy0-f179.google.com with SMTP id 15so913608gyc.38 for ; Tue, 21 Jun 2011 04:07:10 -0700 (PDT) Received: by 10.101.5.7 with SMTP id h7mr7020565ani.25.1308654430643; Tue, 21 Jun 2011 04:07:10 -0700 (PDT) Received: from [172.24.137.55] (dragon.ti.com [192.94.94.33]) by mx.google.com with ESMTPS id x12sm6639436anf.35.2011.06.21.04.07.06 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Jun 2011 04:07:10 -0700 (PDT) Message-ID: <4E00799A.5040302@ti.com> Date: Tue, 21 Jun 2011 16:29:38 +0530 From: Aneesh V User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Wolfgang Denk References: <4DF9B9E0.8020206@ti.com> <20110616104716.762DD19E5AC3@gemini.denx.de> <4DFB8579.1020309@ti.com> In-Reply-To: <4DFB8579.1020309@ti.com> Cc: Albert ARIBAUD , "u-boot@lists.denx.de" , "Shilimkar, Santosh" , Scott Wood Subject: Re: [U-Boot] SPL framework re-design 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 Dear Wolfgang, On Friday 17 June 2011 10:18 PM, Aneesh V wrote: > Dear Wolfgang, > > Here is a crude implementation of the top-down approach you had been > suggesting (or my interpretation of it). This is not complete yet and > serves only as a material for further discussions on this topic. Here is an updated version of my prototype implementation with fixes for some issues pointed out by Scott. Please let me know your views about this. --- Makefile | 5 ++ include/configs/omap4_sdp4430.h | 1 + spl/Makefile | 94 +++++++++++++++++++++++++++++++++++++++ spl/mmc/Makefile | 55 +++++++++++++++++++++++ 4 files changed, 155 insertions(+), 0 deletions(-) create mode 100644 spl/Makefile create mode 100644 spl/mmc/Makefile diff --git a/Makefile b/Makefile index 8540e39..0321634 100644 --- a/Makefile +++ b/Makefile @@ -316,6 +316,7 @@ BOARD_SIZE_CHECK = endif # Always append ALL so that arch config.mk's can add custom ones +ALL += spl ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map ifeq ($(CONFIG_NAND_U_BOOT),y) @@ -428,6 +429,9 @@ $(obj)u-boot-onenand.bin: onenand_ipl $(obj)u-boot.bin mmc_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend $(MAKE) -C mmc_spl/board/$(BOARDDIR) all +spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend + $(MAKE) -C spl/ all + $(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl $(VERSION_FILE): @@ -1142,6 +1146,7 @@ clean: @rm -f $(obj)spl/{u-boot-spl-generated.lds,u-boot-spl,u-boot-spl.map} @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map} @rm -f $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} + @rm -f $(obj)spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} @rm -f $(ONENAND_BIN) @rm -f $(obj)onenand_ipl/u-boot.lds @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h index c424951..c9adc3c 100644 --- a/include/configs/omap4_sdp4430.h +++ b/include/configs/omap4_sdp4430.h @@ -257,4 +257,5 @@ /* 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM */ #define CONFIG_SYS_TEXT_BASE 0x80100000 +#define CONFIG_SYS_SPL_MMC_SUPPORT #endif /* __CONFIG_H */ diff --git a/spl/Makefile b/spl/Makefile new file mode 100644 index 0000000..9e3a5b1 --- /dev/null +++ b/spl/Makefile @@ -0,0 +1,94 @@ +# +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. +# +# This file is released under the terms of GPL v2 and any later version. +# See the file COPYING in the root directory of the source tree for details. +# + +include $(TOPDIR)/config.mk +LIBS-$(CONFIG_SYS_SPL_MMC_SUPPORT) = mmc/libmmc.o +LIBS-$(CONFIG_SYS_SPL_FAT_SUPPORT) += fat/libfat.o +LIBS-$(CONFIG_SYS_SPL_NAND_SUPPORT) += nand/libnand.o +LIBS-$(CONFIG_SYS_SPL_ONENAND_SUPPORT) += onenand/libonenand.o + +LIBS-y += $(shell if [ -f $(ARCH)/Makefile ]; then echo \ + "$(ARCH)/lib$(ARCH).o"; fi) +LIBS-y += $(shell if [ -f $(ARCH)/$(CPU)/Makefile ]; then echo \ + "$(ARCH)/$(CPU)/lib$(CPU).o"; fi) +LIBS-y += $(shell if [ -f $(ARCH)/$(CPU)/$(SOC)/Makefile ]; then echo \ + "$(ARCH)/$(CPU)/$(SOC)/lib$(SOC).o"; fi) +LIBS-y += $(shell if [ -f $(ARCH)/$(CPU)/$(SOC)/$(BOARD)/Makefile ]; then echo \ + "$(ARCH)/$(CPU)/$(SOC)/$(BOARD)/lib$(BOARD).o"; fi) + +LIBS-y := $(addprefix $(obj),$(sort $(LIBS-y))) + +__LIBS := $(subst $(obj),,$(LIBS-y)) + +ifndef SPL_LDSCRIPT + ifdef CONFIG_SYS_SPL_LDSCRIPT + # need to strip off double quotes + SPL_LDSCRIPT := $(subst ",,$(CONFIG_SYS_SPL_LDSCRIPT)) + endif +endif + +ifndef SPL_LDSCRIPT + ifeq ($(wildcard $(SPL_LDSCRIPT)),) + SPL_LDSCRIPT := $(TOPDIR)/spl/$(ARCH)/$(CPU)/$(SOC)/$(BOARDDIR)/u-boot-spl.lds + endif + ifeq ($(wildcard $(SPL_LDSCRIPT)),) + SPL_LDSCRIPT := $(TOPDIR)/spl/$(ARCH)/$(CPU)/$(SOC)/u-boot-spl.lds + endif + ifeq ($(wildcard $(SPL_LDSCRIPT)),) + SPL_LDSCRIPT := $(TOPDIR)/spl/$(ARCH)/$(CPU)/u-boot-spl.lds + endif + ifeq ($(wildcard $(SPL_LDSCRIPT)),) +$(error could not find linker script) + endif +endif +LNDIR := $(OBJTREE)/spl + +# Special flags for CPP when processing the linker script. +# Pass the version down so we can handle backwards compatibility +# on the fly. +LDPPFLAGS += \ + -include $(TOPDIR)/include/u-boot/u-boot.lds.h \ + $(shell $(LD) --version | \ + sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') + +ALL = $(obj)u-boot-spl.bin + +all: $(ALL) + +$(obj)u-boot-spl.bin: $(obj)u-boot-spl + $(OBJCOPY) $(OBJCFLAGS) -O binary $< $@ + +GEN_UBOOT = \ + UNDEF_SYM=`$(OBJDUMP) -x $(LIBS-y) | \ + sed -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\ + cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM \ + --start-group $(__LIBS) --end-group \ + -Map u-boot-spl.map -o u-boot-spl + +$(obj)u-boot-spl: depend $(LIBS-y) $(SPL_LDSCRIPT) $(obj)u-boot-spl.lds + $(GEN_UBOOT) + +$(OBJS): depend + $(MAKE) -C $(CPUDIR) $(if $(REMOTE_BUILD),$@,$(notdir $@)) + +$(LIBS-y): depend + $(MAKE) -C $(dir $(subst $(obj),,$@)) all + +$(SPL_LDSCRIPT): depend + $(MAKE) -C $(dir $@) $(notdir $@) + +$(obj)u-boot-spl.lds: $(SPL_LDSCRIPT) + $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - < $< > $@ + +depend: $(obj).depend +.PHONY: depend + +clean: + # TODO: implement clean to support in-tree builds + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk diff --git a/spl/mmc/Makefile b/spl/mmc/Makefile new file mode 100644 index 0000000..b4f7efd --- /dev/null +++ b/spl/mmc/Makefile @@ -0,0 +1,55 @@ +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)libmmc.o + +$(obj)mmc.c: + @rm -f $@ + @ln -s $(TOPDIR)/drivers/mmc/mmc.c $@ + +$(obj)omap_hsmmc.c: + @rm -f $@ + @ln -s $(TOPDIR)/drivers/mmc/omap_hsmmc.c $@ + + +COBJS := mmc.o +COBJS += omap_hsmmc.o + +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################