2011-07-18 07:48:07 +00:00
|
|
|
#
|
|
|
|
# (C) Copyright 2000-2011
|
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
|
|
|
# (C) Copyright 2011
|
|
|
|
# Daniel Schwierzeck, daniel.schwierzeck@googlemail.com.
|
|
|
|
#
|
|
|
|
# (C) Copyright 2011
|
|
|
|
# Texas Instruments Incorporated - http://www.ti.com/
|
|
|
|
# Aneesh V <aneesh@ti.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.
|
|
|
|
#
|
|
|
|
# Based on top-level Makefile.
|
|
|
|
#
|
|
|
|
|
|
|
|
CONFIG_SPL_BUILD := y
|
|
|
|
export CONFIG_SPL_BUILD
|
|
|
|
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
|
|
|
# We want the final binaries in this directory
|
|
|
|
obj := $(OBJTREE)/spl/
|
|
|
|
|
2012-08-14 01:44:29 +00:00
|
|
|
HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(SRCTREE)/board/$(VENDOR)/common/Makefile),y,n)
|
2011-07-18 07:48:07 +00:00
|
|
|
|
2011-09-11 17:56:19 +00:00
|
|
|
ifdef CONFIG_SPL_START_S_PATH
|
|
|
|
START_PATH := $(subst ",,$(CONFIG_SPL_START_S_PATH))
|
|
|
|
else
|
|
|
|
START_PATH := $(CPUDIR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
START := $(START_PATH)/start.o
|
2012-09-19 22:56:39 +00:00
|
|
|
ifeq ($(CPU),x86)
|
|
|
|
START += $(START_PATH)/start16.o
|
|
|
|
START += $(START_PATH)/resetvec.o
|
|
|
|
endif
|
|
|
|
ifeq ($(CPU),ppc4xx)
|
|
|
|
START += $(START_PATH)/resetvec.o
|
|
|
|
endif
|
|
|
|
ifeq ($(CPU),mpc85xx)
|
|
|
|
START += $(START_PATH)/resetvec.o
|
|
|
|
endif
|
2011-07-18 07:48:07 +00:00
|
|
|
|
|
|
|
LIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o
|
2012-09-19 22:56:39 +00:00
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
LIBS-y += $(CPUDIR)/lib$(CPU).o
|
2012-09-19 22:56:39 +00:00
|
|
|
ifeq ($(CPU),mpc83xx)
|
|
|
|
LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
|
|
|
|
endif
|
|
|
|
ifeq ($(CPU),mpc85xx)
|
|
|
|
LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
|
|
|
|
endif
|
|
|
|
ifeq ($(CPU),mpc86xx)
|
|
|
|
LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
ifdef SOC
|
|
|
|
LIBS-y += $(CPUDIR)/$(SOC)/lib$(SOC).o
|
|
|
|
endif
|
|
|
|
LIBS-y += board/$(BOARDDIR)/lib$(BOARD).o
|
|
|
|
LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/lib$(VENDOR).o
|
|
|
|
|
2012-08-13 19:03:19 +00:00
|
|
|
LIBS-$(CONFIG_SPL_FRAMEWORK) += common/spl/libspl.o
|
2011-07-13 05:11:08 +00:00
|
|
|
LIBS-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/libcommon.o
|
|
|
|
LIBS-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/libdisk.o
|
|
|
|
LIBS-$(CONFIG_SPL_I2C_SUPPORT) += drivers/i2c/libi2c.o
|
|
|
|
LIBS-$(CONFIG_SPL_GPIO_SUPPORT) += drivers/gpio/libgpio.o
|
|
|
|
LIBS-$(CONFIG_SPL_MMC_SUPPORT) += drivers/mmc/libmmc.o
|
|
|
|
LIBS-$(CONFIG_SPL_SERIAL_SUPPORT) += drivers/serial/libserial.o
|
|
|
|
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
|
2011-09-14 19:30:54 +00:00
|
|
|
LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o
|
2011-09-14 19:30:16 +00:00
|
|
|
LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o
|
2011-10-31 13:14:15 +00:00
|
|
|
LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o
|
2011-09-28 05:00:27 +00:00
|
|
|
LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/libdma.o
|
2011-11-01 20:00:28 +00:00
|
|
|
LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/memory.o
|
2012-09-18 00:22:50 +00:00
|
|
|
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
|
2011-07-13 05:11:08 +00:00
|
|
|
|
2012-01-09 20:38:59 +00:00
|
|
|
ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
|
2011-11-15 14:49:55 +00:00
|
|
|
LIBS-y += $(CPUDIR)/omap-common/libomap-common.o
|
|
|
|
endif
|
2011-07-13 05:11:09 +00:00
|
|
|
|
2012-08-31 08:30:01 +00:00
|
|
|
ifeq ($(SOC),tegra20)
|
|
|
|
LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
|
2012-09-19 21:08:52 +00:00
|
|
|
LIBS-y += arch/$(ARCH)/cpu/tegra-common/libcputegra-common.o
|
|
|
|
LIBS-y += $(CPUDIR)/tegra-common/libtegra-common.o
|
2012-08-31 08:30:01 +00:00
|
|
|
endif
|
|
|
|
|
2012-08-31 08:30:14 +00:00
|
|
|
# Add GCC lib
|
|
|
|
ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
|
|
|
|
PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/libgcc.o
|
|
|
|
PLATFORM_LIBS := $(filter-out %/libgcc.o, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
START := $(addprefix $(SPLTREE)/,$(START))
|
|
|
|
LIBS := $(addprefix $(SPLTREE)/,$(sort $(LIBS-y)))
|
|
|
|
|
|
|
|
__START := $(subst $(obj),,$(START))
|
|
|
|
__LIBS := $(subst $(obj),,$(LIBS))
|
|
|
|
|
|
|
|
# Linker Script
|
|
|
|
ifdef CONFIG_SPL_LDSCRIPT
|
|
|
|
# need to strip off double quotes
|
|
|
|
LDSCRIPT := $(addprefix $(SRCTREE)/,$(subst ",,$(CONFIG_SPL_LDSCRIPT)))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
|
|
|
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-spl.lds
|
|
|
|
endif
|
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
|
|
|
LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-spl.lds
|
|
|
|
endif
|
2011-11-21 10:49:37 +00:00
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
|
|
|
LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
|
|
|
|
endif
|
2011-07-18 07:48:07 +00:00
|
|
|
ifeq ($(wildcard $(LDSCRIPT)),)
|
|
|
|
$(error could not find linker script)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# 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 \
|
|
|
|
-include $(OBJTREE)/include/config.h \
|
2011-11-21 10:49:40 +00:00
|
|
|
-DCPUDIR=$(CPUDIR) \
|
2011-07-18 07:48:07 +00:00
|
|
|
$(shell $(LD) --version | \
|
|
|
|
sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
|
|
|
|
|
2011-07-21 13:10:30 +00:00
|
|
|
$(OBJTREE)/MLO: $(obj)u-boot-spl.bin
|
|
|
|
$(OBJTREE)/tools/mkimage -T omapimage \
|
|
|
|
-a $(CONFIG_SPL_TEXT_BASE) -d $< $@
|
2012-10-16 13:06:06 +00:00
|
|
|
|
|
|
|
$(OBJTREE)/MLO.byteswap: $(obj)u-boot-spl.bin
|
|
|
|
$(OBJTREE)/tools/mkimage -T omapimage -n byteswap \
|
2012-01-09 20:38:59 +00:00
|
|
|
-a $(CONFIG_SPL_TEXT_BASE) -d $< $@
|
2011-07-21 13:10:30 +00:00
|
|
|
|
2012-10-10 21:11:44 +00:00
|
|
|
ifneq ($(CONFIG_IMX_CONFIG),)
|
|
|
|
$(OBJTREE)/SPL: $(obj)u-boot-spl.bin
|
|
|
|
$(OBJTREE)/tools/mkimage -n $(SRCTREE)/$(CONFIG_IMX_CONFIG) -T imximage \
|
|
|
|
-e $(CONFIG_SPL_TEXT_BASE) -d $< $@
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
ALL-y += $(obj)u-boot-spl.bin
|
|
|
|
|
2011-08-18 22:37:20 +00:00
|
|
|
ifdef CONFIG_SAMSUNG
|
|
|
|
ALL-y += $(obj)$(BOARD)-spl.bin
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
all: $(ALL-y)
|
|
|
|
|
2011-08-18 22:37:20 +00:00
|
|
|
ifdef CONFIG_SAMSUNG
|
|
|
|
$(obj)$(BOARD)-spl.bin: $(obj)u-boot-spl.bin
|
2011-09-12 10:11:58 +00:00
|
|
|
$(OBJTREE)/tools/mk$(BOARD)spl \
|
2011-08-18 22:37:20 +00:00
|
|
|
$(obj)u-boot-spl.bin $(obj)$(BOARD)-spl.bin
|
|
|
|
endif
|
|
|
|
|
2011-07-18 07:48:07 +00:00
|
|
|
$(obj)u-boot-spl.bin: $(obj)u-boot-spl
|
|
|
|
$(OBJCOPY) $(OBJCFLAGS) -O binary $< $@
|
|
|
|
|
|
|
|
GEN_UBOOT = \
|
2012-08-08 16:24:13 +00:00
|
|
|
cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(__START) \
|
2011-07-18 07:48:07 +00:00
|
|
|
--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
|
|
|
|
-Map u-boot-spl.map -o u-boot-spl
|
|
|
|
|
|
|
|
$(obj)u-boot-spl: depend $(START) $(LIBS) $(obj)u-boot-spl.lds
|
|
|
|
$(GEN_UBOOT)
|
|
|
|
|
|
|
|
$(START): depend
|
2011-09-11 17:56:19 +00:00
|
|
|
$(MAKE) -C $(SRCTREE)/$(START_PATH) $@
|
2011-07-18 07:48:07 +00:00
|
|
|
|
|
|
|
$(LIBS): depend
|
|
|
|
$(MAKE) -C $(SRCTREE)$(dir $(subst $(SPLTREE),,$@))
|
|
|
|
|
2012-10-19 05:00:10 +00:00
|
|
|
# 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
|
|
|
|
$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@
|
2011-07-18 07:48:07 +00:00
|
|
|
|
|
|
|
depend: $(obj).depend
|
|
|
|
.PHONY: depend
|
|
|
|
|
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|