Message ID | 4E00799A.5040302@ti.com |
---|---|
State | Superseded |
Headers | show |
Dear Wolfgang, On Tuesday 21 June 2011 04:29 PM, Aneesh V wrote: > 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. I guess you are busy with the release. When will you get a chance to look at this so that I can continue with the work once we are aligned on the design. best regards, Aneesh
Dear Aneesh V, In message <4E00799A.5040302@ti.com> you wrote: > > > 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 This patch seems strangely white-space corrupted. > 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 The mmc_spl/ is suppoed to be moved into spl/, isn't it? > $(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} Dito here for onenand_ipl/ ? > @rm -f > $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} ...also line-wrapped. > + @rm -f > $(obj)spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} Make this: @rm -f $(obj)spl/u-boot{.lds,-spl,-spl.map,-spl.bin,-mmc-spl.bin} instead. > @rm -f $(ONENAND_BIN) > @rm -f $(obj)onenand_ipl/u-boot.lds Goes away? > --- /dev/null > +++ b/spl/Makefile > @@ -0,0 +1,94 @@ > +# > +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. Really??? > +# 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 As Mike mentioned, we can eventually directly include the OBJSs here and omit the building of libraries? > +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) We should probably use /$(BOARDDIR)? here instead of /$(BOARD)/ to allow for vendor directories (where "BOARDDIR = $(VENDOR)/$(BOARD)"). > +ALL = $(obj)u-boot-spl.bin > + > +all: $(ALL) Do we need ALL then at all? ... > 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. Really??? > +$(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 $@ Hm... can we try to do without the symlinks? Best regards, Wolfgang Denk
Dear Wolfgang, On 06/25/2011 02:10 PM, Wolfgang Denk wrote: > Dear Aneesh V, > > In message<4E00799A.5040302@ti.com> you wrote: >> >>> 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 > > This patch seems strangely white-space corrupted. > >> 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 > > The mmc_spl/ is suppoed to be moved into spl/, isn't it? > >> $(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} > > Dito here for onenand_ipl/ ? > >> @rm -f >> $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} > > ...also line-wrapped. > >> + @rm -f >> $(obj)spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} > > Make this: > > @rm -f $(obj)spl/u-boot{.lds,-spl,-spl.map,-spl.bin,-mmc-spl.bin} > > instead. > >> @rm -f $(ONENAND_BIN) >> @rm -f $(obj)onenand_ipl/u-boot.lds > > Goes away? > >> --- /dev/null >> +++ b/spl/Makefile >> @@ -0,0 +1,94 @@ >> +# >> +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. > > Really??? That is only because Aneesh used my experimental Makefile that I published for discussion and to show one possible solution for the top-down design. > >> +# 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 > > As Mike mentioned, we can eventually directly include the OBJSs here > and omit the building of libraries? What about files which need to recompiled with a different configuration? For example I have a use case (MIPS based) that reuses parts of the CPU and board lowlevel init code. This SPL runs in a SoC internal SRAM, initializes the memory controller, needs no relocation, have a different stack offset and copies the real U-Boot from SPI flash to RAM. At least I have to recompile start.S without relocate_code() and a different stack pointer initialization. > >> +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) > > We should probably use /$(BOARDDIR)? here instead of /$(BOARD)/ to > allow for vendor directories (where "BOARDDIR = $(VENDOR)/$(BOARD)"). > >> +ALL = $(obj)u-boot-spl.bin >> + >> +all: $(ALL) > > Do we need ALL then at all? actually not. The original spl/Makefile is only a strongly simplified version of the top-level Makefile. > > ... >> 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. > > Really??? > >> +$(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 $@ > > Hm... can we try to do without the symlinks? that is possible with if you play a little with the src and obj variables in config.mk Best regards, Daniel
Dear Wolfgang, On Saturday 25 June 2011 05:40 PM, Wolfgang Denk wrote: > Dear Aneesh V, > > In message<4E00799A.5040302@ti.com> you wrote: >> >>> 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 > > This patch seems strangely white-space corrupted. Maybe, because I copy-pasted in Thunderbird instead of git-send-mail. > >> 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 > > The mmc_spl/ is suppoed to be moved into spl/, isn't it? This patch was intended only as a prototype for the new directory structure. I didn't bother to touch the existing stuff. > >> $(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} > > Dito here for onenand_ipl/ ? > >> @rm -f >> $(obj)mmc_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} > > ...also line-wrapped. > >> + @rm -f >> $(obj)spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,u-boot-spl.bin,u-boot-mmc-spl.bin} > > Make this: > > @rm -f $(obj)spl/u-boot{.lds,-spl,-spl.map,-spl.bin,-mmc-spl.bin} > > instead. ok. > >> @rm -f $(ONENAND_BIN) >> @rm -f $(obj)onenand_ipl/u-boot.lds > > Goes away? I am yet to think about the migration of existing code. If it's mere movement of code I should be able to do it for all. But if it is about re-factoring the code of other SoCs, I will not be able to do it. Hope respective maintainers will take care of that. > >> --- /dev/null >> +++ b/spl/Makefile >> @@ -0,0 +1,94 @@ >> +# >> +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. > > Really??? I copied Daniel's Makefile and started from there. > >> +# 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 > > As Mike mentioned, we can eventually directly include the OBJSs here > and omit the building of libraries? I can't seem to find a mail from Mike on this thread. Did I miss any mail? Do you mean re-using equivalent libraries from the normal U-Boot without re-compiling them? > >> +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) > > We should probably use /$(BOARDDIR)? here instead of /$(BOARD)/ to > allow for vendor directories (where "BOARDDIR = $(VENDOR)/$(BOARD)"). I didn't want to make the directory structure any longer than required. But I can add this if required. > >> +ALL = $(obj)u-boot-spl.bin >> + >> +all: $(ALL) > > Do we need ALL then at all? ok. I will remove it. > > ... >> 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. > > Really??? Again I copied the Makefile from arch/arm/cpu/armv7/Makefile as a template. > >> +$(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 $@ > > Hm... can we try to do without the symlinks? Well. I think it's difficult. Most of my hardware initialization such as clock init, SDRAM init etc need to know under what context it is getting executed. The context can be: 1. SPL 2. Regular U-Boot executing from NOR flash 3. Regular U-Boot executing from SDRAM etc. Based on the context, the level of initialization will differ, but most of the code could still be shared between these different contexts. While the identification between a NOR boot and SDRAM boot is determined run-time the distinction between SPL and normal U-Boot is made based on CONFIG_PRELOADER. Also, as mentioned by Daniel, start.S needs some customization for SPL. Also, I agree with Scott's opinion that re-compiling some files while re-using the binary of some other files won't be a good idea. In this case, CONFIG_PRELOADER will be honored in some files but not in other files. That will be a source of confusion for developers. If you want to do away with symlinks, I would propose going with Daniel's approach. This uses /spl as a remote building directory, but do not create any symlinks. Daniel, You mentioned that /spl can not be used for source files. Isn't there a way to workaround this problem? best regards, Aneesh
Dear Aneesh, In message <4E0804DC.8090805@ti.com> you wrote: > > >> +spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend > >> + $(MAKE) -C spl/ all > >> + > >> $(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl > > > > The mmc_spl/ is suppoed to be moved into spl/, isn't it? > > This patch was intended only as a prototype for the new directory > structure. I didn't bother to touch the existing stuff. I see. > >> --- /dev/null > >> +++ b/spl/Makefile > >> @@ -0,0 +1,94 @@ > >> +# > >> +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. > > > > Really??? > > I copied Daniel's Makefile and started from there. I guess the only real part that was left from the old file is the GPL header... > > As Mike mentioned, we can eventually directly include the OBJSs here > > and omit the building of libraries? > > I can't seem to find a mail from Mike on this thread. Did I miss any > mail? I can find it either. I don't know what I had in mind then. > Do you mean re-using equivalent libraries from the normal U-Boot > without re-compiling them? There are actually two different topics here: - The first is how to link all the objects in the spl/ tree together. As I understand, you proposal was to link all objects in each of the subdirectories into a library, and then link all the libraries together. Instead of doing this, we could as well just maintain a list of objects and then link all these together directly, without creating libraries first. - The other topic is if to build new object files, and where. At the moment we have two situations: * Some files are built with special options such that unneeded code gets commented out using respecive #ifdef's / #ifndef's. We can probably get rid of (most of ?) these #ifdef's / #ifndef's when properly using -ffunction-sections / --gc-sections Why should we then recompile the code? * Some files (start.S) really need different code. Here the questions is more how and where to recompile using proper options. I would be glad if we could get rid of the symlinking. Maybe we can add respective build rules to the original Makefiles (see also proposal by Ilya, http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102033 ), eventually just using a different suffix, say ".splo" instead of ".o"? > > allow for vendor directories (where "BOARDDIR = $(VENDOR)/$(BOARD)"). > > I didn't want to make the directory structure any longer than required. > But I can add this if required. It will be needed. > > Hm... can we try to do without the symlinks? > > Well. I think it's difficult. Most of my hardware initialization such > as clock init, SDRAM init etc need to know under what context it > is getting executed. The context can be: > 1. SPL > 2. Regular U-Boot executing from NOR flash > 3. Regular U-Boot executing from SDRAM > etc. Agreed - we need another, independent set of object files. But cannot we create these in the existent source tree? > If you want to do away with symlinks, I would propose going with > Daniel's approach. This uses /spl as a remote building directory, but > do not create any symlinks. Yes, this is an improvement over the current situation - but Ilya's question is a good one: why do we need the pl/ subtree in the first place? Best regards, Wolfgang Denk
Dear Wolfgang, On Monday 27 June 2011 02:57 PM, Wolfgang Denk wrote: > Dear Aneesh, > > In message<4E0804DC.8090805@ti.com> you wrote: >> >>>> +spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend >>>> + $(MAKE) -C spl/ all >>>> + >>>> $(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl >>> >>> The mmc_spl/ is suppoed to be moved into spl/, isn't it? >> >> This patch was intended only as a prototype for the new directory >> structure. I didn't bother to touch the existing stuff. > > I see. > >>>> --- /dev/null >>>> +++ b/spl/Makefile >>>> @@ -0,0 +1,94 @@ >>>> +# >>>> +# (C) Copyright 2011 Daniel Schwierzeck, daniel.schwierzeck@googlemail.com. >>> >>> Really??? >> >> I copied Daniel's Makefile and started from there. > > I guess the only real part that was left from the old file is the GPL > header... > >>> As Mike mentioned, we can eventually directly include the OBJSs here >>> and omit the building of libraries? >> >> I can't seem to find a mail from Mike on this thread. Did I miss any >> mail? > > I can find it either. I don't know what I had in mind then. > >> Do you mean re-using equivalent libraries from the normal U-Boot >> without re-compiling them? > > There are actually two different topics here: > > - The first is how to link all the objects in the spl/ tree together. > As I understand, you proposal was to link all objects in each of the > subdirectories into a library, and then link all the libraries > together. > > Instead of doing this, we could as well just maintain a list of > objects and then link all these together directly, without creating > libraries first. > Is this like a make variable that keeps accumulating objects from sub-directories? If so, is that through a *.mk at each level and including all these *.mk at the top level Makefile. Or is there some other idea? best regards, Aneesh
Dear Aneesh V, In message <4E089A25.4050009@ti.com> you wrote: > > > Instead of doing this, we could as well just maintain a list of > > objects and then link all these together directly, without creating > > libraries first. > > Is this like a make variable that keeps accumulating objects > from sub-directories? If so, is that through a *.mk at each level and > including all these *.mk at the top level Makefile. Or is there some > other idea? Well, if we do it right and build only such objects we actually need for the target binary, we might not need any explicit rules at all and instead just use file globbing to link all objects we find. Best regards, Wolfgang Denk
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 + +#########################################################################