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 = 11b44bd2c7STom RiniEXTRAVERSION = 128b9e4787SWolfgang Denkifneq "$(SUBLEVEL)" "" 13881a87ecSWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 148b9e4787SWolfgang Denkelse 158b9e4787SWolfgang DenkU_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) 168b9e4787SWolfgang Denkendif 17*9e414032SMasahiro YamadaTIMESTAMP_FILE = include/generated/timestamp_autogenerated.h 18*9e414032SMasahiro YamadaVERSION_FILE = 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 46*9e414032SMasahiro Yamada# kbuild supports saving output files in a separate directory. 47*9e414032SMasahiro Yamada# To locate output files in a separate directory two syntaxes are supported. 48*9e414032SMasahiro Yamada# In both cases the working directory must be the root of the kernel src. 49*9e414032SMasahiro Yamada# 1) O= 50*9e414032SMasahiro Yamada# Use "make O=dir/to/store/output/files/" 51f9328639SMarian Balakowicz# 52*9e414032SMasahiro Yamada# 2) Set KBUILD_OUTPUT 53*9e414032SMasahiro Yamada# Set the environment variable KBUILD_OUTPUT to point to the directory 54*9e414032SMasahiro Yamada# where the output files shall be placed. 55*9e414032SMasahiro Yamada# export KBUILD_OUTPUT=dir/to/store/output/files/ 56*9e414032SMasahiro Yamada# make 57f9328639SMarian Balakowicz# 58*9e414032SMasahiro Yamada# The O= assignment takes precedence over the KBUILD_OUTPUT environment 59*9e414032SMasahiro Yamada# variable. 607ebf7443Swdenk 61*9e414032SMasahiro Yamada 62*9e414032SMasahiro Yamada# KBUILD_SRC is set on invocation of make in OBJ directory 63*9e414032SMasahiro Yamada# KBUILD_SRC is not intended to be used by the regular user (for now) 64*9e414032SMasahiro Yamadaifeq ($(KBUILD_SRC),) 65*9e414032SMasahiro Yamada 66*9e414032SMasahiro Yamada# OK, Make called in directory where kernel src resides 67*9e414032SMasahiro Yamada# Do we want to locate output files in a separate directory? 68f9328639SMarian Balakowiczifeq ("$(origin O)", "command line") 69*9e414032SMasahiro Yamada KBUILD_OUTPUT := $(O) 70f9328639SMarian Balakowiczendif 717ebf7443Swdenk 72*9e414032SMasahiro Yamadaifeq ("$(origin W)", "command line") 73*9e414032SMasahiro Yamada export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W) 74*9e414032SMasahiro Yamadaendif 75*9e414032SMasahiro Yamada 76*9e414032SMasahiro Yamada# That's our default target when none is given on the command line 77*9e414032SMasahiro YamadaPHONY := _all 78*9e414032SMasahiro Yamada_all: 79*9e414032SMasahiro Yamada 80*9e414032SMasahiro Yamada# Cancel implicit rules on top Makefile 81*9e414032SMasahiro Yamada$(CURDIR)/Makefile Makefile: ; 82*9e414032SMasahiro Yamada 83*9e414032SMasahiro Yamadaifneq ($(KBUILD_OUTPUT),) 84*9e414032SMasahiro Yamada# Invoke a second make in the output directory, passing relevant variables 85*9e414032SMasahiro Yamada# check that the output directory actually exists 86*9e414032SMasahiro Yamadasaved-output := $(KBUILD_OUTPUT) 87*9e414032SMasahiro YamadaKBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) 88*9e414032SMasahiro Yamada$(if $(KBUILD_OUTPUT),, \ 89*9e414032SMasahiro Yamada $(error output directory "$(saved-output)" does not exist)) 90*9e414032SMasahiro Yamada 91*9e414032SMasahiro YamadaPHONY += $(MAKECMDGOALS) sub-make 92*9e414032SMasahiro Yamada 93*9e414032SMasahiro Yamada$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make 94*9e414032SMasahiro Yamada @: 95*9e414032SMasahiro Yamada 96*9e414032SMasahiro Yamadasub-make: FORCE 97*9e414032SMasahiro Yamada $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 98*9e414032SMasahiro Yamada KBUILD_SRC=$(CURDIR) \ 99*9e414032SMasahiro Yamada KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ 100*9e414032SMasahiro Yamada $(filter-out _all sub-make,$(MAKECMDGOALS)) 101*9e414032SMasahiro Yamada 102*9e414032SMasahiro Yamada# Leave processing to above invocation of make 103*9e414032SMasahiro Yamadaskip-makefile := 1 104*9e414032SMasahiro Yamadaendif # ifneq ($(KBUILD_OUTPUT),) 105*9e414032SMasahiro Yamadaendif # ifeq ($(KBUILD_SRC),) 106*9e414032SMasahiro Yamada 107*9e414032SMasahiro Yamada# We process the rest of the Makefile if this is the final invocation of make 108*9e414032SMasahiro Yamadaifeq ($(skip-makefile),) 109*9e414032SMasahiro Yamada 110*9e414032SMasahiro YamadaPHONY += all 111*9e414032SMasahiro Yamada_all: all 112*9e414032SMasahiro Yamada 113*9e414032SMasahiro Yamadasrctree := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)) 114*9e414032SMasahiro Yamadaobjtree := $(CURDIR) 115*9e414032SMasahiro Yamadasrc := $(srctree) 116*9e414032SMasahiro Yamadaobj := $(objtree) 117*9e414032SMasahiro Yamada 118*9e414032SMasahiro YamadaVPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD)) 119*9e414032SMasahiro Yamada 120*9e414032SMasahiro Yamadaexport srctree objtree VPATH 121*9e414032SMasahiro Yamada 1224ab64933SKim Phillips# Call a source code checker (by default, "sparse") as part of the 1234ab64933SKim Phillips# C compilation. 1244ab64933SKim Phillips# 1254ab64933SKim Phillips# Use 'make C=1' to enable checking of re-compiled files. 1264ab64933SKim Phillips# 1274ab64933SKim Phillips# See the linux kernel file "Documentation/sparse.txt" for more details, 1284ab64933SKim Phillips# including where to get the "sparse" utility. 1294ab64933SKim Phillips 1304ab64933SKim Phillipsifdef C 1314ab64933SKim Phillipsifeq ("$(origin C)", "command line") 1324ab64933SKim PhillipsCHECKSRC := $(C) 1334ab64933SKim Phillipsendif 1344ab64933SKim Phillipsendif 1354ab64933SKim Phillipsifndef CHECKSRC 1364ab64933SKim Phillips CHECKSRC = 0 1374ab64933SKim Phillipsendif 1384ab64933SKim Phillipsexport CHECKSRC 1394ab64933SKim Phillips 140*9e414032SMasahiro YamadaOBJTREE := $(objtree) 141c8f9c302SDaniel SchwierzeckSPLTREE := $(OBJTREE)/spl 1423aa29de0SYing ZhangTPLTREE := $(OBJTREE)/tpl 143*9e414032SMasahiro YamadaSRCTREE := $(srctree) 144f9328639SMarian BalakowiczTOPDIR := $(SRCTREE) 145*9e414032SMasahiro Yamadaexport TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE 146f9328639SMarian Balakowicz 147f9328639SMarian BalakowiczMKCONFIG := $(SRCTREE)/mkconfig 148f9328639SMarian Balakowiczexport MKCONFIG 149f9328639SMarian Balakowicz 1505013c09fSWolfgang Denk# Make sure CDPATH settings don't interfere 1515013c09fSWolfgang Denkunexport CDPATH 1525013c09fSWolfgang Denk 153f9328639SMarian Balakowicz######################################################################### 154f9328639SMarian Balakowicz 1556d1ce387SMike Frysinger# The "tools" are needed early, so put this first 1566d1ce387SMike Frysinger# Don't include stuff already done in $(LIBS) 157349e83f0SChe-liang Chiou# The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC 158349e83f0SChe-liang Chiou# is "yes"), so compile examples after U-Boot is compiled. 159349e83f0SChe-liang ChiouSUBDIR_TOOLS = tools 160349e83f0SChe-liang ChiouSUBDIRS = $(SUBDIR_TOOLS) 1616d1ce387SMike Frysinger 162249b53a6SLoïc Minier.PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE) 1636d1ce387SMike Frysinger 164*9e414032SMasahiro Yamadaifeq (include/config.mk,$(wildcard include/config.mk)) 165f9328639SMarian Balakowicz 1662632c008SMike Frysinger# Include autoconf.mk before config.mk so that the config options are available 1672632c008SMike Frysinger# to all top level build files. We need the dummy all: target to prevent the 1682632c008SMike Frysinger# dependency target in autoconf.mk.dep from being the default. 1692632c008SMike Frysingerall: 170*9e414032SMasahiro Yamadasinclude include/autoconf.mk.dep 171*9e414032SMasahiro Yamadasinclude include/autoconf.mk 1722632c008SMike Frysinger 1738a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-y := examples/standalone 1748a7e7d56SMasahiro YamadaSUBDIR_EXAMPLES-$(CONFIG_API) += examples/api 175b5728756SSimon Glassifndef CONFIG_SANDBOX 1768a7e7d56SMasahiro YamadaSUBDIRS += $(SUBDIR_EXAMPLES-y) 177b5728756SSimon Glassendif 178b5728756SSimon Glass 1797ebf7443Swdenk# load ARCH, BOARD, and CPU configuration 180*9e414032SMasahiro Yamadainclude include/config.mk 1811d9f4105Swdenkexport ARCH CPU BOARD VENDOR SOC 182f9328639SMarian Balakowicz 1831ea6bcd8SMike Frysinger# set default to nothing for native builds 184a5284efdSWolfgang Denkifeq ($(HOSTARCH),$(ARCH)) 1851ea6bcd8SMike FrysingerCROSS_COMPILE ?= 1867ebf7443Swdenkendif 1877ebf7443Swdenk 188f6322eb7SMasahiro Yamada# SHELL used by kbuild 189f6322eb7SMasahiro YamadaCONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 190f6322eb7SMasahiro Yamada else if [ -x /bin/bash ]; then echo /bin/bash; \ 191f6322eb7SMasahiro Yamada else echo sh; fi ; fi) 192f6322eb7SMasahiro Yamada 193f6322eb7SMasahiro YamadaHOSTCC = gcc 194f6322eb7SMasahiro YamadaHOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer 195f6322eb7SMasahiro Yamada 196f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),cygwin) 197f6322eb7SMasahiro YamadaHOSTCFLAGS += -ansi 198f6322eb7SMasahiro Yamadaendif 199f6322eb7SMasahiro Yamada 200f6322eb7SMasahiro Yamada# Mac OS X / Darwin's C preprocessor is Apple specific. It 201f6322eb7SMasahiro Yamada# generates numerous errors and warnings. We want to bypass it 202f6322eb7SMasahiro Yamada# and use GNU C's cpp. To do this we pass the -traditional-cpp 203f6322eb7SMasahiro Yamada# option to the compiler. Note that the -traditional-cpp flag 204f6322eb7SMasahiro Yamada# DOES NOT have the same semantics as GNU C's flag, all it does 205f6322eb7SMasahiro Yamada# is invoke the GNU preprocessor in stock ANSI/ISO C fashion. 206f6322eb7SMasahiro Yamada# 207f6322eb7SMasahiro Yamada# Apple's linker is similar, thanks to the new 2 stage linking 208f6322eb7SMasahiro Yamada# multiple symbol definitions are treated as errors, hence the 209f6322eb7SMasahiro Yamada# -multiply_defined suppress option to turn off this error. 210f6322eb7SMasahiro Yamada# 211f6322eb7SMasahiro Yamadaifeq ($(HOSTOS),darwin) 212f6322eb7SMasahiro Yamada# get major and minor product version (e.g. '10' and '6' for Snow Leopard) 213f6322eb7SMasahiro YamadaDARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') 214f6322eb7SMasahiro YamadaDARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') 215f6322eb7SMasahiro Yamada 216f6322eb7SMasahiro Yamadaos_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ 217f6322eb7SMasahiro Yamada $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) 218f6322eb7SMasahiro Yamada 219f6322eb7SMasahiro Yamada# Snow Leopards build environment has no longer restrictions as described above 220f6322eb7SMasahiro YamadaHOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") 221f6322eb7SMasahiro YamadaHOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") 222f6322eb7SMasahiro YamadaHOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") 223f6322eb7SMasahiro Yamadaendif 224f6322eb7SMasahiro Yamada 225*9e414032SMasahiro Yamada# Look for make include files relative to root of kernel src 226*9e414032SMasahiro YamadaMAKEFLAGS += --include-dir=$(srctree) 227*9e414032SMasahiro Yamada 228bf4b3de1SMasahiro Yamada# We need some generic definitions (do not try to remake the file). 229bf4b3de1SMasahiro Yamada$(srctree)/scripts/Kbuild.include: ; 230bf4b3de1SMasahiro Yamadainclude $(srctree)/scripts/Kbuild.include 231bf4b3de1SMasahiro Yamada 232f6322eb7SMasahiro Yamada# Make variables (CC, etc...) 233f6322eb7SMasahiro Yamada 234f6322eb7SMasahiro YamadaAS = $(CROSS_COMPILE)as 235f6322eb7SMasahiro Yamada# Always use GNU ld 236f6322eb7SMasahiro Yamadaifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),) 237f6322eb7SMasahiro YamadaLD = $(CROSS_COMPILE)ld.bfd 238f6322eb7SMasahiro Yamadaelse 239f6322eb7SMasahiro YamadaLD = $(CROSS_COMPILE)ld 240f6322eb7SMasahiro Yamadaendif 241f6322eb7SMasahiro YamadaCC = $(CROSS_COMPILE)gcc 242f6322eb7SMasahiro YamadaCPP = $(CC) -E 243f6322eb7SMasahiro YamadaAR = $(CROSS_COMPILE)ar 244f6322eb7SMasahiro YamadaNM = $(CROSS_COMPILE)nm 245f6322eb7SMasahiro YamadaLDR = $(CROSS_COMPILE)ldr 246f6322eb7SMasahiro YamadaSTRIP = $(CROSS_COMPILE)strip 247f6322eb7SMasahiro YamadaOBJCOPY = $(CROSS_COMPILE)objcopy 248f6322eb7SMasahiro YamadaOBJDUMP = $(CROSS_COMPILE)objdump 249f6322eb7SMasahiro YamadaAWK = awk 250f6322eb7SMasahiro YamadaRANLIB = $(CROSS_COMPILE)RANLIB 251f6322eb7SMasahiro YamadaDTC = dtc 252f6322eb7SMasahiro YamadaCHECK = sparse 253f6322eb7SMasahiro Yamada 254f6322eb7SMasahiro YamadaCHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ 255f6322eb7SMasahiro Yamada -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) 256f6322eb7SMasahiro Yamada 257fea1ca8eSMasahiro Yamada# Use UBOOTINCLUDE when you must reference the include/ directory. 258fea1ca8eSMasahiro Yamada# Needed to be compatible with the O= option 259fea1ca8eSMasahiro YamadaUBOOTINCLUDE := 260fea1ca8eSMasahiro Yamadaifneq ($(OBJTREE),$(SRCTREE)) 261fea1ca8eSMasahiro YamadaUBOOTINCLUDE += -I$(OBJTREE)/include 262fea1ca8eSMasahiro Yamadaendif 263fea1ca8eSMasahiro YamadaUBOOTINCLUDE += -I$(srctree)/include \ 264fea1ca8eSMasahiro Yamada -I$(srctree)/arch/$(ARCH)/include 265fea1ca8eSMasahiro Yamada 2662b3c9d3dSMasahiro YamadaKBUILD_CPPFLAGS := -D__KERNEL__ 2672b3c9d3dSMasahiro Yamada 2682b3c9d3dSMasahiro YamadaKBUILD_CFLAGS := -Wall -Wstrict-prototypes \ 2692b3c9d3dSMasahiro Yamada -Wno-format-security \ 2702b3c9d3dSMasahiro Yamada -fno-builtin -ffreestanding 2712b3c9d3dSMasahiro YamadaKBUILD_AFLAGS := -D__ASSEMBLY__ 2722b3c9d3dSMasahiro Yamada 273f6322eb7SMasahiro Yamadaexport CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC 274f6322eb7SMasahiro Yamadaexport CPP AR NM LDR STRIP OBJCOPY OBJDUMP 275f6322eb7SMasahiro Yamadaexport MAKE AWK 276f6322eb7SMasahiro Yamadaexport DTC CHECK CHECKFLAGS 277f6322eb7SMasahiro Yamada 278fea1ca8eSMasahiro Yamadaexport KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE 2792b3c9d3dSMasahiro Yamadaexport KBUILD_CFLAGS KBUILD_AFLAGS 2802b3c9d3dSMasahiro Yamada 2812b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += -Os #-fomit-frame-pointer 2822b3c9d3dSMasahiro Yamada 2832b3c9d3dSMasahiro Yamadaifdef BUILD_TAG 2842b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"' 2852b3c9d3dSMasahiro Yamadaendif 2862b3c9d3dSMasahiro Yamada 2872b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 2882b3c9d3dSMasahiro Yamada 2892b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += -g 2902b3c9d3dSMasahiro Yamada# $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format> 2912b3c9d3dSMasahiro Yamada# option to the assembler. 2922b3c9d3dSMasahiro YamadaKBUILD_AFLAGS += -g 2932b3c9d3dSMasahiro Yamada 294fea1ca8eSMasahiro YamadaNOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 295fea1ca8eSMasahiro YamadaCHECKFLAGS += $(NOSTDINC_FLAGS) 296fea1ca8eSMasahiro Yamada 2972b3c9d3dSMasahiro Yamada# Report stack usage if supported 2982b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += $(call cc-option,-fstack-usage) 2992b3c9d3dSMasahiro Yamada 3002b3c9d3dSMasahiro YamadaKBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) 3012b3c9d3dSMasahiro Yamada 3022b3c9d3dSMasahiro Yamada# turn jbsr into jsr for m68k 3032b3c9d3dSMasahiro Yamadaifeq ($(ARCH),m68k) 3042b3c9d3dSMasahiro Yamadaifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) 3052b3c9d3dSMasahiro YamadaKBUILD_AFLAGS += -Wa,-gstabs,-S 3062b3c9d3dSMasahiro Yamadaendif 3072b3c9d3dSMasahiro Yamadaendif 3082b3c9d3dSMasahiro Yamada 30992b197f0SWolfgang Denk# load other configuration 31092b197f0SWolfgang Denkinclude $(TOPDIR)/config.mk 31192b197f0SWolfgang Denk 312ced0715dSMasahiro Yamadaifneq ($(CONFIG_SYS_TEXT_BASE),) 313ced0715dSMasahiro YamadaKBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) 314ced0715dSMasahiro Yamadaendif 315ced0715dSMasahiro Yamada 316ced0715dSMasahiro Yamadaexport CONFIG_SYS_TEXT_BASE 317ced0715dSMasahiro Yamada 318*9e414032SMasahiro YamadaLDFLAGS_u-boot += -T u-boot.lds $(LDFLAGS_FINAL) 319ced0715dSMasahiro Yamadaifneq ($(CONFIG_SYS_TEXT_BASE),) 320ced0715dSMasahiro YamadaLDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) 321ced0715dSMasahiro Yamadaendif 322ced0715dSMasahiro Yamada 323fada9e20SSimon Glass# Targets which don't build the source code 324ced0715dSMasahiro YamadaNON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig %_config 325fada9e20SSimon Glass 326fada9e20SSimon Glass# Only do the generic board check when actually building, not configuring 327fada9e20SSimon Glassifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),) 328ced0715dSMasahiro Yamadaifeq ($(__HAVE_ARCH_GENERIC_BOARD),) 329ced0715dSMasahiro Yamadaifneq ($(CONFIG_SYS_GENERIC_BOARD),) 330ced0715dSMasahiro YamadaCHECK_GENERIC_BOARD = $(error Your architecture does not support generic board. \ 331ced0715dSMasahiro YamadaPlease undefined CONFIG_SYS_GENERIC_BOARD in your board config file) 332ced0715dSMasahiro Yamadaendif 333fada9e20SSimon Glassendif 334fada9e20SSimon Glassendif 335fada9e20SSimon Glass 336d51dfff7SIlya Yanok# If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use 337d51dfff7SIlya Yanok# that (or fail if absent). Otherwise, search for a linker script in a 338d51dfff7SIlya Yanok# standard location. 339d51dfff7SIlya Yanok 340ee60197eSSimon GlassLDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT)) 341ee60197eSSimon Glass 342d51dfff7SIlya Yanokifndef LDSCRIPT 343d51dfff7SIlya Yanok #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug 344d51dfff7SIlya Yanok ifdef CONFIG_SYS_LDSCRIPT 345d51dfff7SIlya Yanok # need to strip off double quotes 346a8c07541SMasahiro Yamada LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%) 347d51dfff7SIlya Yanok endif 348d51dfff7SIlya Yanokendif 349d51dfff7SIlya Yanok 350ee60197eSSimon Glass# If there is no specified link script, we look in a number of places for it 351d51dfff7SIlya Yanokifndef LDSCRIPT 352d51dfff7SIlya Yanok ifeq ($(CONFIG_NAND_U_BOOT),y) 353d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds 354d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 355d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds 356d51dfff7SIlya Yanok endif 357d51dfff7SIlya Yanok endif 358d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 359d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds 360d51dfff7SIlya Yanok endif 361d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 362d51dfff7SIlya Yanok LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds 363d51dfff7SIlya Yanok endif 364d51dfff7SIlya Yanok ifeq ($(wildcard $(LDSCRIPT)),) 365ee60197eSSimon Glass LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds 366ee60197eSSimon Glass # We don't expect a Makefile here 367ee60197eSSimon Glass LDSCRIPT_MAKEFILE_DIR = 368ee60197eSSimon Glass endif 369ee60197eSSimon Glass ifeq ($(wildcard $(LDSCRIPT)),) 370d51dfff7SIlya Yanok$(error could not find linker script) 371d51dfff7SIlya Yanok endif 372d51dfff7SIlya Yanokendif 373d51dfff7SIlya Yanok 3747ebf7443Swdenk######################################################################### 3757ebf7443Swdenk# U-Boot objects....order is important (i.e. start must be first) 3767ebf7443Swdenk 377e8a8b824SMasahiro Yamadahead-y := $(CPUDIR)/start.o 378e8a8b824SMasahiro Yamadahead-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o 379e8a8b824SMasahiro Yamadahead-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o 3807ebf7443Swdenk 381*9e414032SMasahiro YamadaOBJS := $(head-y) 382f9328639SMarian Balakowicz 383*9e414032SMasahiro YamadaHAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) 3848b5a0264SDaniel Schwierzeck 385e2906a59SMasahiro YamadaLIBS-y += lib/ 386e2906a59SMasahiro YamadaLIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ 387e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/ 3881d9f4105Swdenkifdef SOC 389e2906a59SMasahiro YamadaLIBS-y += $(CPUDIR)/$(SOC)/ 3901d9f4105Swdenkendif 391e2906a59SMasahiro YamadaLIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/ 392e2906a59SMasahiro YamadaLIBS-$(CONFIG_OF_EMBED) += dts/ 393e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/lib/ 39457c3e5fcSMasahiro YamadaLIBS-y += fs/ 395e2906a59SMasahiro YamadaLIBS-y += net/ 396e2906a59SMasahiro YamadaLIBS-y += disk/ 397e2906a59SMasahiro YamadaLIBS-y += drivers/ 398e2906a59SMasahiro YamadaLIBS-y += drivers/dma/ 399e2906a59SMasahiro YamadaLIBS-y += drivers/gpio/ 400e2906a59SMasahiro YamadaLIBS-y += drivers/i2c/ 401e2906a59SMasahiro YamadaLIBS-y += drivers/input/ 402e2906a59SMasahiro YamadaLIBS-y += drivers/mmc/ 403e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/ 404392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/ 405e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/onenand/ 406392ba525SMasahiro YamadaLIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ 407e2906a59SMasahiro YamadaLIBS-y += drivers/mtd/spi/ 408e2906a59SMasahiro YamadaLIBS-y += drivers/net/ 409e2906a59SMasahiro YamadaLIBS-y += drivers/net/phy/ 410e2906a59SMasahiro YamadaLIBS-y += drivers/pci/ 411e2906a59SMasahiro YamadaLIBS-y += drivers/power/ \ 412e2906a59SMasahiro Yamada drivers/power/fuel_gauge/ \ 413e2906a59SMasahiro Yamada drivers/power/mfd/ \ 414e2906a59SMasahiro Yamada drivers/power/pmic/ \ 415e2906a59SMasahiro Yamada drivers/power/battery/ 416e2906a59SMasahiro YamadaLIBS-y += drivers/spi/ 417e2906a59SMasahiro YamadaLIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/ 4185614e71bSYork SunLIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ 419e2906a59SMasahiro YamadaLIBS-y += drivers/serial/ 420e2906a59SMasahiro YamadaLIBS-y += drivers/usb/eth/ 421e2906a59SMasahiro YamadaLIBS-y += drivers/usb/gadget/ 422e2906a59SMasahiro YamadaLIBS-y += drivers/usb/host/ 423e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb/ 424e2906a59SMasahiro YamadaLIBS-y += drivers/usb/musb-new/ 425e2906a59SMasahiro YamadaLIBS-y += drivers/usb/phy/ 426e2906a59SMasahiro YamadaLIBS-y += drivers/usb/ulpi/ 427e2906a59SMasahiro YamadaLIBS-y += common/ 428e2906a59SMasahiro YamadaLIBS-y += lib/libfdt/ 4298a7e7d56SMasahiro YamadaLIBS-$(CONFIG_API) += api/ 430755e08f0SMasahiro YamadaLIBS-$(CONFIG_HAS_POST) += post/ 431e2906a59SMasahiro YamadaLIBS-y += test/ 432f9328639SMarian Balakowicz 43324e8bee5SAlison Wangifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610)) 434e2906a59SMasahiro YamadaLIBS-y += arch/$(ARCH)/imx-common/ 43518936ee2SJason Liuendif 43618936ee2SJason Liu 437e2906a59SMasahiro YamadaLIBS-$(CONFIG_ARM) += arch/arm/cpu/ 438e2906a59SMasahiro YamadaLIBS-$(CONFIG_PPC) += arch/powerpc/cpu/ 439852bd07cSMinkyu Kang 440e2906a59SMasahiro YamadaLIBS-y += board/$(BOARDDIR)/ 44108e39a84SMasahiro Yamada 442e2906a59SMasahiro YamadaLIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y)) 443*9e414032SMasahiro YamadaLIBS := $(sort $(LIBS-y)) 444249b53a6SLoïc Minier.PHONY : $(LIBS) 445a8c7c708Swdenk 4464f7cb08eSwdenk# Add GCC lib 44752b1bf2cSWolfgang Denkifdef USE_PRIVATE_LIBGCC 44852b1bf2cSWolfgang Denkifeq ("$(USE_PRIVATE_LIBGCC)", "yes") 449635d1b3eSMatthias WeisserPLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o 45052b1bf2cSWolfgang Denkelse 45152b1bf2cSWolfgang DenkPLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc 45252b1bf2cSWolfgang Denkendif 45352b1bf2cSWolfgang Denkelse 454cca4e4aeSWolfgang DenkPLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc 45552b1bf2cSWolfgang Denkendif 45652b1bf2cSWolfgang DenkPLATFORM_LIBS += $(PLATFORM_LIBGCC) 45752b1bf2cSWolfgang Denkexport PLATFORM_LIBS 4583d3befa7Swdenk 4596ac9f479SMike Frysinger# Special flags for CPP when processing the linker script. 4606ac9f479SMike Frysinger# Pass the version down so we can handle backwards compatibility 4616ac9f479SMike Frysinger# on the fly. 4626ac9f479SMike FrysingerLDPPFLAGS += \ 4636ac9f479SMike Frysinger -include $(TOPDIR)/include/u-boot/u-boot.lds.h \ 4647e6403a6SSimon Glass -DCPUDIR=$(CPUDIR) \ 4656ac9f479SMike Frysinger $(shell $(LD) --version | \ 4666ac9f479SMike Frysinger sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p') 4676ac9f479SMike Frysinger 4687ebf7443Swdenk######################################################################### 469bdccc4feSwdenk######################################################################### 4707ebf7443Swdenk 471f3a14d37SMike Frysingerifneq ($(CONFIG_BOARD_SIZE_LIMIT),) 472f3a14d37SMike FrysingerBOARD_SIZE_CHECK = \ 473f3a14d37SMike Frysinger @actual=`wc -c $@ | awk '{print $$1}'`; \ 474d060e6f4SJoe Hershberger limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ 475f3a14d37SMike Frysinger if test $$actual -gt $$limit; then \ 476d060e6f4SJoe Hershberger echo "$@ exceeds file size limit:" >&2 ; \ 477d060e6f4SJoe Hershberger echo " limit: $$limit bytes" >&2 ; \ 478d060e6f4SJoe Hershberger echo " actual: $$actual bytes" >&2 ; \ 479d060e6f4SJoe Hershberger echo " excess: $$((actual - limit)) bytes" >&2; \ 480f3a14d37SMike Frysinger exit 1; \ 481f3a14d37SMike Frysinger fi 482f3a14d37SMike Frysingerelse 483f3a14d37SMike FrysingerBOARD_SIZE_CHECK = 484f3a14d37SMike Frysingerendif 485f3a14d37SMike Frysinger 4868137af19SScott Wood# Statically apply RELA-style relocations (currently arm64 only) 4878137af19SScott Woodifneq ($(CONFIG_STATIC_RELA),) 4888137af19SScott Wood# $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base 4898137af19SScott WoodDO_STATIC_RELA = \ 4908137af19SScott Wood start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \ 4918137af19SScott Wood end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \ 492*9e414032SMasahiro Yamada tools/relocate-rela $(2) $(3) $$start $$end 4938137af19SScott Woodelse 4948137af19SScott WoodDO_STATIC_RELA = 4958137af19SScott Woodendif 4968137af19SScott Wood 4973e88337bSMike Frysinger# Always append ALL so that arch config.mk's can add custom ones 498*9e414032SMasahiro YamadaALL-y += u-boot.srec u-boot.bin System.map 499e935a374SHaiying Wang 500*9e414032SMasahiro YamadaALL-$(CONFIG_NAND_U_BOOT) += u-boot-nand.bin 501*9e414032SMasahiro YamadaALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin 502*9e414032SMasahiro YamadaALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl 503*9e414032SMasahiro YamadaALL-$(CONFIG_SPL) += spl/u-boot-spl.bin 504*9e414032SMasahiro YamadaALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img 505*9e414032SMasahiro YamadaALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin 506*9e414032SMasahiro YamadaALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin 507b343bbb5SVadim Bendeburyifneq ($(CONFIG_SPL_TARGET),) 508*9e414032SMasahiro YamadaALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) 509b343bbb5SVadim Bendeburyendif 510*9e414032SMasahiro YamadaALL-$(CONFIG_REMAKE_ELF) += u-boot.elf 5117ebf7443Swdenk 51212b7b70cSAllen Martin# enable combined SPL/u-boot/dtb rules for tegra 5136d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 5147dcd3a21SVidya Sagarifeq ($(CONFIG_SPL),y) 51512b7b70cSAllen Martinifeq ($(CONFIG_OF_SEPARATE),y) 516*9e414032SMasahiro YamadaALL-y += u-boot-dtb-tegra.bin 51712b7b70cSAllen Martinelse 518*9e414032SMasahiro YamadaALL-y += u-boot-nodtb-tegra.bin 51912b7b70cSAllen Martinendif 52012b7b70cSAllen Martinendif 5217dcd3a21SVidya Sagarendif 52212b7b70cSAllen Martin 5238a7e7d56SMasahiro Yamadaall: $(ALL-y) $(SUBDIR_EXAMPLES-y) 5247ebf7443Swdenk 525*9e414032SMasahiro Yamadau-boot.dtb: checkdtc u-boot 526*9e414032SMasahiro Yamada $(MAKE) $(build)=dts binary 527*9e414032SMasahiro Yamada mv dts/dt.dtb $@ 5282c0f79e4SSimon Glass 529*9e414032SMasahiro Yamadau-boot-dtb.bin: u-boot.bin u-boot.dtb 5302c0f79e4SSimon Glass cat $^ >$@ 5312c0f79e4SSimon Glass 532*9e414032SMasahiro Yamadau-boot.hex: u-boot 5336310eb9dSwdenk $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ 5346310eb9dSwdenk 535*9e414032SMasahiro Yamadau-boot.srec: u-boot 53647ed5dd0SAlbert ARIBAUD $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ 5377ebf7443Swdenk 538*9e414032SMasahiro Yamadau-boot.bin: u-boot 5397ebf7443Swdenk $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ 5408137af19SScott Wood $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) 541f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 5427ebf7443Swdenk 543*9e414032SMasahiro Yamadau-boot.ldr: u-boot 54476d82187SMike Frysinger $(CREATE_LDR_ENV) 54568e56324SMike Frysinger $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) 546f3a14d37SMike Frysinger $(BOARD_SIZE_CHECK) 54794a91e24SMike Frysinger 548*9e414032SMasahiro Yamadau-boot.ldr.hex: u-boot.ldr 54994a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary 55094a91e24SMike Frysinger 551*9e414032SMasahiro Yamadau-boot.ldr.srec: u-boot.ldr 55294a91e24SMike Frysinger $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary 55394a91e24SMike Frysinger 554b40bda6bSStefan Roese# 555b40bda6bSStefan Roese# U-Boot entry point, needed for booting of full-blown U-Boot 556b40bda6bSStefan Roese# from the SPL U-Boot version. 557b40bda6bSStefan Roese# 558b40bda6bSStefan Roeseifndef CONFIG_SYS_UBOOT_START 559b40bda6bSStefan RoeseCONFIG_SYS_UBOOT_START := 0 560b40bda6bSStefan Roeseendif 561b40bda6bSStefan Roese 562*9e414032SMasahiro Yamadau-boot.img: u-boot.bin 563*9e414032SMasahiro Yamada tools/mkimage -A $(ARCH) -T firmware -C none \ 564b40bda6bSStefan Roese -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \ 565b40bda6bSStefan Roese -e $(CONFIG_SYS_UBOOT_START) \ 566881a87ecSWolfgang Denk -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \ 567bdccc4feSwdenk sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ 568bdccc4feSwdenk -d $< $@ 569bdccc4feSwdenk 570*9e414032SMasahiro Yamadau-boot.imx: u-boot.bin depend 571*9e414032SMasahiro Yamada $(MAKE) $(build)=arch/arm/imx-common $(objtree)/u-boot.imx 5728edcde5eSStefano Babic 573*9e414032SMasahiro Yamadau-boot.kwb: u-boot.bin 574*9e414032SMasahiro Yamada tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \ 5752ea88b06SEric Cooper -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@ 576aa0c7a86SPrafulla Wadaskar 577*9e414032SMasahiro Yamadau-boot.pbl: u-boot.bin 578*9e414032SMasahiro Yamada tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \ 579690e4258SPrabhakar Kushwaha -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \ 5805d898a00SShaohui Xie -d $< $@ 5815d898a00SShaohui Xie 582*9e414032SMasahiro Yamadau-boot.sha1: u-boot.bin 583*9e414032SMasahiro Yamada tools/ubsha1 u-boot.bin 584566a494fSHeiko Schocher 585*9e414032SMasahiro Yamadau-boot.dis: u-boot 5867ebf7443Swdenk $(OBJDUMP) -d $< > $@ 5877ebf7443Swdenk 5883aa29de0SYing Zhang# $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate, 5893aa29de0SYing Zhang# $(4) is pad-to 5903aa29de0SYing ZhangSPL_PAD_APPEND = \ 5913aa29de0SYing Zhang $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \ 592*9e414032SMasahiro Yamada $(1) $(3); \ 593*9e414032SMasahiro Yamada cat $(3) $(2) > $@; \ 594*9e414032SMasahiro Yamada rm $(3) 59574752baaSScott Wood 5963aa29de0SYing Zhangifdef CONFIG_TPL 597*9e414032SMasahiro YamadaSPL_PAYLOAD := tpl/u-boot-with-tpl.bin 5983aa29de0SYing Zhangelse 599*9e414032SMasahiro YamadaSPL_PAYLOAD := u-boot.bin 6003aa29de0SYing Zhangendif 60174752baaSScott Wood 602*9e414032SMasahiro Yamadau-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) 6033aa29de0SYing Zhang $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO)) 6043aa29de0SYing Zhang 605*9e414032SMasahiro Yamadatpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin 606*9e414032SMasahiro Yamada $(call SPL_PAD_APPEND,$<,u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO)) 6077816f2cfSHeiko Schocher 608*9e414032SMasahiro Yamadau-boot-with-spl.imx: spl/u-boot-spl.bin u-boot.bin 609*9e414032SMasahiro Yamada $(MAKE) $(build)=arch/arm/imx-common \ 610ba597609SBenoît Thébaudeau $(OBJTREE)/u-boot-with-spl.imx 611ba597609SBenoît Thébaudeau 612*9e414032SMasahiro Yamadau-boot-with-nand-spl.imx: spl/u-boot-spl.bin u-boot.bin 613*9e414032SMasahiro Yamada $(MAKE) $(build)=arch/arm/imx-common \ 6147d5a5c79SBenoît Thébaudeau $(OBJTREE)/u-boot-with-nand-spl.imx 6157d5a5c79SBenoît Thébaudeau 616*9e414032SMasahiro Yamadau-boot.ubl: u-boot-with-spl.bin 617*9e414032SMasahiro Yamada tools/mkimage -n $(UBL_CONFIG) -T ublimage \ 618*9e414032SMasahiro Yamada -e $(CONFIG_SYS_TEXT_BASE) -d $< u-boot.ubl 619277f00f5SJosé Miguel Gonçalves 620*9e414032SMasahiro Yamadau-boot.ais: spl/u-boot-spl.bin u-boot.img 621*9e414032SMasahiro Yamada tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \ 6226d660e77SSughosh Ganu -T aisimage \ 623d36d8859SChristian Riesch -e $(CONFIG_SPL_TEXT_BASE) \ 624*9e414032SMasahiro Yamada -d spl/u-boot-spl.bin \ 625*9e414032SMasahiro Yamada spl/u-boot-spl.ais 626d36d8859SChristian Riesch $(OBJCOPY) ${OBJCFLAGS} -I binary \ 627d36d8859SChristian Riesch --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ 628*9e414032SMasahiro Yamada spl/u-boot-spl.ais spl/u-boot-spl-pad.ais 629*9e414032SMasahiro Yamada cat spl/u-boot-spl-pad.ais u-boot.img > u-boot.ais 630d36d8859SChristian Riesch 631a5453555SOtavio Salvador 632*9e414032SMasahiro Yamadau-boot.sb: u-boot.bin spl/u-boot-spl.bin 633*9e414032SMasahiro Yamada $(MAKE) $(build)=$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb 63430b9b932SMarek Vasut 63594aebe6cSStefan Roese# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL. 63694aebe6cSStefan Roese# Both images are created using mkimage (crc etc), so that the ROM 63794aebe6cSStefan Roese# bootloader can check its integrity. Padding needs to be done to the 63894aebe6cSStefan Roese# SPL image (with mkimage header) and not the binary. Otherwise the resulting image 63994aebe6cSStefan Roese# which is loaded/copied by the ROM bootloader to SRAM doesn't fit. 64094aebe6cSStefan Roese# The resulting image containing both U-Boot images is called u-boot.spr 641*9e414032SMasahiro Yamadau-boot.spr: u-boot.img spl/u-boot-spl.bin 642*9e414032SMasahiro Yamada tools/mkimage -A $(ARCH) -T firmware -C none \ 64394aebe6cSStefan Roese -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \ 644*9e414032SMasahiro Yamada -d spl/u-boot-spl.bin $@ 64557270260SMasahiro Yamada $(OBJCOPY) -I binary -O binary \ 64657270260SMasahiro Yamada --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@ 647*9e414032SMasahiro Yamada cat u-boot.img >> $@ 64894aebe6cSStefan Roese 6496d6c0baeSTom Warrenifneq ($(CONFIG_TEGRA),) 650*9e414032SMasahiro Yamadau-boot-nodtb-tegra.bin: spl/u-boot-spl.bin u-boot.bin 651*9e414032SMasahiro Yamada $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary spl/u-boot-spl spl/u-boot-spl-pad.bin 652*9e414032SMasahiro Yamada cat spl/u-boot-spl-pad.bin u-boot.bin > $@ 653*9e414032SMasahiro Yamada rm spl/u-boot-spl-pad.bin 6549972db5cSStephen Warren 6559972db5cSStephen Warrenifeq ($(CONFIG_OF_SEPARATE),y) 656*9e414032SMasahiro Yamadau-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin u-boot.dtb 657*9e414032SMasahiro Yamada cat u-boot-nodtb-tegra.bin u-boot.dtb > $@ 6589972db5cSStephen Warrenendif 659984df4ecSAllen Martinendif 660984df4ecSAllen Martin 661*9e414032SMasahiro Yamadau-boot-img.bin: spl/u-boot-spl.bin u-boot.img 662*9e414032SMasahiro Yamada cat spl/u-boot-spl.bin u-boot.img > $@ 663fb3d2b8aSStefan Roese 664ecddccd0SStefan Roese# PPC4xx needs the SPL at the end of the image, since the reset vector 665ecddccd0SStefan Roese# is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target 666ecddccd0SStefan Roese# and need to introduce a new build target with the full blown U-Boot 667ecddccd0SStefan Roese# at the start padded up to the start of the SPL image. And then concat 668ecddccd0SStefan Roese# the SPL image to the end. 669*9e414032SMasahiro Yamadau-boot-img-spl-at-end.bin: spl/u-boot-spl.bin u-boot.img 67057270260SMasahiro Yamada $(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \ 671*9e414032SMasahiro Yamada --gap-fill=0xff u-boot.img $@ 672*9e414032SMasahiro Yamada cat spl/u-boot-spl.bin >> $@ 673ecddccd0SStefan Roese 674f4dc714aSScott Wood# Create a new ELF from a raw binary file. This is useful for arm64 675f4dc714aSScott Wood# where static relocation needs to be performed on the raw binary, 676f4dc714aSScott Wood# but certain simulators only accept an ELF file (but don't do the 677f4dc714aSScott Wood# relocation). 678f4dc714aSScott Wood# FIXME refactor dts/Makefile to share target/arch detection 679*9e414032SMasahiro Yamadau-boot.elf: u-boot.bin 680f4dc714aSScott Wood @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \ 681*9e414032SMasahiro Yamada $< u-boot-elf.o 682*9e414032SMasahiro Yamada @$(LD) u-boot-elf.o -o $@ \ 683f4dc714aSScott Wood --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \ 684f4dc714aSScott Wood -Ttext=$(CONFIG_SYS_TEXT_BASE) 685f4dc714aSScott Wood 68686eb49b3SSimon Glassifeq ($(CONFIG_SANDBOX),y) 68786eb49b3SSimon GlassGEN_UBOOT = \ 688*9e414032SMasahiro Yamada $(CC) $(SYMS) -T u-boot.lds \ 689*9e414032SMasahiro Yamada -Wl,--start-group $(LIBS) -Wl,--end-group \ 69086eb49b3SSimon Glass $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot 69186eb49b3SSimon Glasselse 692ecb1dc89SMike FrysingerGEN_UBOOT = \ 693*9e414032SMasahiro Yamada $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \ 694*9e414032SMasahiro Yamada $(OBJS) \ 695*9e414032SMasahiro Yamada --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \ 696b2184c31Swdenk -Map u-boot.map -o u-boot 69786eb49b3SSimon Glassendif 69886eb49b3SSimon Glass 699*9e414032SMasahiro Yamadau-boot: depend $(SUBDIR_TOOLS) $(OBJS) $(LIBS) u-boot.lds 700ecb1dc89SMike Frysinger $(GEN_UBOOT) 701ecb1dc89SMike Frysingerifeq ($(CONFIG_KALLSYMS),y) 702*9e414032SMasahiro Yamada smap=`$(call SYSTEM_MAP,u-boot) | \ 7031aada9cdSWolfgang Denk awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \ 7041aada9cdSWolfgang Denk $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \ 705*9e414032SMasahiro Yamada -c $(srctree)/common/system_map.c -o common/system_map.o 706*9e414032SMasahiro Yamada $(GEN_UBOOT) common/system_map.o 707ecb1dc89SMike Frysingerendif 7087ebf7443Swdenk 7093bddafaaSMasahiro Yamada$(OBJS): 7103bddafaaSMasahiro Yamada @: 711f9328639SMarian Balakowicz 712349e83f0SChe-liang Chiou$(LIBS): depend $(SUBDIR_TOOLS) 713*9e414032SMasahiro Yamada $(MAKE) $(build)=$(patsubst %/,%,$(dir $@)) 714a8c7c708Swdenk 7154a20df39SMasahiro Yamada$(SUBDIRS): depend 716*9e414032SMasahiro Yamada $(MAKE) $(build)=$@ all 717940db16dSMasahiro Yamada 718*9e414032SMasahiro Yamada$(SUBDIR_EXAMPLES-y): u-boot 719349e83f0SChe-liang Chiou 720*9e414032SMasahiro Yamadau-boot.lds: $(LDSCRIPT) depend 72197b24d3dSMarek Vasut $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@ 7221aada9cdSWolfgang Denk 723e935a374SHaiying Wangnand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend 724*9e414032SMasahiro Yamada $(MAKE) $(build)=nand_spl/board/$(BOARDDIR) all 725887e2ec9SStefan Roese 726*9e414032SMasahiro Yamadau-boot-nand.bin: nand_spl u-boot.bin 727*9e414032SMasahiro Yamada cat nand_spl/u-boot-spl-16k.bin u-boot.bin > u-boot-nand.bin 728887e2ec9SStefan Roese 729*9e414032SMasahiro Yamadaspl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend 730*9e414032SMasahiro Yamada $(MAKE) obj=spl -f $(srctree)/spl/Makefile all 7315df2ee27SDaniel Schwierzeck 732*9e414032SMasahiro Yamadatpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend 733*9e414032SMasahiro Yamada $(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y 7343aa29de0SYing Zhang 7352a998793SDaniel Hobi# Explicitly make _depend in subdirs containing multiple targets to prevent 7362a998793SDaniel Hobi# parallel sub-makes creating .depend files simultaneously. 73716a354f9SWolfgang Denkdepend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \ 738*9e414032SMasahiro Yamada include/spl-autoconf.mk \ 739*9e414032SMasahiro Yamada include/tpl-autoconf.mk \ 740*9e414032SMasahiro Yamada include/autoconf.mk \ 741*9e414032SMasahiro Yamada include/generated/generic-asm-offsets.h \ 742*9e414032SMasahiro Yamada include/generated/asm-offsets.h 7437ebf7443Swdenk 744e5e4e705SLi YangTAG_SUBDIRS = $(SUBDIRS) 745*9e414032SMasahiro YamadaTAG_SUBDIRS += $(dir $(LIBS)) 746a340c325SJean-Christophe PLAGNIOL-VILLARDTAG_SUBDIRS += include 747a340c325SJean-Christophe PLAGNIOL-VILLARD 748857d9ea6SHorst KronstorferFIND := find 749857d9ea6SHorst KronstorferFINDFLAGS := -L 750857d9ea6SHorst Kronstorfer 7511064d980STom Rinicheckstack: 752*9e414032SMasahiro Yamada $(CROSS_COMPILE)objdump -d u-boot \ 753*9e414032SMasahiro Yamada `$(FIND) . -name u-boot-spl -print` | \ 754*9e414032SMasahiro Yamada perl $(src)/scripts/checkstack.pl $(ARCH) 7551064d980STom Rini 756f9328639SMarian Balakowicztags ctags: 757*9e414032SMasahiro Yamada ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 758e5e4e705SLi Yang -name '*.[chS]' -print` 7597ebf7443Swdenk 7607ebf7443Swdenketags: 761857d9ea6SHorst Kronstorfer etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \ 762e5e4e705SLi Yang -name '*.[chS]' -print` 763ffda586fSLi Yangcscope: 764857d9ea6SHorst Kronstorfer $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \ 765857d9ea6SHorst Kronstorfer cscope.files 766ffda586fSLi Yang cscope -b -q -k 7677ebf7443Swdenk 768ecb1dc89SMike FrysingerSYSTEM_MAP = \ 769ecb1dc89SMike Frysinger $(NM) $1 | \ 7707ebf7443Swdenk grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ 771ecb1dc89SMike Frysinger LC_ALL=C sort 772*9e414032SMasahiro YamadaSystem.map: u-boot 773bc8bb6ecSMasahiro Yamada @$(call SYSTEM_MAP,$<) > $@ 7747ebf7443Swdenk 77506a119a0STom Rinicheckthumb: 77606a119a0STom Rini @if test $(call cc-version) -lt 0404; then \ 77706a119a0STom Rini echo -n '*** Your GCC does not produce working '; \ 77806a119a0STom Rini echo 'binaries in THUMB mode.'; \ 77906a119a0STom Rini echo '*** Your board is configured for THUMB mode.'; \ 78006a119a0STom Rini false; \ 78106a119a0STom Rini fi 7826ec63f41SScott Wood 7836ec63f41SScott Wood# GCC 3.x is reported to have problems generating the type of relocation 7846ec63f41SScott Wood# that U-Boot wants. 7856ec63f41SScott Wood# See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html 7866ec63f41SScott Woodcheckgcc4: 7876ec63f41SScott Wood @if test $(call cc-version) -lt 0400; then \ 7886ec63f41SScott Wood echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \ 7896ec63f41SScott Wood false; \ 7906ec63f41SScott Wood fi 7916ec63f41SScott Wood 792501ebdf2SStephen Warrencheckdtc: 793501ebdf2SStephen Warren @if test $(call dtc-version) -lt 0104; then \ 794501ebdf2SStephen Warren echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \ 795501ebdf2SStephen Warren false; \ 796501ebdf2SStephen Warren fi 797501ebdf2SStephen Warren 7982f155f6cSGrant Likely# 7992f155f6cSGrant Likely# Auto-generate the autoconf.mk file (which is included by all makefiles) 8002f155f6cSGrant Likely# 8012f155f6cSGrant Likely# This target actually generates 2 files; autoconf.mk and autoconf.mk.dep. 8022f155f6cSGrant Likely# the dep file is only include in this top level makefile to determine when 8032f155f6cSGrant Likely# to regenerate the autoconf.mk file. 804*9e414032SMasahiro Yamadainclude/autoconf.mk.dep: include/config.h include/common.h 8051510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 806ae6d1056SWolfgang Denk : Generate the dependancies ; \ 8074c34b2a0SMike Frysinger $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \ 808*9e414032SMasahiro Yamada -MQ include/autoconf.mk $(srctree)/include/common.h > $@ || \ 80965947ab4SMasahiro Yamada rm $@ 8101510b82dSWolfgang Denk 811*9e414032SMasahiro Yamadainclude/autoconf.mk: include/config.h 8121510b82dSWolfgang Denk @$(XECHO) Generating $@ ; \ 813ae6d1056SWolfgang Denk : Extract the config macros ; \ 814*9e414032SMasahiro Yamada $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ 815*9e414032SMasahiro Yamada sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \ 81665947ab4SMasahiro Yamada rm $@.tmp 8172f155f6cSGrant Likely 81839bc12ddSJoel Fernandes# Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL) 819*9e414032SMasahiro Yamadainclude/tpl-autoconf.mk: include/config.h 8203aa29de0SYing Zhang @$(XECHO) Generating $@ ; \ 8213aa29de0SYing Zhang : Extract the config macros ; \ 8223aa29de0SYing Zhang $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\ 823*9e414032SMasahiro Yamada -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ 824*9e414032SMasahiro Yamada sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \ 82565947ab4SMasahiro Yamada rm $@.tmp 8263aa29de0SYing Zhang 827*9e414032SMasahiro Yamadainclude/spl-autoconf.mk: include/config.h 82839bc12ddSJoel Fernandes @$(XECHO) Generating $@ ; \ 82939bc12ddSJoel Fernandes : Extract the config macros ; \ 830*9e414032SMasahiro Yamada $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && \ 831*9e414032SMasahiro Yamada sed -n -f $(srctree)/tools/scripts/define2mk.sed $@.tmp > $@; \ 83265947ab4SMasahiro Yamada rm $@.tmp 83339bc12ddSJoel Fernandes 834*9e414032SMasahiro Yamadainclude/generated/generic-asm-offsets.h: lib/asm-offsets.s 83516a354f9SWolfgang Denk @$(XECHO) Generating $@ 836*9e414032SMasahiro Yamada $(srctree)/tools/scripts/make-asm-offsets lib/asm-offsets.s $@ 83716a354f9SWolfgang Denk 838*9e414032SMasahiro Yamadalib/asm-offsets.s: include/config.h $(srctree)/lib/asm-offsets.c 839*9e414032SMasahiro Yamada @mkdir -p lib 84016a354f9SWolfgang Denk $(CC) -DDO_DEPS_ONLY \ 84116a354f9SWolfgang Denk $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 842*9e414032SMasahiro Yamada -o $@ $(srctree)/lib/asm-offsets.c -c -S 84316a354f9SWolfgang Denk 844*9e414032SMasahiro Yamadainclude/generated/asm-offsets.h: $(CPUDIR)/$(SOC)/asm-offsets.s 845b12734eeSWolfgang Denk @$(XECHO) Generating $@ 846*9e414032SMasahiro Yamada $(srctree)/tools/scripts/make-asm-offsets $(CPUDIR)/$(SOC)/asm-offsets.s $@ 847a4814a69SStefano Babic 848*9e414032SMasahiro Yamada$(CPUDIR)/$(SOC)/asm-offsets.s: include/config.h 849*9e414032SMasahiro Yamada @mkdir -p $(CPUDIR)/$(SOC) 850*9e414032SMasahiro Yamada if [ -f $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c ];then \ 851a4814a69SStefano Babic $(CC) -DDO_DEPS_ONLY \ 852a4814a69SStefano Babic $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \ 853*9e414032SMasahiro Yamada -o $@ $(srctree)/$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \ 854a4814a69SStefano Babic else \ 855a4814a69SStefano Babic touch $@; \ 856a4814a69SStefano Babic fi 857a4814a69SStefano Babic 8587ebf7443Swdenk######################################################################### 859ae6d1056SWolfgang Denkelse # !config.mk 860*9e414032SMasahiro Yamadaall u-boot.hex u-boot.srec u-boot.bin \ 861*9e414032SMasahiro Yamadau-boot.img u-boot.dis u-boot \ 862249b53a6SLoïc Minier$(filter-out tools,$(SUBDIRS)) \ 863*9e414032SMasahiro Yamadadepend dep tags ctags etags cscope System.map: 8647ebf7443Swdenk @echo "System not configured - see README" >&2 8657ebf7443Swdenk @ exit 1 866c7c0d542SMike Frysinger 867249b53a6SLoïc Miniertools: $(VERSION_FILE) $(TIMESTAMP_FILE) 868*9e414032SMasahiro Yamada $(MAKE) $(build)=$@ all 869ae6d1056SWolfgang Denkendif # config.mk 8707ebf7443Swdenk 87154799e45SScott Wood# ARM relocations should all be R_ARM_RELATIVE (32-bit) or 87254799e45SScott Wood# R_AARCH64_RELATIVE (64-bit). 873*9e414032SMasahiro Yamadacheckarmreloc: u-boot 87454799e45SScott Wood @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \ 87554799e45SScott Wood grep R_A | sort -u`"; \ 87654799e45SScott Wood if test "$$RELOC" != "R_ARM_RELATIVE" -a \ 87754799e45SScott Wood "$$RELOC" != "R_AARCH64_RELATIVE"; then \ 87854799e45SScott Wood echo "$< contains unexpected relocations: $$RELOC"; \ 87954799e45SScott Wood false; \ 88054799e45SScott Wood fi 881c37980c3SAlbert ARIBAUD 88228abd48fSIlya Yanok$(VERSION_FILE): 88314ce91b1SMike Frysinger @mkdir -p $(dir $(VERSION_FILE)) 884dd88ab32SMasahiro Yamada @( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \ 88528abd48fSIlya Yanok printf '#define PLAIN_VERSION "%s%s"\n' \ 88628abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 88728abd48fSIlya Yanok printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ 88828abd48fSIlya Yanok "$(U_BOOT_VERSION)" "$${localvers}" ; \ 88928abd48fSIlya Yanok ) > $@.tmp 89028abd48fSIlya Yanok @( printf '#define CC_VERSION_STRING "%s"\n' \ 89128abd48fSIlya Yanok '$(shell $(CC) --version | head -n 1)' )>> $@.tmp 89228abd48fSIlya Yanok @( printf '#define LD_VERSION_STRING "%s"\n' \ 89328abd48fSIlya Yanok '$(shell $(LD) -v | head -n 1)' )>> $@.tmp 89428abd48fSIlya Yanok @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 89528abd48fSIlya Yanok 896249b53a6SLoïc Minier$(TIMESTAMP_FILE): 897249b53a6SLoïc Minier @mkdir -p $(dir $(TIMESTAMP_FILE)) 898a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp 899a76406fbSLoïc Minier @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp 900a76406fbSLoïc Minier @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ 901249b53a6SLoïc Minier 9020358df42SMike Frysingereasylogo env gdb: 903*9e414032SMasahiro Yamada $(MAKE) $(build)=tools/$@ MTD_VERSION=${MTD_VERSION} 904940db16dSMasahiro Yamada 9050358df42SMike Frysingergdbtools: gdb 9060358df42SMike Frysinger 90730ff8918SMarek Vasutxmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc 908*9e414032SMasahiro Yamada $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) $(build)=doc/DocBook $@ 90930ff8918SMarek Vasut 910249b53a6SLoïc Miniertools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE) 911*9e414032SMasahiro Yamada $(MAKE) $(build)=tools HOST_TOOLS_ALL=y 9120358df42SMike Frysinger 9134e53a258SWolfgang Denk.PHONY : CHANGELOG 9144e53a258SWolfgang DenkCHANGELOG: 915b985b5d6SBen Warren git log --no-merges U-Boot-1_1_5.. | \ 916b985b5d6SBen Warren unexpand -a | sed -e 's/\s\s*$$//' > $@ 9174e53a258SWolfgang Denk 9180a823aa2SHarald Welteinclude/license.h: tools/bin2header COPYING 9190a823aa2SHarald Welte cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h 9207ebf7443Swdenk######################################################################### 9217ebf7443Swdenk 9227ebf7443Swdenkunconfig: 923*9e414032SMasahiro Yamada @rm -f include/config.h include/config.mk \ 924*9e414032SMasahiro Yamada board/*/config.tmp board/*/*/config.tmp \ 925*9e414032SMasahiro Yamada include/autoconf.mk include/autoconf.mk.dep \ 926*9e414032SMasahiro Yamada include/spl-autoconf.mk \ 927*9e414032SMasahiro Yamada include/tpl-autoconf.mk 9287ebf7443Swdenk 929a6862bc1SWolfgang Denk%_config:: unconfig 930a6862bc1SWolfgang Denk @$(MKCONFIG) -A $(@:_config=) 931a6862bc1SWolfgang Denk 9323e38691eSwdenk######################################################################### 9337ebf7443Swdenk 9347ebf7443Swdenkclean: 935*9e414032SMasahiro Yamada @rm -f examples/standalone/atmel_df_pow2 \ 936*9e414032SMasahiro Yamada examples/standalone/hello_world \ 937*9e414032SMasahiro Yamada examples/standalone/interrupt \ 938*9e414032SMasahiro Yamada examples/standalone/mem_to_mem_idma2intr \ 939*9e414032SMasahiro Yamada examples/standalone/sched \ 940*9e414032SMasahiro Yamada $(addprefix examples/standalone/, smc91111_eeprom smc911x_eeprom) \ 941*9e414032SMasahiro Yamada examples/standalone/test_burst \ 942*9e414032SMasahiro Yamada examples/standalone/timer 943*9e414032SMasahiro Yamada @rm -f $(addprefix examples/api/, demo demo.bin) 944*9e414032SMasahiro Yamada @rm -f tools/bmp_logo tools/easylogo/easylogo \ 945*9e414032SMasahiro Yamada tools/env/fw_printenv \ 946*9e414032SMasahiro Yamada tools/envcrc \ 947*9e414032SMasahiro Yamada $(addprefix tools/gdb/, gdbcont gdbsend) \ 948*9e414032SMasahiro Yamada tools/gen_eth_addr tools/img2srec \ 949*9e414032SMasahiro Yamada tools/dumpimage \ 950*9e414032SMasahiro Yamada $(addprefix tools/, mkenvimage mkimage) \ 951*9e414032SMasahiro Yamada tools/mpc86x_clk \ 952*9e414032SMasahiro Yamada $(addprefix tools/, mk$(BOARD)spl mkexynosspl) \ 953*9e414032SMasahiro Yamada tools/mxsboot \ 954*9e414032SMasahiro Yamada tools/ncb tools/ubsha1 \ 955*9e414032SMasahiro Yamada tools/kernel-doc/docproc \ 956*9e414032SMasahiro Yamada tools/proftool 957*9e414032SMasahiro Yamada @rm -f $(addprefix board/cray/L1/, bootscript.c bootscript.image) \ 958*9e414032SMasahiro Yamada board/matrix_vision/*/bootscript.img \ 959*9e414032SMasahiro Yamada spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl \ 960*9e414032SMasahiro Yamada u-boot.lds \ 961*9e414032SMasahiro Yamada $(addprefix arch/blackfin/cpu/, init.lds init.elf) 962*9e414032SMasahiro Yamada @rm -f include/bmp_logo.h 963*9e414032SMasahiro Yamada @rm -f include/bmp_logo_data.h 964*9e414032SMasahiro Yamada @rm -f lib/asm-offsets.s 965*9e414032SMasahiro Yamada @rm -f include/generated/asm-offsets.h 966*9e414032SMasahiro Yamada @rm -f $(CPUDIR)/$(SOC)/asm-offsets.s 967d4abc757SPeter Tyser @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE) 968*9e414032SMasahiro Yamada @$(MAKE) -f $(srctree)/doc/DocBook/Makefile cleandocs 969ae6d1056SWolfgang Denk @find $(OBJTREE) -type f \ 9704a30f1e8STom Rini \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \ 97171a988aaSTroy Kisky -o -name '*.o' -o -name '*.a' -o -name '*.exe' \ 97271a988aaSTroy Kisky -o -name '*.cfgtmp' \) -print \ 9737ebf7443Swdenk | xargs rm -f 9747ebf7443Swdenk 975734329f9SAndy Fleming# Removes everything not needed for testing u-boot 976734329f9SAndy Flemingtidy: clean 977734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f 978734329f9SAndy Fleming 979734329f9SAndy Flemingclobber: tidy 980734329f9SAndy Fleming @find $(OBJTREE) -type f \( -name '*.srec' \ 981734329f9SAndy Fleming -o -name '*.bin' -o -name u-boot.img \) \ 982734329f9SAndy Fleming -print0 | xargs -0 rm -f 983*9e414032SMasahiro Yamada @rm -f $(OBJS) *.bak ctags etags TAGS \ 984*9e414032SMasahiro Yamada cscope.* *.*~ 985*9e414032SMasahiro Yamada @rm -f u-boot u-boot.map u-boot.hex $(ALL-y) 986*9e414032SMasahiro Yamada @rm -f u-boot.kwb 987*9e414032SMasahiro Yamada @rm -f u-boot.pbl 988*9e414032SMasahiro Yamada @rm -f u-boot.imx 989*9e414032SMasahiro Yamada @rm -f u-boot-with-spl.imx 990*9e414032SMasahiro Yamada @rm -f u-boot-with-nand-spl.imx 991*9e414032SMasahiro Yamada @rm -f u-boot.ubl 992*9e414032SMasahiro Yamada @rm -f u-boot.ais 993*9e414032SMasahiro Yamada @rm -f u-boot.dtb 994*9e414032SMasahiro Yamada @rm -f u-boot.sb 995*9e414032SMasahiro Yamada @rm -f u-boot.spr 996*9e414032SMasahiro Yamada @rm -f $(addprefix nand_spl/, u-boot.lds u-boot.lst System.map) 997*9e414032SMasahiro Yamada @rm -f $(addprefix nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map) 998*9e414032SMasahiro Yamada @rm -f $(addprefix spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map) 999*9e414032SMasahiro Yamada @rm -f spl/u-boot-spl.lds 1000*9e414032SMasahiro Yamada @rm -f $(addprefix tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map) 1001*9e414032SMasahiro Yamada @rm -f tpl/u-boot-spl.lds 1002*9e414032SMasahiro Yamada @rm -f MLO MLO.byteswap 1003*9e414032SMasahiro Yamada @rm -f SPL 1004*9e414032SMasahiro Yamada @rm -f tools/xway-swap-bytes 1005*9e414032SMasahiro Yamada @rm -fr include/asm/proc include/asm/arch include/asm 1006*9e414032SMasahiro Yamada @rm -fr include/generated 1007*9e414032SMasahiro Yamada @[ ! -d nand_spl ] || find nand_spl -name "*" -type l -print | xargs rm -f 1008*9e414032SMasahiro Yamada @rm -f dts/*.tmp 1009*9e414032SMasahiro Yamada @rm -f $(addprefix spl/, u-boot-spl.ais, u-boot-spl-pad.ais) 10107ebf7443Swdenk 10117ebf7443Swdenkmrproper \ 10127ebf7443Swdenkdistclean: clobber unconfig 1013afd077bdSMike Frysingerifneq ($(OBJTREE),$(SRCTREE)) 1014*9e414032SMasahiro Yamada rm -rf * 1015f9328639SMarian Balakowiczendif 10167ebf7443Swdenk 10177ebf7443Swdenkbackup: 10187ebf7443Swdenk F=`basename $(TOPDIR)` ; cd .. ; \ 1019d6b93714SIlya Yanok gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F 10207ebf7443Swdenk 10217ebf7443Swdenk######################################################################### 1022*9e414032SMasahiro Yamada 1023*9e414032SMasahiro Yamadaendif # skip-makefile 1024*9e414032SMasahiro Yamada 1025*9e414032SMasahiro YamadaPHONY += FORCE 1026*9e414032SMasahiro YamadaFORCE: 1027*9e414032SMasahiro Yamada 1028*9e414032SMasahiro Yamada# Declare the contents of the .PHONY variable as phony. We keep that 1029*9e414032SMasahiro Yamada# information in a variable so we can use it in if_changed and friends. 1030*9e414032SMasahiro Yamada.PHONY: $(PHONY) 1031