X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=spl%2FMakefile;h=8e7daa2d4a436d9fd2a6b11b275d55eb60890fc8;hb=3c5edd8ca594c73162ef01c45dbf4ea6f7148003;hp=aac614686e801f8613ad9fa81c142583d91fcc65;hpb=76b40ab41eff1f402ee52ba768b09daad293b9bb;p=platform%2Fkernel%2Fu-boot.git diff --git a/spl/Makefile b/spl/Makefile index aac6146..8e7daa2 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -9,8 +9,7 @@ # Texas Instruments Incorporated - http://www.ti.com/ # Aneesh V # -# 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. +# SPDX-License-Identifier: GPL-2.0+ # # Based on top-level Makefile. # @@ -18,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) @@ -51,6 +62,9 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o endif ifeq ($(CPU),mpc85xx) LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o +ifdef CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT +LIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o +endif endif ifeq ($(CPU),mpc86xx) LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o @@ -73,7 +87,8 @@ LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/libspi_flash.o LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/libspi.o LIBS-$(CONFIG_SPL_FAT_SUPPORT) += fs/fat/libfat.o LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o -LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o +LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o \ + drivers/power/pmic/libpmic.o LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/libdma.o @@ -81,17 +96,23 @@ LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o LIBS-$(CONFIG_SPL_NET_SUPPORT) += net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/libnet.o LIBS-$(CONFIG_SPL_ETH_SUPPORT) += drivers/net/phy/libphy.o +LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/net/phy/libphy.o LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/libusb_musb-new.o LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/libusb_gadget.o +LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/libwatchdog.o -ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),) -LIBS-y += $(CPUDIR)/omap-common/libomap-common.o +ifneq (,$(CONFIG_MX23)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35)) +LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o endif -ifneq ($(CONFIG_TEGRA),) -LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o -LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o -LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o +LIBS-$(CONFIG_ARM) += arch/arm/cpu/libcpu.o + +ifneq ($(CONFIG_MX23)$(CONFIG_MX35),) +LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o +endif + +ifeq ($(SOC),exynos) +LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o endif # Add GCC lib @@ -119,12 +140,14 @@ ifeq ($(wildcard $(LDSCRIPT)),) LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-spl.lds endif ifeq ($(wildcard $(LDSCRIPT)),) - LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds + LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot-spl.lds endif ifeq ($(wildcard $(LDSCRIPT)),) $(error could not find linker script) endif +build := -f $(TOPDIR)/scripts/Makefile.build -C + # Special flags for CPP when processing the linker script. # Pass the version down so we can handle backwards compatibility # on the fly. @@ -144,9 +167,9 @@ $(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin -a $(CONFIG_SPL_TEXT_BASE) -d $< $@ $(OBJTREE)/SPL : $(obj)u-boot-spl.bin depend - $(MAKE) -C $(SRCTREE)/arch/arm/imx-common $@ + $(MAKE) $(build) $(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 @@ -160,28 +183,42 @@ $(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin $(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) +# Tentative step for Kbuild-style makefiles coexist with conventional U-Boot style makefiles +# U-Boot conventional sub makefiles always include some other makefiles. +# So, the build system searches a line beginning with "include" before entering into the sub makefile +# in order to distinguish which style it is. +# If the Makefile include a "include" line, we assume it is an U-Boot style makefile. +# Otherwise, it is treated as a Kbuild-style makefile. +select_makefile = \ + if grep -q "^include" $1/Makefile; then \ + $(MAKE) -C $1; \ + else \ + $(MAKE) -C $1 -f $(TOPDIR)/scripts/Makefile.build; \ + mv $(dir $@)built-in.o $@; \ + fi + +# We do not need to build $(START) explicitly. +# It is built while we are at $(CPUDIR)/lib$(CPU).o build. $(START): depend - $(MAKE) -C $(SRCTREE)/$(START_PATH) $@ + if grep -q "^include" $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))Makefile; then \ + $(MAKE) -C $(SRCTREE)/$(START_PATH) $@; \ + fi $(LIBS): depend - $(MAKE) -C $(SRCTREE)$(dir $(subst $(SPLTREE),,$@)) + +$(call select_makefile, $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))) -# The following line expands into whole rule which generates u-boot.lst, -# the file containing u-boots LG-array linker section. This is included into -# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file. -$(eval $(call make_u_boot_list, $(obj)u-boot.lst, $(LIBS))) -$(obj)u-boot-spl.lds: $(LDSCRIPT) $(obj)u-boot.lst depend +$(obj)u-boot-spl.lds: $(LDSCRIPT) depend $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@ depend: $(obj).depend