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 8d19ad726STom RiniVERSION = 2014 9d19ad726STom RiniPATCHLEVEL = 01 10211e4754SWolfgang DenkSUBLEVEL = 11d19ad726STom RiniEXTRAVERSION = -rc1 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 Balakowiczifeq ("$(origin O)", "command line") 69f9328639SMarian BalakowiczBUILD_DIR := $(O) 70f9328639SMarian Balakowiczendif 717ebf7443Swdenk 724ab64933SKim Phillips# Call a source code checker (by default, "sparse") as part of the 734ab64933SKim Phillips# C compilation. 744ab64933SKim Phillips# 754ab64933SKim Phillips# Use 'make C=1' to enable checking of re-compiled files. 764ab64933SKim Phillips# 774ab64933SKim Phillips# See the linux kernel file "Documentation/sparse.txt" for more details, 784ab64933SKim Phillips# including where to get the "sparse" utility. 794ab64933SKim Phillips 804ab64933SKim Phillipsifdef C 814ab64933SKim Phillipsifeq ("$(origin C)", "command line") 824ab64933SKim PhillipsCHECKSRC := $(C) 834ab64933SKim Phillipsendif 844ab64933SKim Phillipsendif 854ab64933SKim Phillipsifndef CHECKSRC 864ab64933SKim Phillips CHECKSRC = 0 874ab64933SKim Phillipsendif 884ab64933SKim Phillipsexport CHECKSRC 894ab64933SKim Phillips 90f9328639SMarian Balakowiczifneq ($(BUILD_DIR),) 91f9328639SMarian Balakowiczsaved-output := $(BUILD_DIR) 924f0645ebSMarian Balakowicz 934f0645ebSMarian Balakowicz# Attempt to create a output directory. 944f0645ebSMarian Balakowicz$(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR}) 954f0645ebSMarian Balakowicz 964f0645ebSMarian Balakowicz# Verify if it was successful. 97f9328639SMarian BalakowiczBUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd) 98f9328639SMarian Balakowicz$(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) 99f9328639SMarian Balakowiczendif # ifneq ($(BUILD_DIR),) 100f9328639SMarian Balakowicz 101f9328639SMarian BalakowiczOBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) 102c8f9c302SDaniel SchwierzeckSPLTREE := $(OBJTREE)/spl 1033aa29de0SYing ZhangTPLTREE := $(OBJTREE)/tpl 104f9328639SMarian BalakowiczSRCTREE := $(CURDIR) 105f9328639SMarian BalakowiczTOPDIR := $(SRCTREE) 106f9328639SMarian BalakowiczLNDIR := $(OBJTREE) 1073aa29de0SYing Zhangexport TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE 108f9328639SMarian Balakowicz 109f9328639SMarian BalakowiczMKCONFIG := $(SRCTREE)/mkconfig 110f9328639SMarian Balakowiczexport MKCONFIG 111f9328639SMarian Balakowicz 112f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 113f9328639SMarian BalakowiczREMOTE_BUILD := 1 114f9328639SMarian Balakowiczexport REMOTE_BUILD 115f9328639SMarian Balakowiczendif 116f9328639SMarian Balakowicz 117f9328639SMarian Balakowicz# $(obj) and (src) are defined in config.mk but here in main Makefile 118f9328639SMarian Balakowicz# we also need them before config.mk is included which is the case for 119f9328639SMarian Balakowicz# some targets like unconfig, clean, clobber, distclean, etc. 120f9328639SMarian Balakowiczifneq ($(OBJTREE),$(SRCTREE)) 121f9328639SMarian Balakowiczobj := $(OBJTREE)/ 122f9328639SMarian Balakowiczsrc := $(SRCTREE)/ 123f9328639SMarian Balakowiczelse 124f9328639SMarian Balakowiczobj := 125f9328639SMarian Balakowiczsrc := 126f9328639SMarian Balakowiczendif 127f9328639SMarian Balakowiczexport obj src 128f9328639SMarian Balakowicz 1295013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere 1305013c09fSWolfgang Denkunexport CDPATH 1315013c09fSWolfgang Denk 132f9328639SMarian Balakowicz######################################################################### 133f9328639SMarian Balakowicz 1346d1ce387SMike Frysinger# The "tools" are needed early, so put this first 1356d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS) 136349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC 137349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled. 138349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools 139349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS) 1406d1ce387SMike Frysinger 141249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) 1426d1ce387SMike Frysinger 143ae6d1056SWolfgang Denkifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) 144f9328639SMarian Balakowicz 1452632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available 1462632c008SMike Frysinger# to all top level build files. We need the dummy all: target to prevent the 1472632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default. 1482632c008SMike Frysingerall: 1492632c008SMike Frysingersinclude $(obj)include/autoconf.mk.dep 1502632c008SMike Frysingersinclude $(obj)include/autoconf.mk 1512632c008SMike Frysinger 1528a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-y := examples/standalone 1538a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-$(CONFIG_API) += examples/api 154b5728756SSimon Glassifndef CONFIG_SANDBOX 1558a7e7d56SMasahiro YamadaSUBDIRS += $(SUBDIR_EXAMPLES-y) 156b5728756SSimon Glassendif 157b5728756SSimon Glass 1587ebf7443Swdenk# load ARCH, BOARD, and CPU configuration 159ae6d1056SWolfgang Denkinclude $(obj)include/config.mk 1601d9f4105Swdenkexport ARCH CPU BOARD VENDOR SOC 161f9328639SMarian Balakowicz 1621ea6bcd8SMike Frysinger# set default to nothing for native builds 163a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH)) 1641ea6bcd8SMike FrysingerCROSS_COMPILE ?= 1657ebf7443Swdenkendif 1667ebf7443Swdenk 16792b197f0SWolfgang Denk# load other configuration 16892b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk 16992b197f0SWolfgang Denk 170fada9e20SSimon Glass# Targets which don't build the source code 171fada9e20SSimon GlassNON_BUILD_TARGETS = backup clean clobber distclean mkproper tidy unconfig 172fada9e20SSimon Glass 173fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring 174fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),) 175fada9e20SSimon Glassifeq ($(findstring _config,$(MAKECMDGOALS)),) 176fada9e20SSimon Glass$(CHECK_GENERIC_BOARD) 177fada9e20SSimon Glassendif 178fada9e20SSimon Glassendif 179fada9e20SSimon Glass 180d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use 181d51dfff7SIlya Yanok# that (or fail if absent). Otherwise, search for a linker script in a 182d51dfff7SIlya Yanok# standard location. 183d51dfff7SIlya Yanok 184ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT)) 185ee60197eSSimon Glass 186d51dfff7SIlya Yanokifndef LDSCRIPT 187d51dfff7SIlya Yanok #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug 188d51dfff7SIlya Yanok ifdef CONFIG_SYS_LDSCRIPT 189d51dfff7SIlya Yanok # need to strip off double quotes 190d51dfff7SIlya Yanok LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT)) 191d51dfff7SIlya Yanok endif 192d51dfff7SIlya Yanokendif 193d51dfff7SIlya Yanok 194ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it 195d51dfff7SIlya Yanokifndef LDSCRIPT 196d51dfff7SIlya Yanok ifeq ($(CONFIG_NAND_U_BOOT),y) 197d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds 198d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 199d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds 200d51dfff7SIlya Yanok endif 201d51dfff7SIlya Yanok endif 202d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 203d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds 204d51dfff7SIlya Yanok endif 205d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 206d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds 207d51dfff7SIlya Yanok endif 208d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 209ee60197eSSimon Glass LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds 210ee60197eSSimon Glass # We don't expect a Makefile here 211ee60197eSSimon Glass LDSCRIPT_MAKEFILE_DIR = 212ee60197eSSimon Glass endif 213ee60197eSSimon Glass ifeq ($(wildcard $(LDSCRIPT)),) 214d51dfff7SIlya Yanok$(error could not find linker script) 215d51dfff7SIlya Yanok endif 216d51dfff7SIlya Yanokendif 217d51dfff7SIlya Yanok 2187ebf7443Swdenk######################################################################### 2197ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first) 2207ebf7443Swdenk 22103b7004dSPeter TyserOBJS = $(CPUDIR)/start.o 2227ebf7443Swdenkifeq ($(CPU),ppc4xx) 22303b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 2247ebf7443Swdenkendif 22542d1f039Swdenkifeq ($(CPU),mpc85xx) 22603b7004dSPeter TyserOBJS += $(CPUDIR)/resetvec.o 22742d1f039Swdenkendif 2287ebf7443Swdenk 229a32e626fSSimon GlassOBJS := $(addprefix $(obj),$(OBJS)) 230f9328639SMarian Balakowicz 2318b5a0264SDaniel SchwierzeckHAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n) 2328b5a0264SDaniel Schwierzeck 233e2906a59SMasahiro YamadaLIBS-y += lib/ 234e2906a59SMasahiro YamadaLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ 235e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/ 2361d9f4105Swdenkifdef SOC 237e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/$(SOC)/ 2381d9f4105Swdenkendif 239e2906a59SMasahiro YamadaLIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/ 240e2906a59SMasahiro YamadaLIBS-$(CONFIG_OF_EMBED) += dts/ 241e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/lib/ 24257c3e5fcSMasahiro YamadaLIBS-y += fs/ 243e2906a59SMasahiro YamadaLIBS-y += net/ 244e2906a59SMasahiro YamadaLIBS-y += disk/ 245e2906a59SMasahiro YamadaLIBS-y += drivers/ 246e2906a59SMasahiro YamadaLIBS-y += drivers/dma/ 247e2906a59SMasahiro YamadaLIBS-y += drivers/gpio/ 248e2906a59SMasahiro YamadaLIBS-y += drivers/i2c/ 249e2906a59SMasahiro YamadaLIBS-y += drivers/input/ 250e2906a59SMasahiro YamadaLIBS-y += drivers/mmc/ 251e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/ 252e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/nand/ 253e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/onenand/ 254e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/ubi/ 255e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/spi/ 256e2906a59SMasahiro YamadaLIBS-y += drivers/net/ 257e2906a59SMasahiro YamadaLIBS-y += drivers/net/phy/ 258e2906a59SMasahiro YamadaLIBS-y += drivers/pci/ 259e2906a59SMasahiro YamadaLIBS-y += drivers/power/ \ 260e2906a59SMasahiro Yamada drivers/power/fuel_gauge/ \ 261e2906a59SMasahiro Yamada drivers/power/mfd/ \ 262e2906a59SMasahiro Yamada drivers/power/pmic/ \ 263e2906a59SMasahiro Yamada drivers/power/battery/ 264e2906a59SMasahiro YamadaLIBS-y += drivers/spi/ 265e2906a59SMasahiro YamadaLIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/ 2665614e71bSYork SunLIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ 267e2906a59SMasahiro YamadaLIBS-y += drivers/serial/ 268e2906a59SMasahiro YamadaLIBS-y += drivers/usb/eth/ 269e2906a59SMasahiro YamadaLIBS-y += drivers/usb/gadget/ 270e2906a59SMasahiro YamadaLIBS-y += drivers/usb/host/ 271e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb/ 272e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb-new/ 273e2906a59SMasahiro YamadaLIBS-y += drivers/usb/phy/ 274e2906a59SMasahiro YamadaLIBS-y += drivers/usb/ulpi/ 275e2906a59SMasahiro YamadaLIBS-y += common/ 276e2906a59SMasahiro YamadaLIBS-y += lib/libfdt/ 2778a7e7d56SMasahiro YamadaLIBS-$(CONFIG_API) += api/ 278e2906a59SMasahiro YamadaLIBS-y += post/ 279e2906a59SMasahiro YamadaLIBS-y += test/ 280f9328639SMarian Balakowicz 28124e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) 282e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/imx-common/ 28318936ee2SJason Liuendif 28418936ee2SJason Liu 285e2906a59SMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/ 286e2906a59SMasahiro YamadaLIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ 287852bd07cSMinkyu Kang 288e2906a59SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/ 28908e39a84SMasahiro Yamada 290e2906a59SMasahiro YamadaLIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) 291f52d7b35SDaniel SchwierzeckLIBS := $(addprefix $(obj),$(sort $(LIBS-y))) 292249b53a6SLoïc Minier.PHONY : $(LIBS) 293a8c7c708Swdenk 2944f7cb08eSwdenk# Add GCC lib 29552b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC 29652b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes") 297635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o 29852b1bf2cSWolfgang Denkelse 29952b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc 30052b1bf2cSWolfgang Denkendif 30152b1bf2cSWolfgang Denkelse 302cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc 30352b1bf2cSWolfgang Denkendif 30452b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC) 30552b1bf2cSWolfgang Denkexport PLATFORM_LIBS 3063d3befa7Swdenk 3076ac9f479SMike Frysinger# Special flags for CPP when processing the linker script. 3086ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility 3096ac9f479SMike Frysinger# on the fly. 3106ac9f479SMike FrysingerLDPPFLAGS += \ 3116ac9f479SMike Frysinger -include $(TOPDIR)/include/u-boot/u-boot.lds.h \ 3127e6403a6SSimon Glass -DCPUDIR=$(CPUDIR) \ 3136ac9f479SMike Frysinger $(shell $(LD) --version | \ 3146ac9f479SMike Frysinger sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') 3156ac9f479SMike Frysinger 316f9328639SMarian Balakowicz__OBJS := $(subst $(obj),,$(OBJS)) 31708e39a84SMasahiro Yamada__LIBS := $(subst $(obj),,$(LIBS)) 318f9328639SMarian Balakowicz 3197ebf7443Swdenk######################################################################### 320bdccc4feSwdenk######################################################################### 3217ebf7443Swdenk 322f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),) 323f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \ 324f3a14d37SMike Frysinger @actual=`wc -c $@ | awk '{print $$1}'`; \ 325d060e6f4SJoe Hershberger limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ 326f3a14d37SMike Frysinger if test $$actual -gt $$limit; then \ 327d060e6f4SJoe Hershberger echo "$@ exceeds file size limit:" >&2 ; \ 328d060e6f4SJoe Hershberger echo " limit: $$limit bytes" >&2 ; \ 329d060e6f4SJoe Hershberger echo " actual: $$actual bytes" >&2 ; \ 330d060e6f4SJoe Hershberger echo " excess: $$((actual - limit)) bytes" >&2; \ 331f3a14d37SMike Frysinger exit 1; \ 332f3a14d37SMike Frysinger fi 333f3a14d37SMike Frysingerelse 334f3a14d37SMike FrysingerBOARD_SIZE_CHECK = 335f3a14d37SMike Frysingerendif 336f3a14d37SMike Frysinger 337*8137af19SScott Wood# Statically apply RELA-style relocations (currently arm64 only) 338*8137af19SScott Woodifneq ($(CONFIG_STATIC_RELA),) 339*8137af19SScott Wood# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base 340*8137af19SScott WoodDO_STATIC_RELA = \ 341*8137af19SScott Wood start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ 342*8137af19SScott Wood end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ 343*8137af19SScott Wood $(obj)tools/relocate-rela $(2) $(3) $$start $$end 344*8137af19SScott Woodelse 345*8137af19SScott WoodDO_STATIC_RELA = 346*8137af19SScott Woodendif 347*8137af19SScott Wood 3483e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones 3494e0fbb98SDaniel SchwierzeckALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map 350e935a374SHaiying Wang 3514e0fbb98SDaniel SchwierzeckALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin 3524e0fbb98SDaniel SchwierzeckALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin 353262737f0SShaohui XieALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl 3545df2ee27SDaniel SchwierzeckALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin 3554c267374SHenrik NordströmALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img 3563aa29de0SYing ZhangALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin 3572c0f79e4SSimon GlassALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin 358b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),) 359b343bbb5SVadim BendeburyALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET)) 360b343bbb5SVadim Bendeburyendif 3617ebf7443Swdenk 36212b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra 3636d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 3647dcd3a21SVidya Sagarifeq ($(CONFIG_SPL),y) 36512b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y) 36612b7b70cSAllen MartinALL-y += $(obj)u-boot-dtb-tegra.bin 36712b7b70cSAllen Martinelse 36812b7b70cSAllen MartinALL-y += $(obj)u-boot-nodtb-tegra.bin 36912b7b70cSAllen Martinendif 37012b7b70cSAllen Martinendif 3717dcd3a21SVidya Sagarendif 37212b7b70cSAllen Martin 37371f84ef0SMasahiro Yamadabuild := -f $(TOPDIR)/scripts/Makefile.build -C 37471f84ef0SMasahiro Yamada 3758a7e7d56SMasahiro Yamadaall: $(ALL-y) $(SUBDIR_EXAMPLES-y) 3767ebf7443Swdenk 377501ebdf2SStephen Warren$(obj)u-boot.dtb: checkdtc $(obj)u-boot 378bcfe8fdfSMasahiro Yamada $(MAKE) $(build) dts binary 3792c0f79e4SSimon Glass mv $(obj)dts/dt.dtb $@ 3802c0f79e4SSimon Glass 3812c0f79e4SSimon Glass$(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb 3822c0f79e4SSimon Glass cat $^ >$@ 3832c0f79e4SSimon Glass 384f9328639SMarian Balakowicz$(obj)u-boot.hex: $(obj)u-boot 3856310eb9dSwdenk $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ 3866310eb9dSwdenk 387f9328639SMarian Balakowicz$(obj)u-boot.srec: $(obj)u-boot 38847ed5dd0SAlbert ARIBAUD $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ 3897ebf7443Swdenk 390f9328639SMarian Balakowicz$(obj)u-boot.bin: $(obj)u-boot 3917ebf7443Swdenk $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ 392*8137af19SScott Wood $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) 393f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 3947ebf7443Swdenk 39594a91e24SMike Frysinger$(obj)u-boot.ldr: $(obj)u-boot 39676d82187SMike Frysinger $(CREATE_LDR_ENV) 39768e56324SMike Frysinger $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) 398f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 39994a91e24SMike Frysinger 40094a91e24SMike Frysinger$(obj)u-boot.ldr.hex: $(obj)u-boot.ldr 40194a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary 40294a91e24SMike Frysinger 40394a91e24SMike Frysinger$(obj)u-boot.ldr.srec: $(obj)u-boot.ldr 40494a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary 40594a91e24SMike Frysinger 406b40bda6bSStefan Roese# 407b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot 408b40bda6bSStefan Roese# from the SPL U-Boot version. 409b40bda6bSStefan Roese# 410b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START 411b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0 412b40bda6bSStefan Roeseendif 413b40bda6bSStefan Roese 414f9328639SMarian Balakowicz$(obj)u-boot.img: $(obj)u-boot.bin 415a2a0a717SWolfgang Denk $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ 416b40bda6bSStefan Roese -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \ 417b40bda6bSStefan Roese -e $(CONFIG_SYS_UBOOT_START) \ 418881a87ecSWolfgang Denk -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ 419bdccc4feSwdenk sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ 420bdccc4feSwdenk -d $< $@ 421bdccc4feSwdenk 422291b3dcdSOtavio Salvador$(obj)u-boot.imx: $(obj)u-boot.bin depend 42371f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx 4248edcde5eSStefano Babic 425aa0c7a86SPrafulla Wadaskar$(obj)u-boot.kwb: $(obj)u-boot.bin 42631d80c77SPrafulla Wadaskar $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \ 4272ea88b06SEric Cooper -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ 428aa0c7a86SPrafulla Wadaskar 4295d898a00SShaohui Xie$(obj)u-boot.pbl: $(obj)u-boot.bin 4305d898a00SShaohui Xie $(obj)tools/mkimage -n $(CONFIG_PBLRCW_CONFIG) \ 4315d898a00SShaohui Xie -R $(CONFIG_PBLPBI_CONFIG) -T pblimage \ 4325d898a00SShaohui Xie -d $< $@ 4335d898a00SShaohui Xie 434566a494fSHeiko Schocher$(obj)u-boot.sha1: $(obj)u-boot.bin 43501159530SHeiko Schocher $(obj)tools/ubsha1 $(obj)u-boot.bin 436566a494fSHeiko Schocher 437f9328639SMarian Balakowicz$(obj)u-boot.dis: $(obj)u-boot 4387ebf7443Swdenk $(OBJDUMP) -d $< > $@ 4397ebf7443Swdenk 4403aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate, 4413aa29de0SYing Zhang# $(4) is pad-to 4423aa29de0SYing ZhangSPL_PAD_APPEND = \ 4433aa29de0SYing Zhang $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \ 4443aa29de0SYing Zhang $(1) $(obj)$(3); \ 445b6df9b01SYork Sun cat $(obj)$(3) $(2) > $@; \ 4463aa29de0SYing Zhang rm $(obj)$(3) 44774752baaSScott Wood 4483aa29de0SYing Zhangifdef CONFIG_TPL 4493aa29de0SYing ZhangSPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin 4503aa29de0SYing Zhangelse 4513aa29de0SYing ZhangSPL_PAYLOAD := $(obj)u-boot.bin 4523aa29de0SYing Zhangendif 45374752baaSScott Wood 4543aa29de0SYing Zhang$(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD) 4553aa29de0SYing Zhang $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO)) 4563aa29de0SYing Zhang 4573aa29de0SYing Zhang$(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin 458b6df9b01SYork Sun $(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO)) 4597816f2cfSHeiko Schocher 460ba597609SBenoît Thébaudeau$(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 46171f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \ 462ba597609SBenoît Thébaudeau $(OBJTREE)/u-boot-with-spl.imx 463ba597609SBenoît Thébaudeau 4647d5a5c79SBenoît Thébaudeau$(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 46571f84ef0SMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \ 4667d5a5c79SBenoît Thébaudeau $(OBJTREE)/u-boot-with-nand-spl.imx 4677d5a5c79SBenoît Thébaudeau 4685364add4SScott Wood$(obj)u-boot.ubl: $(obj)u-boot-with-spl.bin 469277f00f5SJosé Miguel Gonçalves $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \ 4705364add4SScott Wood -e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl 471277f00f5SJosé Miguel Gonçalves 4723f7f2414STom Rini$(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 4736d660e77SSughosh Ganu $(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \ 4746d660e77SSughosh Ganu -T aisimage \ 475d36d8859SChristian Riesch -e $(CONFIG_SPL_TEXT_BASE) \ 476d36d8859SChristian Riesch -d $(obj)spl/u-boot-spl.bin \ 477d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais 478d36d8859SChristian Riesch $(OBJCOPY) ${OBJCFLAGS} -I binary \ 479d36d8859SChristian Riesch --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ 480d36d8859SChristian Riesch $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais 4813f7f2414STom Rini cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \ 482d36d8859SChristian Riesch $(obj)u-boot.ais 483d36d8859SChristian Riesch 484a5453555SOtavio Salvador 48530b9b932SMarek Vasut$(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin 486edabc1bcSMasahiro Yamada $(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb 48730b9b932SMarek Vasut 48894aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. 48994aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM 49094aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the 49194aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image 49294aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit. 49394aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr 49494aebe6cSStefan Roese$(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin 49594aebe6cSStefan Roese $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \ 49694aebe6cSStefan Roese -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \ 49794aebe6cSStefan Roese -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.img 49894aebe6cSStefan Roese tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_SPL_PAD_TO) \ 49994aebe6cSStefan Roese of=$(obj)spl/u-boot-spl-pad.img 2>/dev/null 50094aebe6cSStefan Roese dd if=$(obj)spl/u-boot-spl.img of=$(obj)spl/u-boot-spl-pad.img \ 50194aebe6cSStefan Roese conv=notrunc 2>/dev/null 50294aebe6cSStefan Roese cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img > $@ 50394aebe6cSStefan Roese 5046d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 5059972db5cSStephen Warren$(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin 506e4ec9346SStephen Warren $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin 5079972db5cSStephen Warren cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@ 508e4ec9346SStephen Warren rm $(obj)spl/u-boot-spl-pad.bin 5099972db5cSStephen Warren 5109972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y) 5119972db5cSStephen Warren$(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb 5129972db5cSStephen Warren cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@ 5139972db5cSStephen Warrenendif 514984df4ecSAllen Martinendif 515984df4ecSAllen Martin 516fb3d2b8aSStefan Roese$(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 517fb3d2b8aSStefan Roese cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@ 518fb3d2b8aSStefan Roese 519ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector 520ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target 521ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot 522ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat 523ecddccd0SStefan Roese# the SPL image to the end. 524ecddccd0SStefan Roese$(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img 525ecddccd0SStefan Roese tr "\000" "\377" < /dev/zero | dd ibs=1 count=$(CONFIG_UBOOT_PAD_TO) \ 526ecddccd0SStefan Roese of=$(obj)u-boot-pad.img 2>/dev/null 527ecddccd0SStefan Roese dd if=$(obj)u-boot.img of=$(obj)u-boot-pad.img \ 528ecddccd0SStefan Roese conv=notrunc 2>/dev/null 529ecddccd0SStefan Roese cat $(obj)u-boot-pad.img $(obj)spl/u-boot-spl.bin > $@ 530ecddccd0SStefan Roese 53186eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y) 53286eb49b3SSimon GlassGEN_UBOOT = \ 53386eb49b3SSimon Glass cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \ 53486eb49b3SSimon Glass -Wl,--start-group $(__LIBS) -Wl,--end-group \ 53586eb49b3SSimon Glass $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot 53686eb49b3SSimon Glasselse 537ecb1dc89SMike FrysingerGEN_UBOOT = \ 53897b24d3dSMarek Vasut cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ 539ef123c52SAlbert ARIBAUD $(__OBJS) \ 540f9328639SMarian Balakowicz --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \ 541b2184c31Swdenk -Map u-boot.map -o u-boot 54286eb49b3SSimon Glassendif 54386eb49b3SSimon Glass 54416a354f9SWolfgang Denk$(obj)u-boot: depend \ 54508e39a84SMasahiro Yamada $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds 546ecb1dc89SMike Frysinger $(GEN_UBOOT) 547ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y) 5488a156fb6SMike Frysinger smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \ 5491aada9cdSWolfgang Denk awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ 5501aada9cdSWolfgang Denk $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \ 5511aada9cdSWolfgang Denk -c common/system_map.c -o $(obj)common/system_map.o 552ecb1dc89SMike Frysinger $(GEN_UBOOT) $(obj)common/system_map.o 553ecb1dc89SMike Frysingerendif 5547ebf7443Swdenk 5553bddafaaSMasahiro Yamada$(OBJS): 5563bddafaaSMasahiro Yamada @: 557f9328639SMarian Balakowicz 558349e83f0SChe-liang Chiou$(LIBS): depend $(SUBDIR_TOOLS) 5593bddafaaSMasahiro Yamada $(MAKE) $(build) $(dir $(subst $(obj),,$@)) 560a8c7c708Swdenk 561d0d6144eSPeter Tyser$(SUBDIRS): depend 562b028f715Swdenk $(MAKE) -C $@ all 5637ebf7443Swdenk 5648a7e7d56SMasahiro Yamada$(SUBDIR_EXAMPLES-y): $(obj)u-boot 565349e83f0SChe-liang Chiou 566d0d6144eSPeter Tyser$(LDSCRIPT): depend 567f65c9812SMike Frysinger $(MAKE) -C $(dir $@) $(notdir $@) 568f65c9812SMike Frysinger 569ef123c52SAlbert ARIBAUD$(obj)u-boot.lds: $(LDSCRIPT) 57097b24d3dSMarek Vasut $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@ 5711aada9cdSWolfgang Denk 572e935a374SHaiying Wangnand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend 5738318fbf8SMarian Balakowicz $(MAKE) -C nand_spl/board/$(BOARDDIR) all 574887e2ec9SStefan Roese 575e935a374SHaiying Wang$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin 5768318fbf8SMarian Balakowicz cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin 577887e2ec9SStefan Roese 578bd25fdbaSAneesh V$(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend 5795df2ee27SDaniel Schwierzeck $(MAKE) -C spl all 5805df2ee27SDaniel Schwierzeck 5813aa29de0SYing Zhang$(obj)tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend 5823aa29de0SYing Zhang $(MAKE) -C spl all CONFIG_TPL_BUILD=y 5833aa29de0SYing Zhang 5842a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent 5852a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously. 58616a354f9SWolfgang Denkdepend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ 58739bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 5883aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 58916a354f9SWolfgang Denk $(obj)include/autoconf.mk \ 590a4814a69SStefano Babic $(obj)include/generated/generic-asm-offsets.h \ 591a4814a69SStefano Babic $(obj)include/generated/asm-offsets.h 5927ebf7443Swdenk 593e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS) 594e5e4e705SLi YangTAG_SUBDIRS += $(dir $(__LIBS)) 595a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include 596a340c325SJean-Christophe PLAGNIOL-VILLARD 597857d9ea6SHorst KronstorferFIND := find 598857d9ea6SHorst KronstorferFINDFLAGS := -L 599857d9ea6SHorst Kronstorfer 6001064d980STom Rinicheckstack: 6011064d980STom Rini $(CROSS_COMPILE)objdump -d $(obj)u-boot \ 6021064d980STom Rini `$(FIND) $(obj) -name u-boot-spl -print` | \ 6031064d980STom Rini perl $(src)tools/checkstack.pl $(ARCH) 6041064d980STom Rini 605f9328639SMarian Balakowicztags ctags: 606857d9ea6SHorst Kronstorfer ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 607e5e4e705SLi Yang -name '*.[chS]' -print` 6087ebf7443Swdenk 6097ebf7443Swdenketags: 610857d9ea6SHorst Kronstorfer etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 611e5e4e705SLi Yang -name '*.[chS]' -print` 612ffda586fSLi Yangcscope: 613857d9ea6SHorst Kronstorfer $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ 614857d9ea6SHorst Kronstorfer cscope.files 615ffda586fSLi Yang cscope -b -q -k 6167ebf7443Swdenk 617ecb1dc89SMike FrysingerSYSTEM_MAP = \ 618ecb1dc89SMike Frysinger $(NM) $1 | \ 6197ebf7443Swdenk grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ 620ecb1dc89SMike Frysinger LC_ALL=C sort 621ecb1dc89SMike Frysinger$(obj)System.map: $(obj)u-boot 622bc8bb6ecSMasahiro Yamada @$(call SYSTEM_MAP,$<) > $@ 6237ebf7443Swdenk 62406a119a0STom Rinicheckthumb: 62506a119a0STom Rini @if test $(call cc-version) -lt 0404; then \ 62606a119a0STom Rini echo -n '*** Your GCC does not produce working '; \ 62706a119a0STom Rini echo 'binaries in THUMB mode.'; \ 62806a119a0STom Rini echo '*** Your board is configured for THUMB mode.'; \ 62906a119a0STom Rini false; \ 63006a119a0STom Rini fi 6316ec63f41SScott Wood 6326ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation 6336ec63f41SScott Wood# that U-Boot wants. 6346ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html 6356ec63f41SScott Woodcheckgcc4: 6366ec63f41SScott Wood @if test $(call cc-version) -lt 0400; then \ 6376ec63f41SScott Wood echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \ 6386ec63f41SScott Wood false; \ 6396ec63f41SScott Wood fi 6406ec63f41SScott Wood 641501ebdf2SStephen Warrencheckdtc: 642501ebdf2SStephen Warren @if test $(call dtc-version) -lt 0104; then \ 643501ebdf2SStephen Warren echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ 644501ebdf2SStephen Warren false; \ 645501ebdf2SStephen Warren fi 646501ebdf2SStephen Warren 6472f155f6cSGrant Likely# 6482f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles) 6492f155f6cSGrant Likely# 6502f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. 6512f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when 6522f155f6cSGrant Likely# to regenerate the autoconf.mk file. 6531510b82dSWolfgang Denk$(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h 6541510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 65516fe7775SMike Frysinger set -e ; \ 656ae6d1056SWolfgang Denk : Generate the dependancies ; \ 6574c34b2a0SMike Frysinger $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \ 6581510b82dSWolfgang Denk -MQ $(obj)include/autoconf.mk include/common.h > $@ 6591510b82dSWolfgang Denk 6601510b82dSWolfgang Denk$(obj)include/autoconf.mk: $(obj)include/config.h 6611510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 6621510b82dSWolfgang Denk set -e ; \ 663ae6d1056SWolfgang Denk : Extract the config macros ; \ 6641510b82dSWolfgang Denk $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \ 6654a0f7538SWolfgang Denk sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 6664a0f7538SWolfgang Denk mv $@.tmp $@ 6672f155f6cSGrant Likely 66839bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) 6693aa29de0SYing Zhang$(obj)include/tpl-autoconf.mk: $(obj)include/config.h 6703aa29de0SYing Zhang @$(XECHO) Generating $@ ; \ 6713aa29de0SYing Zhang set -e ; \ 6723aa29de0SYing Zhang : Extract the config macros ; \ 6733aa29de0SYing Zhang $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\ 6743aa29de0SYing Zhang -DDO_DEPS_ONLY -dM include/common.h | \ 6753aa29de0SYing Zhang sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 6763aa29de0SYing Zhang mv $@.tmp $@ 6773aa29de0SYing Zhang 67839bc12ddSJoel Fernandes$(obj)include/spl-autoconf.mk: $(obj)include/config.h 67939bc12ddSJoel Fernandes @$(XECHO) Generating $@ ; \ 68039bc12ddSJoel Fernandes set -e ; \ 68139bc12ddSJoel Fernandes : Extract the config macros ; \ 68239bc12ddSJoel Fernandes $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \ 68339bc12ddSJoel Fernandes sed -n -f tools/scripts/define2mk.sed > $@.tmp && \ 68439bc12ddSJoel Fernandes mv $@.tmp $@ 68539bc12ddSJoel Fernandes 68616a354f9SWolfgang Denk$(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \ 68739bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 6883aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 68916a354f9SWolfgang Denk $(obj)lib/asm-offsets.s 69016a354f9SWolfgang Denk @$(XECHO) Generating $@ 69116a354f9SWolfgang Denk tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@ 69216a354f9SWolfgang Denk 69316a354f9SWolfgang Denk$(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ 69439bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 6953aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 69616a354f9SWolfgang Denk $(src)lib/asm-offsets.c 69716a354f9SWolfgang Denk @mkdir -p $(obj)lib 69816a354f9SWolfgang Denk $(CC) -DDO_DEPS_ONLY \ 69916a354f9SWolfgang Denk $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 70016a354f9SWolfgang Denk -o $@ $(src)lib/asm-offsets.c -c -S 70116a354f9SWolfgang Denk 702a4814a69SStefano Babic$(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \ 70339bc12ddSJoel Fernandes $(obj)include/spl-autoconf.mk \ 7043aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk \ 705a4814a69SStefano Babic $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 706b12734eeSWolfgang Denk @$(XECHO) Generating $@ 707a4814a69SStefano Babic tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@ 708a4814a69SStefano Babic 70939bc12ddSJoel Fernandes$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/autoconf.mk.dep \ 7103aa29de0SYing Zhang $(obj)include/spl-autoconf.mk \ 7113aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk 712a4814a69SStefano Babic @mkdir -p $(obj)$(CPUDIR)/$(SOC) 713a4814a69SStefano Babic if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ 714a4814a69SStefano Babic $(CC) -DDO_DEPS_ONLY \ 715a4814a69SStefano Babic $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 716a4814a69SStefano Babic -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \ 717a4814a69SStefano Babic else \ 718a4814a69SStefano Babic touch $@; \ 719a4814a69SStefano Babic fi 720a4814a69SStefano Babic 7217ebf7443Swdenk######################################################################### 722ae6d1056SWolfgang Denkelse # !config.mk 723f9328639SMarian Balakowiczall $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ 724f9328639SMarian Balakowicz$(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \ 725249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \ 7262e78e75eSMasahiro Yamadadepend dep tags ctags etags cscope $(obj)System.map: 7277ebf7443Swdenk @echo "System not configured - see README" >&2 7287ebf7443Swdenk @ exit 1 729c7c0d542SMike Frysinger 730249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE) 7310358df42SMike Frysinger $(MAKE) -C $@ all 732ae6d1056SWolfgang Denkendif # config.mk 7337ebf7443Swdenk 734c37980c3SAlbert ARIBAUD# ARM relocations should all be R_ARM_RELATIVE. 735c37980c3SAlbert ARIBAUDcheckarmreloc: $(obj)u-boot 736c37980c3SAlbert ARIBAUD @if test "R_ARM_RELATIVE" != \ 737c1273d71SAndreas Bießmann "`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \ 738c37980c3SAlbert ARIBAUD then echo "$< contains relocations other than \ 739c37980c3SAlbert ARIBAUD R_ARM_RELATIVE"; false; fi 740c37980c3SAlbert ARIBAUD 74128abd48fSIlya Yanok$(VERSION_FILE): 74214ce91b1SMike Frysinger @mkdir -p $(dir $(VERSION_FILE)) 74328abd48fSIlya Yanok @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ 74428abd48fSIlya Yanok printf '#define PLAIN_VERSION "%s%s"\n' \ 74528abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 74628abd48fSIlya Yanok printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ 74728abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 74828abd48fSIlya Yanok ) > $@.tmp 74928abd48fSIlya Yanok @( printf '#define CC_VERSION_STRING "%s"\n' \ 75028abd48fSIlya Yanok '$(shell $(CC) --version | head -n 1)' )>> $@.tmp 75128abd48fSIlya Yanok @( printf '#define LD_VERSION_STRING "%s"\n' \ 75228abd48fSIlya Yanok '$(shell $(LD) -v | head -n 1)' )>> $@.tmp 75328abd48fSIlya Yanok @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 75428abd48fSIlya Yanok 755249b53a6SLoïc Minier$(TIMESTAMP_FILE): 756249b53a6SLoïc Minier @mkdir -p $(dir $(TIMESTAMP_FILE)) 757a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp 758a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp 759a76406fbSLoïc Minier @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 760249b53a6SLoïc Minier 7610358df42SMike Frysingereasylogo env gdb: 7620358df42SMike Frysinger $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} 7630358df42SMike Frysingergdbtools: gdb 7640358df42SMike Frysinger 76530ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc 76630ff8918SMarek Vasut $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@ 76730ff8918SMarek Vasut 768249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE) 7690358df42SMike Frysinger $(MAKE) -C tools HOST_TOOLS_ALL=y 7700358df42SMike Frysinger 7714e53a258SWolfgang Denk.PHONY : CHANGELOG 7724e53a258SWolfgang DenkCHANGELOG: 773b985b5d6SBen Warren git log --no-merges U-Boot-1_1_5.. | \ 774b985b5d6SBen Warren unexpand -a | sed -e 's/\s\s*$$//' > $@ 7754e53a258SWolfgang Denk 7760a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING 7770a823aa2SHarald Welte cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h 7787ebf7443Swdenk######################################################################### 7797ebf7443Swdenk 7807ebf7443Swdenkunconfig: 781887e2ec9SStefan Roese @rm -f $(obj)include/config.h $(obj)include/config.mk \ 7822f155f6cSGrant Likely $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ 78339bc12ddSJoel Fernandes $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ 7843aa29de0SYing Zhang $(obj)include/spl-autoconf.mk \ 7853aa29de0SYing Zhang $(obj)include/tpl-autoconf.mk 7867ebf7443Swdenk 787a6862bc1SWolfgang Denk%_config:: unconfig 788a6862bc1SWolfgang Denk @$(MKCONFIG) -A $(@:_config=) 789a6862bc1SWolfgang Denk 790d6a5e6d5SLoïc Miniersinclude $(obj).boards.depend 791d6a5e6d5SLoïc Minier$(obj).boards.depend: boards.cfg 79250c2a91bSMasahiro Yamada @awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@ 7939f4a4206SMike Frysinger 794699f0512SWolfgang Denk######################################################################### 7953e38691eSwdenk######################################################################### 7967ebf7443Swdenk 7977ebf7443Swdenkclean: 7981bc15386SPeter Tyser @rm -f $(obj)examples/standalone/82559_eeprom \ 799d640ac58SWolfgang Denk $(obj)examples/standalone/atmel_df_pow2 \ 8001bc15386SPeter Tyser $(obj)examples/standalone/eepro100_eeprom \ 8011bc15386SPeter Tyser $(obj)examples/standalone/hello_world \ 8021bc15386SPeter Tyser $(obj)examples/standalone/interrupt \ 8031bc15386SPeter Tyser $(obj)examples/standalone/mem_to_mem_idma2intr \ 8041bc15386SPeter Tyser $(obj)examples/standalone/sched \ 805201a017cSMike Frysinger $(obj)examples/standalone/smc911{11,x}_eeprom \ 8061bc15386SPeter Tyser $(obj)examples/standalone/test_burst \ 8071bc15386SPeter Tyser $(obj)examples/standalone/timer 808d4abc757SPeter Tyser @rm -f $(obj)examples/api/demo{,.bin} 809f9301e1cSWolfgang Denk @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \ 810f9301e1cSWolfgang Denk $(obj)tools/env/{fw_printenv,fw_setenv} \ 811f9301e1cSWolfgang Denk $(obj)tools/envcrc \ 812f9301e1cSWolfgang Denk $(obj)tools/gdb/{astest,gdbcont,gdbsend} \ 813f9301e1cSWolfgang Denk $(obj)tools/gen_eth_addr $(obj)tools/img2srec \ 8147717fe10SHorst Kronstorfer $(obj)tools/mk{env,}image $(obj)tools/mpc86x_clk \ 815ad403e71SChander Kashyap $(obj)tools/mk{$(BOARD),}spl \ 8168aa09026SMarek Vasut $(obj)tools/mxsboot \ 81730ff8918SMarek Vasut $(obj)tools/ncb $(obj)tools/ubsha1 \ 8186c887b2aSSimon Glass $(obj)tools/kernel-doc/docproc \ 8196c887b2aSSimon Glass $(obj)tools/proftool 820f9301e1cSWolfgang Denk @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image} \ 82174c7a95fSWolfgang Denk $(obj)board/matrix_vision/*/bootscript.img \ 822566e5cf4SWolfgang Denk $(obj)board/voiceblue/eeprom \ 8231aada9cdSWolfgang Denk $(obj)u-boot.lds \ 824fb5166ceSMike Frysinger $(obj)arch/blackfin/cpu/init.{lds,elf} 825dc7746d8SWolfgang Denk @rm -f $(obj)include/bmp_logo.h 826c270730fSChe-Liang Chiou @rm -f $(obj)include/bmp_logo_data.h 82716a354f9SWolfgang Denk @rm -f $(obj)lib/asm-offsets.s 828a4814a69SStefano Babic @rm -f $(obj)include/generated/asm-offsets.h 829a4814a69SStefano Babic @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s 830d4abc757SPeter Tyser @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) 831b3141fdbSAndreas Bießmann @$(MAKE) -s -C doc/DocBook/ cleandocs 832ae6d1056SWolfgang Denk @find $(OBJTREE) -type f \ 8334a30f1e8STom Rini \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \ 83471a988aaSTroy Kisky -o -name '*.o' -o -name '*.a' -o -name '*.exe' \ 83571a988aaSTroy Kisky -o -name '*.cfgtmp' \) -print \ 8367ebf7443Swdenk | xargs rm -f 8377ebf7443Swdenk 838734329f9SAndy Fleming# Removes everything not needed for testing u-boot 839734329f9SAndy Flemingtidy: clean 840734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f 841734329f9SAndy Fleming 842734329f9SAndy Flemingclobber: tidy 843734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.srec' \ 844734329f9SAndy Fleming -o -name '*.bin' -o -name u-boot.img \) \ 845734329f9SAndy Fleming -print0 | xargs -0 rm -f 846ffda586fSLi Yang @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ 8475013c09fSWolfgang Denk $(obj)cscope.* $(obj)*.*~ 8484e0fbb98SDaniel Schwierzeck @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y) 849aa0c7a86SPrafulla Wadaskar @rm -f $(obj)u-boot.kwb 8505d898a00SShaohui Xie @rm -f $(obj)u-boot.pbl 851c5fb70c9SStefano Babic @rm -f $(obj)u-boot.imx 852ba597609SBenoît Thébaudeau @rm -f $(obj)u-boot-with-spl.imx 8537d5a5c79SBenoît Thébaudeau @rm -f $(obj)u-boot-with-nand-spl.imx 8547816f2cfSHeiko Schocher @rm -f $(obj)u-boot.ubl 855d36d8859SChristian Riesch @rm -f $(obj)u-boot.ais 856bbb0b128SSimon Glass @rm -f $(obj)u-boot.dtb 85730b9b932SMarek Vasut @rm -f $(obj)u-boot.sb 858714dc001SMarek Vasut @rm -f $(obj)u-boot.bd 85994aebe6cSStefan Roese @rm -f $(obj)u-boot.spr 86097b24d3dSMarek Vasut @rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map} 86197b24d3dSMarek Vasut @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map} 86297b24d3dSMarek Vasut @rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map} 863ef123c52SAlbert ARIBAUD @rm -f $(obj)spl/u-boot-spl.lds 8643aa29de0SYing Zhang @rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map} 8653aa29de0SYing Zhang @rm -f $(obj)tpl/u-boot-spl.lds 86694bcfe52SNishanth Menon @rm -f $(obj)MLO MLO.byteswap 867a3cbc396SStefano Babic @rm -f $(obj)SPL 8688b425b3fSDaniel Schwierzeck @rm -f $(obj)tools/xway-swap-bytes 869a9d8bc98SLoïc Minier @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm 87016a354f9SWolfgang Denk @rm -fr $(obj)include/generated 871a958b663SJean-Christophe PLAGNIOL-VILLARD @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f 872bbb0b128SSimon Glass @rm -f $(obj)dts/*.tmp 8736d660e77SSughosh Ganu @rm -f $(obj)spl/u-boot-spl{,-pad}.ais 8747ebf7443Swdenk 8757ebf7443Swdenkmrproper \ 8767ebf7443Swdenkdistclean: clobber unconfig 877afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE)) 878ae6d1056SWolfgang Denk rm -rf $(obj)* 879f9328639SMarian Balakowiczendif 8807ebf7443Swdenk 8817ebf7443Swdenkbackup: 8827ebf7443Swdenk F=`basename $(TOPDIR)` ; cd .. ; \ 883d6b93714SIlya Yanok gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F 8847ebf7443Swdenk 8857ebf7443Swdenk######################################################################### 886