17ebf7443Swdenk# 2eca3aeb3SWolfgang Denk# (C) Copyright 2000-2013 37ebf7443Swdenk# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 47ebf7443Swdenk# 5eca3aeb3SWolfgang Denk# SPDX-License-Identifier: GPL-2.0+ 67ebf7443Swdenk# 77ebf7443Swdenk 83ae7b240STom RiniVERSION = 2013 940a60c6eSTom RiniPATCHLEVEL = 10 10211e4754SWolfgang DenkSUBLEVEL = 11183acb70STom RiniEXTRAVERSION = 128b9e4787SWolfgang Denkifneq "$(SUBLEVEL)" "" 13881a87ecSWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 148b9e4787SWolfgang Denkelse 158b9e4787SWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) 168b9e4787SWolfgang Denkendif 17efb2172eSSimon GlassTIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h 18efb2172eSSimon GlassVERSION_FILE = $(obj)include/generated/version_autogenerated.h 19881a87ecSWolfgang Denk 207ebf7443SwdenkHOSTARCH := $(shell uname -m | \ 21fea25720SGraeme Russ sed -e s/i.86/x86/ \ 227ebf7443Swdenk -e s/sun4u/sparc64/ \ 237ebf7443Swdenk -e s/arm.*/arm/ \ 247ebf7443Swdenk -e s/sa110/arm/ \ 25d0179083SKumar Gala -e s/ppc64/powerpc/ \ 26d0179083SKumar Gala -e s/ppc/powerpc/ \ 278d1f6355SNobuhiro Iwamatsu -e s/macppc/powerpc/\ 288d1f6355SNobuhiro Iwamatsu -e s/sh.*/sh/) 297ebf7443Swdenk 30f9d77ed3SWolfgang DenkHOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \ 317ebf7443Swdenk sed -e 's/\(cygwin\).*/cygwin/') 327ebf7443Swdenk 33120ae609SBenoît Thébaudeauexport HOSTARCH HOSTOS 347ebf7443Swdenk 357ebf7443Swdenk# Deal with colliding definitions from tcsh etc. 367ebf7443SwdenkVENDOR= 377ebf7443Swdenk 387ebf7443Swdenk######################################################################### 39ae6d1056SWolfgang Denk# Allow for silent builds 40ae6d1056SWolfgang Denkifeq (,$(findstring s,$(MAKEFLAGS))) 41ae6d1056SWolfgang DenkXECHO = echo 42ae6d1056SWolfgang Denkelse 43ae6d1056SWolfgang DenkXECHO = : 44ae6d1056SWolfgang Denkendif 45ae6d1056SWolfgang Denk 46ae6d1056SWolfgang Denk######################################################################### 47f9328639SMarian Balakowicz# 481bce2aebSRobert P. J. Day# U-boot build supports generating object files in a separate external 49f9328639SMarian Balakowicz# directory. Two use cases are supported: 50f9328639SMarian Balakowicz# 51f9328639SMarian Balakowicz# 1) Add O= to the make command line 52f9328639SMarian Balakowicz# 'make O=/tmp/build all' 53f9328639SMarian Balakowicz# 541bce2aebSRobert P. J. Day# 2) Set environment variable BUILD_DIR to point to the desired location 55f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build' 56f9328639SMarian Balakowicz# 'make' 57f9328639SMarian Balakowicz# 58f9328639SMarian Balakowicz# The second approach can also be used with a MAKEALL script 59f9328639SMarian Balakowicz# 'export BUILD_DIR=/tmp/build' 60f9328639SMarian Balakowicz# './MAKEALL' 61f9328639SMarian Balakowicz# 621bce2aebSRobert P. J. Day# Command line 'O=' setting overrides BUILD_DIR environment variable. 63f9328639SMarian Balakowicz# 64f9328639SMarian Balakowicz# When none of the above methods is used the local build is performed and 65f9328639SMarian Balakowicz# the object files are placed in the source directory. 66f9328639SMarian Balakowicz# 677ebf7443Swdenk 68f9328639SMarian Balakowiczifdef O 69f9328639SMarian Balakowiczifeq ("$(origin O)", "command line") 70f9328639SMarian BalakowiczBUILD_DIR := $(O) 71f9328639SMarian Balakowiczendif 72f9328639SMarian Balakowiczendif 737ebf7443Swdenk 744ab64933SKim Phillips# Call a source code checker (by default, "sparse") as part of the 754ab64933SKim Phillips# C compilation. 764ab64933SKim Phillips# 774ab64933SKim Phillips# Use 'make C=1' to enable checking of re-compiled files. 784ab64933SKim Phillips# 794ab64933SKim Phillips# See the linux kernel file "Documentation/sparse.txt" for more details, 804ab64933SKim Phillips# including where to get the "sparse" utility. 814ab64933SKim Phillips 824ab64933SKim Phillipsifdef C 834ab64933SKim Phillipsifeq ("$(origin C)", "command line") 844ab64933SKim PhillipsCHECKSRC := $(C) 854ab64933SKim Phillipsendif 864ab64933SKim Phillipsendif 874ab64933SKim Phillipsifndef CHECKSRC 884ab64933SKim Phillips CHECKSRC = 0 894ab64933SKim Phillipsendif 904ab64933SKim Phillipsexport CHECKSRC 914ab64933SKim Phillips 92f9328639SMarian Balakowiczifneq ($(BUILD_DIR),) 93f9328639SMarian Balakowiczsaved-output := $(BUILD_DIR) 944f0645ebSMarian Balakowicz 954f0645ebSMarian Balakowicz# Attempt to create a output directory. 964f0645ebSMarian Balakowicz$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}) 974f0645ebSMarian Balakowicz 984f0645ebSMarian Balakowicz# Verify if it was successful. 99f9328639SMarian BalakowiczBUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd) 100f9328639SMarian Balakowicz$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) 101f9328639SMarian Balakowiczendif # ifneq ($(BUILD_DIR),) 102f9328639SMarian Balakowicz 103f9328639SMarian BalakowiczOBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) 104c8f9c302SDaniel SchwierzeckSPLTREE := $(OBJTREE)/spl 1053aa29de0SYing ZhangTPLTREE := $(OBJTREE)/tpl 106f9328639SMarian BalakowiczSRCTREE := $(CURDIR) 107f9328639SMarian BalakowiczTOPDIR := $(SRCTREE) 108f9328639SMarian BalakowiczLNDIR := $(OBJTREE) 1093aa29de0SYing Zhangexport TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE 110f9328639SMarian Balakowicz 111f9328639SMarian BalakowiczMKCONFIG := $(SRCTREE)/mkconfig 112f9328639SMarian Balakowiczexport MKCONFIG 113f9328639SMarian Balakowicz 114f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 115f9328639SMarian BalakowiczREMOTE_BUILD := 1 116f9328639SMarian Balakowiczexport REMOTE_BUILD 117f9328639SMarian Balakowiczendif 118f9328639SMarian Balakowicz 119f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile 120f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for 121f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc. 122f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 123f9328639SMarian Balakowiczobj := $(OBJTREE)/ 124f9328639SMarian Balakowiczsrc := $(SRCTREE)/ 125f9328639SMarian Balakowiczelse 126f9328639SMarian Balakowiczobj := 127f9328639SMarian Balakowiczsrc := 128f9328639SMarian Balakowiczendif 129f9328639SMarian Balakowiczexport obj src 130f9328639SMarian Balakowicz 1315013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere 1325013c09fSWolfgang Denkunexport CDPATH 1335013c09fSWolfgang Denk 134f9328639SMarian Balakowicz######################################################################### 135f9328639SMarian Balakowicz 1366d1ce387SMike Frysinger# The "tools" are needed early, so put this first 1376d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS) 138349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC 139349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled. 140349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools 141349e83f0SChe-liang ChiouSUBDIR_EXAMPLES = examples/standalone examples/api 142349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS) 1436d1ce387SMike Frysinger 144249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) 1456d1ce387SMike Frysinger 146ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) 147f9328639SMarian Balakowicz 1482632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available 1492632c008SMike Frysinger# to all top level build files. We need the dummy all: target to prevent the 1502632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default. 1512632c008SMike Frysingerall: 1522632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep 1532632c008SMike Frysingersinclude $(obj)include/autoconf.mk 1542632c008SMike Frysinger 155b5728756SSimon Glassifndef CONFIG_SANDBOX 156b5728756SSimon GlassSUBDIRS += $(SUBDIR_EXAMPLES) 157b5728756SSimon Glassendif 158b5728756SSimon Glass 1597ebf7443Swdenk# load ARCH, BOARD, and CPU configuration 160ae6d1056SWolfgang Denkinclude $(obj)include/config.mk 1611d9f4105Swdenkexport ARCH CPU BOARD VENDOR SOC 162f9328639SMarian Balakowicz 1631ea6bcd8SMike Frysinger# set default to nothing for native builds 164a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH)) 1651ea6bcd8SMike FrysingerCROSS_COMPILE ?= 1667ebf7443Swdenkendif 1677ebf7443Swdenk 16892b197f0SWolfgang Denk# load other configuration 16992b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk 17092b197f0SWolfgang Denk 171fada9e20SSimon Glass# Targets which don't build the source code 172fada9e20SSimon GlassNON_BUILD_TARGETS = backup clean clobber distclean mkproper tidy unconfig 173fada9e20SSimon Glass 174fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring 175fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),) 176fada9e20SSimon Glassifeq ($(findstring _config,$(MAKECMDGOALS)),) 177fada9e20SSimon Glass$(CHECK_GENERIC_BOARD) 178fada9e20SSimon Glassendif 179fada9e20SSimon Glassendif 180fada9e20SSimon Glass 181d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use 182d51dfff7SIlya Yanok# that (or fail if absent). Otherwise, search for a linker script in a 183d51dfff7SIlya Yanok# standard location. 184d51dfff7SIlya Yanok 185ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT)) 186ee60197eSSimon Glass 187d51dfff7SIlya Yanokifndef LDSCRIPT 188d51dfff7SIlya Yanok #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug 189d51dfff7SIlya Yanok ifdef CONFIG_SYS_LDSCRIPT 190d51dfff7SIlya Yanok # need to strip off double quotes 191d51dfff7SIlya Yanok LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT)) 192d51dfff7SIlya Yanok endif 193d51dfff7SIlya Yanokendif 194d51dfff7SIlya Yanok 195ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it 196d51dfff7SIlya Yanokifndef LDSCRIPT 197d51dfff7SIlya Yanok ifeq ($(CONFIG_NAND_U_BOOT),y) 198d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds 199d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 200d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds 201d51dfff7SIlya Yanok endif 202d51dfff7SIlya Yanok endif 203d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 204d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds 205d51dfff7SIlya Yanok endif 206d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 207d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds 208d51dfff7SIlya Yanok endif 209d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 210ee60197eSSimon Glass LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds 211ee60197eSSimon Glass # We don't expect a Makefile here 212ee60197eSSimon Glass LDSCRIPT_MAKEFILE_DIR = 213ee60197eSSimon Glass endif 214ee60197eSSimon Glass ifeq ($(wildcard $(LDSCRIPT)),) 215d51dfff7SIlya Yanok$(error could not find linker script) 216d51dfff7SIlya Yanok endif 217d51dfff7SIlya Yanokendif 218d51dfff7SIlya Yanok 2197ebf7443Swdenk######################################################################### 2207ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first) 2217ebf7443Swdenk 22203b7004dSPeter TyserOBJS = $(CPUDIR)/start.o 2237ebf7443Swdenkifeq ($(CPU),ppc4xx) 22403b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 2257ebf7443Swdenkendif 22642d1f039Swdenkifeq ($(CPU),mpc85xx) 22703b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 22842d1f039Swdenkendif 2297ebf7443Swdenk 230a32e626fSSimon GlassOBJS := $(addprefix $(obj),$(OBJS)) 231f9328639SMarian Balakowicz 2328b5a0264SDaniel SchwierzeckHAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n) 2338b5a0264SDaniel Schwierzeck 234*e2906a59SMasahiro YamadaLIBS-y += lib/ 235*e2906a59SMasahiro YamadaLIBS-$(CONFIG_RSA) += lib/rsa/ 236*e2906a59SMasahiro YamadaLIBS-$(CONFIG_LZMA) += lib/lzma/ 237*e2906a59SMasahiro YamadaLIBS-$(CONFIG_LZO) += lib/lzo/ 238*e2906a59SMasahiro YamadaLIBS-$(CONFIG_ZLIB) += lib/zlib/ 239*e2906a59SMasahiro YamadaLIBS-$(CONFIG_TIZEN) += lib/tizen/ 240*e2906a59SMasahiro YamadaLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ 241*e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/ 2421d9f4105Swdenkifdef SOC 243*e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/$(SOC)/ 2441d9f4105Swdenkendif 245*e2906a59SMasahiro YamadaLIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/ 246*e2906a59SMasahiro YamadaLIBS-$(CONFIG_OF_EMBED) += dts/ 247*e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/lib/ 248*e2906a59SMasahiro YamadaLIBS-y += fs/ \ 249*e2906a59SMasahiro Yamada fs/fat/ 250*e2906a59SMasahiro YamadaLIBS-y += net/ 251*e2906a59SMasahiro YamadaLIBS-y += disk/ 252*e2906a59SMasahiro YamadaLIBS-y += drivers/ 253*e2906a59SMasahiro YamadaLIBS-y += drivers/dma/ 254*e2906a59SMasahiro YamadaLIBS-y += drivers/gpio/ 255*e2906a59SMasahiro YamadaLIBS-y += drivers/i2c/ 256*e2906a59SMasahiro YamadaLIBS-y += drivers/input/ 257*e2906a59SMasahiro YamadaLIBS-y += drivers/mmc/ 258*e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/ 259*e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/nand/ 260*e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/onenand/ 261*e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/ubi/ 262*e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/spi/ 263*e2906a59SMasahiro YamadaLIBS-y += drivers/net/ 264*e2906a59SMasahiro YamadaLIBS-y += drivers/net/phy/ 265*e2906a59SMasahiro YamadaLIBS-y += drivers/pci/ 266*e2906a59SMasahiro YamadaLIBS-y += drivers/power/ \ 267*e2906a59SMasahiro Yamada drivers/power/fuel_gauge/ \ 268*e2906a59SMasahiro Yamada drivers/power/mfd/ \ 269*e2906a59SMasahiro Yamada drivers/power/pmic/ \ 270*e2906a59SMasahiro Yamada drivers/power/battery/ 271*e2906a59SMasahiro YamadaLIBS-y += drivers/spi/ 272*e2906a59SMasahiro YamadaLIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/ 273*e2906a59SMasahiro YamadaLIBS-y += drivers/serial/ 274*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/eth/ 275*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/gadget/ 276*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/host/ 277*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb/ 278*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb-new/ 279*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/phy/ 280*e2906a59SMasahiro YamadaLIBS-y += drivers/usb/ulpi/ 281*e2906a59SMasahiro YamadaLIBS-y += common/ 282*e2906a59SMasahiro YamadaLIBS-y += lib/libfdt/ 283*e2906a59SMasahiro YamadaLIBS-y += api/ 284*e2906a59SMasahiro YamadaLIBS-y += post/ 285*e2906a59SMasahiro YamadaLIBS-y += test/ 286f9328639SMarian Balakowicz 28724e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) 288*e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/imx-common/ 28918936ee2SJason Liuendif 29018936ee2SJason Liu 291*e2906a59SMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/ 292*e2906a59SMasahiro YamadaLIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ 293852bd07cSMinkyu Kang 294*e2906a59SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/ 29508e39a84SMasahiro Yamada 296*e2906a59SMasahiro YamadaLIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) 297f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y))) 298249b53a6SLoïc Minier.PHONY : $(LIBS) 299a8c7c708Swdenk 3004f7cb08eSwdenk# Add GCC lib 30152b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC 30252b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes") 303635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o 30452b1bf2cSWolfgang Denkelse 30552b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc 30652b1bf2cSWolfgang Denkendif 30752b1bf2cSWolfgang Denkelse 308cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc 30952b1bf2cSWolfgang Denkendif 31052b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC) 31152b1bf2cSWolfgang Denkexport PLATFORM_LIBS 3123d3befa7Swdenk 3136ac9f479SMike Frysinger# Special flags for CPP when processing the linker script. 3146ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility 3156ac9f479SMike Frysinger# on the fly. 3166ac9f479SMike FrysingerLDPPFLAGS += \ 3176ac9f479SMike Frysinger -include $(TOPDIR)/include/u-boot/u-boot.lds.h \ 3187e6403a6SSimon Glass -DCPUDIR=$(CPUDIR) \ 3196ac9f479SMike Frysinger $(shell $(LD) --version | \ 3206ac9f479SMike Frysinger sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') 3216ac9f479SMike Frysinger 322f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS)) 32308e39a84SMasahiro Yamada__LIBS := $(subst $(obj),,$(LIBS)) 324f9328639SMarian Balakowicz 3257ebf7443Swdenk######################################################################### 326bdccc4feSwdenk######################################################################### 3277ebf7443Swdenk 328f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),) 329f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \ 330f3a14d37SMike Frysinger @actual=`wc -c $@ | awk '{print $$1}'`; \ 331d060e6f4SJoe Hershberger limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ 332f3a14d37SMike Frysinger if test $$actual -gt $$limit; then \ 333d060e6f4SJoe Hershberger echo "$@ exceeds file size limit:" >&2 ; \ 334d060e6f4SJoe Hershberger echo " limit: $$limit bytes" >&2 ; \ 335d060e6f4SJoe Hershberger echo " actual: $$actual bytes" >&2 ; \ 336d060e6f4SJoe Hershberger echo " excess: $$((actual - limit)) bytes" >&2; \ 337f3a14d37SMike Frysinger exit 1; \ 338f3a14d37SMike Frysinger fi 339f3a14d37SMike Frysingerelse 340f3a14d37SMike FrysingerBOARD_SIZE_CHECK = 341f3a14d37SMike Frysingerendif 342f3a14d37SMike Frysinger 3433e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones 3444e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map 345e935a374SHaiying Wang 3464e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin 3474e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin 348262737f0SShaohui XieALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl 3495df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin 3504c267374SHenrik NordströmALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img 3513aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin 3522c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin 353b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),) 354b343bbb5SVadim BendeburyALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET)) 355b343bbb5SVadim Bendeburyendif 3567ebf7443Swdenk 35712b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra 3586d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 35912b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y) 36012b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin 36112b7b70cSAllen Martinelse 36212b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin 36312b7b70cSAllen Martinendif 36412b7b70cSAllen Martinendif 36512b7b70cSAllen Martin 36671f84ef0SMasahiro Yamadabuild := -f $(TOPDIR)/scripts/Makefile.build -C 36771f84ef0SMasahiro Yamada 368349e83f0SChe-liang Chiouall: $(ALL-y) $(SUBDIR_EXAMPLES) 3697ebf7443Swdenk 370501ebdf2SStephen Warren$(obj)u-boot.dtb: checkdtc $(obj)u-boot 371bcfe8fdfSMasahiro Yamada $(MAKE) $(build) dts binary 3722c0f79e4SSimon Glass mv $(obj)dts/dt.dtb $@ 3732c0f79e4SSimon Glass 3742c0f79e4SSimon Glass$(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb 3752c0f79e4SSimon Glass cat $^ >$@ 3762c0f79e4SSimon Glass 377f9328639SMarian Balakowicz$(obj)u-boot.hex: $(obj)u-boot 3786310eb9dSwdenk $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ 3796310eb9dSwdenk 380f9328639SMarian Balakowicz$(obj)u-boot.srec: $(obj)u-boot 3810817d688SRicardo Ribalda Delgado $(OBJCOPY) -O srec $< $@ 3827ebf7443Swdenk 383f9328639SMarian Balakowicz$(obj)u-boot.bin: $(obj)u-boot 3847ebf7443Swdenk $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ 385f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 3867ebf7443Swdenk 38794a91e24SMike Frysinger$(obj)u-boot.ldr: $(obj)u-boot 38876d82187SMike Frysinger $(CREATE_LDR_ENV) 38968e56324SMike Frysinger $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) 390f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 39194a91e24SMike Frysinger 39294a91e24SMike Frysinger$(obj)u-boot.ldr.hex: $(obj)u-boot.ldr 39394a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary 39494a91e24SMike Frysinger 39594a91e24SMike Frysinger$(obj)u-boot.ldr.srec: $(obj)u-boot.ldr 39694a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary 39794a91e24SMike Frysinger 398b40bda6bSStefan Roese# 399b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot 400b40bda6bSStefan Roese# from the SPL U-Boot version. 401b40bda6bSStefan Roese# 402b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START 403b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0 404b40bda6bSStefan Roeseendif 405b40bda6bSStefan Roese 406f9328639SMarian Balakowicz$(obj)u-boot.img: $(obj)u-boot.bin 407a2a0a717SWolfgang Denk $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ 408b40bda6bSStefan Roese -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \ 409b40bda6bSStefan Roese -e $(CONFIG_SYS_UBOOT_START) \ 410881a87ecSWolfgang Denk -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ 411bdccc4feSwdenk sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ 412bdccc4feSwdenk -d $< $@ 413bdccc4feSwdenk 414291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend 41571f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx 4168edcde5eSStefano Babic 417aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb: $(obj)u-boot.bin 41831d80c77SPrafulla Wadaskar $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \ 4192ea88b06SEric Cooper -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ 420aa0c7a86SPrafulla Wadaskar 4215d898a00SShaohui Xie$(obj)u-boot.pbl: $(obj)u-boot.bin 4225d898a00SShaohui Xie $(obj)tools/mkimage -n $(CONFIG_PBLRCW_CONFIG) \ 4235d898a00SShaohui Xie -R $(CONFIG_PBLPBI_CONFIG) -T pblimage \ 4245d898a00SShaohui Xie -d $< $@ 4255d898a00SShaohui Xie 426566a494fSHeiko Schocher$(obj)u-boot.sha1: $(obj)u-boot.bin 42701159530SHeiko Schocher $(obj)tools/ubsha1 $(obj)u-boot.bin 428566a494fSHeiko Schocher 429f9328639SMarian Balakowicz$(obj)u-boot.dis: $(obj)u-boot 4307ebf7443Swdenk $(OBJDUMP) -d $< > $@ 4317ebf7443Swdenk 4323aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate, 4333aa29de0SYing Zhang# $(4) is pad-to 4343aa29de0SYing ZhangSPL_PAD_APPEND = \ 4353aa29de0SYing Zhang $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \ 4363aa29de0SYing Zhang $(1) $(obj)$(3); \ 437b6df9b01SYork Sun cat $(obj)$(3) $(2) > $@; \ 4383aa29de0SYing Zhang rm $(obj)$(3) 43974752baaSScott Wood 4403aa29de0SYing Zhangifdef CONFIG_TPL 4413aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin 4423aa29de0SYing Zhangelse 4433aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin 4443aa29de0SYing Zhangendif 44574752baaSScott Wood 4463aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD) 4473aa29de0SYing Zhang $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO)) 4483aa29de0SYing Zhang 4493aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin 450b6df9b01SYork Sun $(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO)) 4517816f2cfSHeiko Schocher 452ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 45371f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \ 454ba597609SBenoît Thébaudeau $(OBJTREE)/u-boot-with-spl.imx 455ba597609SBenoît Thébaudeau 4567d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 45771f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \ 4587d5a5c79SBenoît Thébaudeau $(OBJTREE)/u-boot-with-nand-spl.imx 4597d5a5c79SBenoît Thébaudeau 4605364add4SScott Wood$(obj)u-boot.ubl: $(obj)u-boot-with-spl.bin 461277f00f5SJosé Miguel Gonçalves $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \ 4625364add4SScott Wood -e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl 463277f00f5SJosé Miguel Gonçalves 4643f7f2414STom Rini$(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 4656d660e77SSughosh Ganu $(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \ 4666d660e77SSughosh Ganu -T aisimage \ 467d36d8859SChristian Riesch -e $(CONFIG_SPL_TEXT_BASE) \ 468d36d8859SChristian Riesch -d $(obj)spl/u-boot-spl.bin \ 469d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais 470d36d8859SChristian Riesch $(OBJCOPY) ${OBJCFLAGS} -I binary \ 471d36d8859SChristian Riesch --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ 472d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais 4733f7f2414STom Rini cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \ 474d36d8859SChristian Riesch $(obj)u-boot.ais 475d36d8859SChristian Riesch 476a5453555SOtavio Salvador 47730b9b932SMarek Vasut$(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin 478edabc1bcSMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb 47930b9b932SMarek Vasut 48094aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. 48194aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM 48294aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the 48394aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image 48494aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit. 48594aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr 48694aebe6cSStefan Roese$(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin 48794aebe6cSStefan Roese $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ 48894aebe6cSStefan Roese -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \ 48994aebe6cSStefan Roese -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.img 49094aebe6cSStefan Roese tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_SPL_PAD_TO) \ 49194aebe6cSStefan Roese of=$(obj)spl/u-boot-spl-pad.img 2>/dev/null 49294aebe6cSStefan Roese dd if=$(obj)spl/u-boot-spl.img of=$(obj)spl/u-boot-spl-pad.img \ 49394aebe6cSStefan Roese conv=notrunc 2>/dev/null 49494aebe6cSStefan Roese cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img > $@ 49594aebe6cSStefan Roese 4966d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 4979972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 498e4ec9346SStephen Warren $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin 4999972db5cSStephen Warren cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@ 500e4ec9346SStephen Warren rm $(obj)spl/u-boot-spl-pad.bin 5019972db5cSStephen Warren 5029972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y) 5039972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb 5049972db5cSStephen Warren cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@ 5059972db5cSStephen Warrenendif 506984df4ecSAllen Martinendif 507984df4ecSAllen Martin 508fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 509fb3d2b8aSStefan Roese cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@ 510fb3d2b8aSStefan Roese 511ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector 512ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target 513ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot 514ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat 515ecddccd0SStefan Roese# the SPL image to the end. 516ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 517ecddccd0SStefan Roese tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_UBOOT_PAD_TO) \ 518ecddccd0SStefan Roese of=$(obj)u-boot-pad.img 2>/dev/null 519ecddccd0SStefan Roese dd if=$(obj)u-boot.img of=$(obj)u-boot-pad.img \ 520ecddccd0SStefan Roese conv=notrunc 2>/dev/null 521ecddccd0SStefan Roese cat $(obj)u-boot-pad.img $(obj)spl/u-boot-spl.bin > $@ 522ecddccd0SStefan Roese 52386eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y) 52486eb49b3SSimon GlassGEN_UBOOT = \ 52586eb49b3SSimon Glass cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ 52686eb49b3SSimon Glass -Wl,--start-group $(__LIBS) -Wl,--end-group \ 52786eb49b3SSimon Glass $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot 52886eb49b3SSimon Glasselse 529ecb1dc89SMike FrysingerGEN_UBOOT = \ 53097b24d3dSMarek Vasut cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ 531ef123c52SAlbert ARIBAUD $(__OBJS) \ 532f9328639SMarian Balakowicz --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ 533b2184c31Swdenk -Map u-boot.map -o u-boot 53486eb49b3SSimon Glassendif 53586eb49b3SSimon Glass 53616a354f9SWolfgang Denk$(obj)u-boot: depend \ 53708e39a84SMasahiro Yamada $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds 538ecb1dc89SMike Frysinger $(GEN_UBOOT) 539ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y) 5408a156fb6SMike Frysinger smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \ 5411aada9cdSWolfgang Denk awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ 5421aada9cdSWolfgang Denk $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \ 5431aada9cdSWolfgang Denk -c common/system_map.c -o $(obj)common/system_map.o 544ecb1dc89SMike Frysinger $(GEN_UBOOT) $(obj)common/system_map.o 545ecb1dc89SMike Frysingerendif 5467ebf7443Swdenk 5473bddafaaSMasahiro Yamada$(OBJS): 5483bddafaaSMasahiro Yamada @: 549f9328639SMarian Balakowicz 550349e83f0SChe-liang Chiou$(LIBS): depend $(SUBDIR_TOOLS) 5513bddafaaSMasahiro Yamada $(MAKE) $(build) $(dir $(subst $(obj),,$@)) 552a8c7c708Swdenk 553d0d6144eSPeter Tyser$(SUBDIRS): depend 554b028f715Swdenk $(MAKE) -C $@ all 5557ebf7443Swdenk 556349e83f0SChe-liang Chiou$(SUBDIR_EXAMPLES): $(obj)u-boot 557349e83f0SChe-liang Chiou 558d0d6144eSPeter Tyser$(LDSCRIPT): depend 559f65c9812SMike Frysinger $(MAKE) -C $(dir $@) $(notdir $@) 560f65c9812SMike Frysinger 561ef123c52SAlbert ARIBAUD$(obj)u-boot.lds: $(LDSCRIPT) 56297b24d3dSMarek Vasut $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@ 5631aada9cdSWolfgang Denk 564e935a374SHaiying Wangnand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend 5658318fbf8SMarian Balakowicz $(MAKE) -C nand_spl/board/$(BOARDDIR) all 566887e2ec9SStefan Roese 567e935a374SHaiying Wang$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin 5688318fbf8SMarian Balakowicz cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin 569887e2ec9SStefan Roese 570bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend 5715df2ee27SDaniel Schwierzeck $(MAKE) -C spl all 5725df2ee27SDaniel Schwierzeck 5733aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend 5743aa29de0SYing Zhang $(MAKE) -C spl all CONFIG_TPL_BUILD=y 5753aa29de0SYing Zhang 576f9328639SMarian Balakowiczupdater: 5770358df42SMike Frysinger $(MAKE) -C tools/updater all 5788f713fdfSdzu 5792a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent 5802a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously. 58116a354f9SWolfgang Denkdepend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ 58239bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 5833aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 58416a354f9SWolfgang Denk $(obj)include/autoconf.mk \ 585a4814a69SStefano Babic $(obj)include/generated/generic-asm-offsets.h \ 586a4814a69SStefano Babic $(obj)include/generated/asm-offsets.h 5877ebf7443Swdenk 588e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS) 589e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS)) 590a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include 591a340c325SJean-Christophe PLAGNIOL-VILLARD 592857d9ea6SHorst KronstorferFIND := find 593857d9ea6SHorst KronstorferFINDFLAGS := -L 594857d9ea6SHorst Kronstorfer 5951064d980STom Rinicheckstack: 5961064d980STom Rini $(CROSS_COMPILE)objdump -d $(obj)u-boot \ 5971064d980STom Rini `$(FIND) $(obj) -name u-boot-spl -print` | \ 5981064d980STom Rini perl $(src)tools/checkstack.pl $(ARCH) 5991064d980STom Rini 600f9328639SMarian Balakowicztags ctags: 601857d9ea6SHorst Kronstorfer ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 602e5e4e705SLi Yang -name '*.[chS]' -print` 6037ebf7443Swdenk 6047ebf7443Swdenketags: 605857d9ea6SHorst Kronstorfer etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 606e5e4e705SLi Yang -name '*.[chS]' -print` 607ffda586fSLi Yangcscope: 608857d9ea6SHorst Kronstorfer $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ 609857d9ea6SHorst Kronstorfer cscope.files 610ffda586fSLi Yang cscope -b -q -k 6117ebf7443Swdenk 612ecb1dc89SMike FrysingerSYSTEM_MAP = \ 613ecb1dc89SMike Frysinger $(NM) $1 | \ 6147ebf7443Swdenk grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ 615ecb1dc89SMike Frysinger LC_ALL=C sort 616ecb1dc89SMike Frysinger$(obj)System.map: $(obj)u-boot 617ecb1dc89SMike Frysinger @$(call SYSTEM_MAP,$<) > $(obj)System.map 6187ebf7443Swdenk 61906a119a0STom Rinicheckthumb: 62006a119a0STom Rini @if test $(call cc-version) -lt 0404; then \ 62106a119a0STom Rini echo -n '*** Your GCC does not produce working '; \ 62206a119a0STom Rini echo 'binaries in THUMB mode.'; \ 62306a119a0STom Rini echo '*** Your board is configured for THUMB mode.'; \ 62406a119a0STom Rini false; \ 62506a119a0STom Rini fi 6266ec63f41SScott Wood 6276ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation 6286ec63f41SScott Wood# that U-Boot wants. 6296ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html 6306ec63f41SScott Woodcheckgcc4: 6316ec63f41SScott Wood @if test $(call cc-version) -lt 0400; then \ 6326ec63f41SScott Wood echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \ 6336ec63f41SScott Wood false; \ 6346ec63f41SScott Wood fi 6356ec63f41SScott Wood 636501ebdf2SStephen Warrencheckdtc: 637501ebdf2SStephen Warren @if test $(call dtc-version) -lt 0104; then \ 638501ebdf2SStephen Warren echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ 639501ebdf2SStephen Warren false; \ 640501ebdf2SStephen Warren fi 641501ebdf2SStephen Warren 6422f155f6cSGrant Likely# 6432f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles) 6442f155f6cSGrant Likely# 6452f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. 6462f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when 6472f155f6cSGrant Likely# to regenerate the autoconf.mk file. 6481510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h 6491510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 65016fe7775SMike Frysinger set -e ; \ 651ae6d1056SWolfgang Denk : Generate the dependancies ; \ 6524c34b2a0SMike Frysinger $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \ 6531510b82dSWolfgang Denk -MQ $(obj)include/autoconf.mk include/common.h > $@ 6541510b82dSWolfgang Denk 6551510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h 6561510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 6571510b82dSWolfgang Denk set -e ; \ 658ae6d1056SWolfgang Denk : Extract the config macros ; \ 6591510b82dSWolfgang Denk $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ 6604a0f7538SWolfgang Denk sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 6614a0f7538SWolfgang Denk mv $@.tmp $@ 6622f155f6cSGrant Likely 66339bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) 6643aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h 6653aa29de0SYing Zhang @$(XECHO) Generating $@ ; \ 6663aa29de0SYing Zhang set -e ; \ 6673aa29de0SYing Zhang : Extract the config macros ; \ 6683aa29de0SYing Zhang $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\ 6693aa29de0SYing Zhang -DDO_DEPS_ONLY -dM include/common.h | \ 6703aa29de0SYing Zhang sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 6713aa29de0SYing Zhang mv $@.tmp $@ 6723aa29de0SYing Zhang 67339bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h 67439bc12ddSJoel Fernandes @$(XECHO) Generating $@ ; \ 67539bc12ddSJoel Fernandes set -e ; \ 67639bc12ddSJoel Fernandes : Extract the config macros ; \ 67739bc12ddSJoel Fernandes $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \ 67839bc12ddSJoel Fernandes sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 67939bc12ddSJoel Fernandes mv $@.tmp $@ 68039bc12ddSJoel Fernandes 68116a354f9SWolfgang Denk$(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ 68239bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 6833aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 68416a354f9SWolfgang Denk $(obj)lib/asm-offsets.s 68516a354f9SWolfgang Denk @$(XECHO) Generating $@ 68616a354f9SWolfgang Denk tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@ 68716a354f9SWolfgang Denk 68816a354f9SWolfgang Denk$(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ 68939bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 6903aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 69116a354f9SWolfgang Denk $(src)lib/asm-offsets.c 69216a354f9SWolfgang Denk @mkdir -p $(obj)lib 69316a354f9SWolfgang Denk $(CC) -DDO_DEPS_ONLY \ 69416a354f9SWolfgang Denk $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 69516a354f9SWolfgang Denk -o $@ $(src)lib/asm-offsets.c -c -S 69616a354f9SWolfgang Denk 697a4814a69SStefano Babic$(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \ 69839bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 6993aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 700a4814a69SStefano Babic $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 701b12734eeSWolfgang Denk @$(XECHO) Generating $@ 702a4814a69SStefano Babic tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@ 703a4814a69SStefano Babic 70439bc12ddSJoel Fernandes$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep \ 7053aa29de0SYing Zhang $(obj)include/spl-autoconf.mk \ 7063aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk 707a4814a69SStefano Babic @mkdir -p $(obj)$(CPUDIR)/$(SOC) 708a4814a69SStefano Babic if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ 709a4814a69SStefano Babic $(CC) -DDO_DEPS_ONLY \ 710a4814a69SStefano Babic $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 711a4814a69SStefano Babic -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \ 712a4814a69SStefano Babic else \ 713a4814a69SStefano Babic touch $@; \ 714a4814a69SStefano Babic fi 715a4814a69SStefano Babic 7167ebf7443Swdenk######################################################################### 717ae6d1056SWolfgang Denkelse # !config.mk 718f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ 719f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \ 720249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \ 7210358df42SMike Frysingerupdater depend dep tags ctags etags cscope $(obj)System.map: 7227ebf7443Swdenk @echo "System not configured - see README" >&2 7237ebf7443Swdenk @ exit 1 724c7c0d542SMike Frysinger 725249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE) 7260358df42SMike Frysinger $(MAKE) -C $@ all 727ae6d1056SWolfgang Denkendif # config.mk 7287ebf7443Swdenk 729c37980c3SAlbert ARIBAUD# ARM relocations should all be R_ARM_RELATIVE. 730c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot 731c37980c3SAlbert ARIBAUD @if test "R_ARM_RELATIVE" != \ 732c1273d71SAndreas Bießmann "`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \ 733c37980c3SAlbert ARIBAUD then echo "$< contains relocations other than \ 734c37980c3SAlbert ARIBAUD R_ARM_RELATIVE"; false; fi 735c37980c3SAlbert ARIBAUD 73628abd48fSIlya Yanok$(VERSION_FILE): 73714ce91b1SMike Frysinger @mkdir -p $(dir $(VERSION_FILE)) 73828abd48fSIlya Yanok @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ 73928abd48fSIlya Yanok printf '#define PLAIN_VERSION "%s%s"\n' \ 74028abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 74128abd48fSIlya Yanok printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ 74228abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 74328abd48fSIlya Yanok ) > $@.tmp 74428abd48fSIlya Yanok @( printf '#define CC_VERSION_STRING "%s"\n' \ 74528abd48fSIlya Yanok '$(shell $(CC) --version | head -n 1)' )>> $@.tmp 74628abd48fSIlya Yanok @( printf '#define LD_VERSION_STRING "%s"\n' \ 74728abd48fSIlya Yanok '$(shell $(LD) -v | head -n 1)' )>> $@.tmp 74828abd48fSIlya Yanok @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 74928abd48fSIlya Yanok 750249b53a6SLoïc Minier$(TIMESTAMP_FILE): 751249b53a6SLoïc Minier @mkdir -p $(dir $(TIMESTAMP_FILE)) 752a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp 753a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp 754a76406fbSLoïc Minier @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 755249b53a6SLoïc Minier 7560358df42SMike Frysingereasylogo env gdb: 7570358df42SMike Frysinger $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} 7580358df42SMike Frysingergdbtools: gdb 7590358df42SMike Frysinger 76030ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc 76130ff8918SMarek Vasut $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@ 76230ff8918SMarek Vasut 763249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE) 7640358df42SMike Frysinger $(MAKE) -C tools HOST_TOOLS_ALL=y 7650358df42SMike Frysinger 7664e53a258SWolfgang Denk.PHONY : CHANGELOG 7674e53a258SWolfgang DenkCHANGELOG: 768b985b5d6SBen Warren git log --no-merges U-Boot-1_1_5.. | \ 769b985b5d6SBen Warren unexpand -a | sed -e 's/\s\s*$$//' > $@ 7704e53a258SWolfgang Denk 7710a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING 7720a823aa2SHarald Welte cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h 7737ebf7443Swdenk######################################################################### 7747ebf7443Swdenk 7757ebf7443Swdenkunconfig: 776887e2ec9SStefan Roese @rm -f $(obj)include/config.h $(obj)include/config.mk \ 7772f155f6cSGrant Likely $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ 77839bc12ddSJoel Fernandes $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ 7793aa29de0SYing Zhang $(obj)include/spl-autoconf.mk \ 7803aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk 7817ebf7443Swdenk 782a6862bc1SWolfgang Denk%_config:: unconfig 783a6862bc1SWolfgang Denk @$(MKCONFIG) -A $(@:_config=) 784a6862bc1SWolfgang Denk 785d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend 786d6a5e6d5SLoïc Minier$(obj).boards.depend: boards.cfg 78750c2a91bSMasahiro Yamada @awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@ 7889f4a4206SMike Frysinger 7898c994630SWolfgang Denk# 7908c994630SWolfgang Denk# Functions to generate common board directory names 7918c994630SWolfgang Denk# 7928c994630SWolfgang Denklcname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\L\1/') 7938c994630SWolfgang Denkucname = $(shell echo $(1) | sed -e 's/\(.*\)_config/\U\1/') 7948c994630SWolfgang Denk 795699f0512SWolfgang Denk######################################################################### 7963e38691eSwdenk######################################################################### 7977ebf7443Swdenk 7987ebf7443Swdenkclean: 7991bc15386SPeter Tyser @rm -f $(obj)examples/standalone/82559_eeprom \ 800d640ac58SWolfgang Denk $(obj)examples/standalone/atmel_df_pow2 \ 8011bc15386SPeter Tyser $(obj)examples/standalone/eepro100_eeprom \ 8021bc15386SPeter Tyser $(obj)examples/standalone/hello_world \ 8031bc15386SPeter Tyser $(obj)examples/standalone/interrupt \ 8041bc15386SPeter Tyser $(obj)examples/standalone/mem_to_mem_idma2intr \ 8051bc15386SPeter Tyser $(obj)examples/standalone/sched \ 806201a017cSMike Frysinger $(obj)examples/standalone/smc911{11,x}_eeprom \ 8071bc15386SPeter Tyser $(obj)examples/standalone/test_burst \ 8081bc15386SPeter Tyser $(obj)examples/standalone/timer 809d4abc757SPeter Tyser @rm -f $(obj)examples/api/demo{,.bin} 810f9301e1cSWolfgang Denk @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \ 811f9301e1cSWolfgang Denk $(obj)tools/env/{fw_printenv,fw_setenv} \ 812f9301e1cSWolfgang Denk $(obj)tools/envcrc \ 813f9301e1cSWolfgang Denk $(obj)tools/gdb/{astest,gdbcont,gdbsend} \ 814f9301e1cSWolfgang Denk $(obj)tools/gen_eth_addr $(obj)tools/img2srec \ 8157717fe10SHorst Kronstorfer $(obj)tools/mk{env,}image $(obj)tools/mpc86x_clk \ 816ad403e71SChander Kashyap $(obj)tools/mk{$(BOARD),}spl \ 8178aa09026SMarek Vasut $(obj)tools/mxsboot \ 81830ff8918SMarek Vasut $(obj)tools/ncb $(obj)tools/ubsha1 \ 8196c887b2aSSimon Glass $(obj)tools/kernel-doc/docproc \ 8206c887b2aSSimon Glass $(obj)tools/proftool 821f9301e1cSWolfgang Denk @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \ 82274c7a95fSWolfgang Denk $(obj)board/matrix_vision/*/bootscript.img \ 823566e5cf4SWolfgang Denk $(obj)board/voiceblue/eeprom \ 8241aada9cdSWolfgang Denk $(obj)u-boot.lds \ 825fb5166ceSMike Frysinger $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ 826fb5166ceSMike Frysinger $(obj)arch/blackfin/cpu/init.{lds,elf} 827dc7746d8SWolfgang Denk @rm -f $(obj)include/bmp_logo.h 828c270730fSChe-Liang Chiou @rm -f $(obj)include/bmp_logo_data.h 82916a354f9SWolfgang Denk @rm -f $(obj)lib/asm-offsets.s 830a4814a69SStefano Babic @rm -f $(obj)include/generated/asm-offsets.h 831a4814a69SStefano Babic @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 832d4abc757SPeter Tyser @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) 833b3141fdbSAndreas Bießmann @$(MAKE) -s -C doc/DocBook/ cleandocs 834ae6d1056SWolfgang Denk @find $(OBJTREE) -type f \ 8354a30f1e8STom Rini \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \ 83671a988aaSTroy Kisky -o -name '*.o' -o -name '*.a' -o -name '*.exe' \ 83771a988aaSTroy Kisky -o -name '*.cfgtmp' \) -print \ 8387ebf7443Swdenk | xargs rm -f 8397ebf7443Swdenk 840734329f9SAndy Fleming# Removes everything not needed for testing u-boot 841734329f9SAndy Flemingtidy: clean 842734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f 843734329f9SAndy Fleming 844734329f9SAndy Flemingclobber: tidy 845734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.srec' \ 846734329f9SAndy Fleming -o -name '*.bin' -o -name u-boot.img \) \ 847734329f9SAndy Fleming -print0 | xargs -0 rm -f 848ffda586fSLi Yang @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ 8495013c09fSWolfgang Denk $(obj)cscope.* $(obj)*.*~ 8504e0fbb98SDaniel Schwierzeck @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y) 851aa0c7a86SPrafulla Wadaskar @rm -f $(obj)u-boot.kwb 8525d898a00SShaohui Xie @rm -f $(obj)u-boot.pbl 853c5fb70c9SStefano Babic @rm -f $(obj)u-boot.imx 854ba597609SBenoît Thébaudeau @rm -f $(obj)u-boot-with-spl.imx 8557d5a5c79SBenoît Thébaudeau @rm -f $(obj)u-boot-with-nand-spl.imx 8567816f2cfSHeiko Schocher @rm -f $(obj)u-boot.ubl 857d36d8859SChristian Riesch @rm -f $(obj)u-boot.ais 858bbb0b128SSimon Glass @rm -f $(obj)u-boot.dtb 85930b9b932SMarek Vasut @rm -f $(obj)u-boot.sb 860714dc001SMarek Vasut @rm -f $(obj)u-boot.bd 86194aebe6cSStefan Roese @rm -f $(obj)u-boot.spr 86297b24d3dSMarek Vasut @rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map} 86397b24d3dSMarek Vasut @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map} 86497b24d3dSMarek Vasut @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map} 865ef123c52SAlbert ARIBAUD @rm -f $(obj)spl/u-boot-spl.lds 8663aa29de0SYing Zhang @rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map} 8673aa29de0SYing Zhang @rm -f $(obj)tpl/u-boot-spl.lds 86894bcfe52SNishanth Menon @rm -f $(obj)MLO MLO.byteswap 869a3cbc396SStefano Babic @rm -f $(obj)SPL 8708b425b3fSDaniel Schwierzeck @rm -f $(obj)tools/xway-swap-bytes 871a47a12beSStefan Roese @rm -f $(obj)arch/powerpc/cpu/mpc824x/bedbug_603e.c 8722d14e36aSYork Sun @rm -f $(obj)arch/powerpc/cpu/mpc83xx/ddr-gen?.c 873a9d8bc98SLoïc Minier @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm 87416a354f9SWolfgang Denk @rm -fr $(obj)include/generated 875a958b663SJean-Christophe PLAGNIOL-VILLARD @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f 876bbb0b128SSimon Glass @rm -f $(obj)dts/*.tmp 8776d660e77SSughosh Ganu @rm -f $(obj)spl/u-boot-spl{,-pad}.ais 8787ebf7443Swdenk 8797ebf7443Swdenkmrproper \ 8807ebf7443Swdenkdistclean: clobber unconfig 881afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE)) 882ae6d1056SWolfgang Denk rm -rf $(obj)* 883f9328639SMarian Balakowiczendif 8847ebf7443Swdenk 8857ebf7443Swdenkbackup: 8867ebf7443Swdenk F=`basename $(TOPDIR)` ; cd .. ; \ 887d6b93714SIlya Yanok gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F 8887ebf7443Swdenk 8897ebf7443Swdenk######################################################################### 890