Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
   217         kx # SPDX-License-Identifier: GPL-2.0+
   217         kx 
   217         kx VERSION = 2021
   217         kx PATCHLEVEL = 10
   217         kx SUBLEVEL =
   217         kx EXTRAVERSION =
   217         kx NAME =
   217         kx 
   217         kx # *DOCUMENTATION*
   217         kx # To see a list of typical targets execute "make help"
   217         kx # More info can be located in ./README
   217         kx # Comments in this file are targeted only to the developer, do not
   217         kx # expect to learn how to build the kernel reading this file.
   217         kx 
   217         kx # Do not use make's built-in rules and variables
   217         kx # (this increases performance and avoids hard-to-debug behaviour)
   217         kx MAKEFLAGS += -rR
   217         kx 
   217         kx # Determine target architecture for the sandbox
   217         kx include include/host_arch.h
   217         kx ifeq ("", "$(CROSS_COMPILE)")
   217         kx   MK_ARCH="${shell uname -m}"
   217         kx else
   217         kx   MK_ARCH="${shell echo $(CROSS_COMPILE) | sed -n 's/^\s*\([^\/]*\/\)*\([^-]*\)-\S*/\2/p'}"
   217         kx endif
   217         kx unexport HOST_ARCH
   217         kx ifeq ("x86_64", $(MK_ARCH))
   217         kx   export HOST_ARCH=$(HOST_ARCH_X86_64)
   217         kx else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" "i586" "i686"))
   217         kx   export HOST_ARCH=$(HOST_ARCH_X86)
   217         kx else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l"))
   217         kx   export HOST_ARCH=$(HOST_ARCH_AARCH64)
   217         kx else ifneq (,$(findstring $(MK_ARCH), "arm" "armv7" "armv7l"))
   217         kx   export HOST_ARCH=$(HOST_ARCH_ARM)
   217         kx else ifeq ("riscv32", $(MK_ARCH))
   217         kx   export HOST_ARCH=$(HOST_ARCH_RISCV32)
   217         kx else ifeq ("riscv64", $(MK_ARCH))
   217         kx   export HOST_ARCH=$(HOST_ARCH_RISCV64)
   217         kx endif
   217         kx undefine MK_ARCH
   217         kx 
   217         kx # Avoid funny character set dependencies
   217         kx unexport LC_ALL
   217         kx LC_COLLATE=C
   217         kx LC_NUMERIC=C
   217         kx export LC_COLLATE LC_NUMERIC
   217         kx 
   217         kx # Avoid interference with shell env settings
   217         kx unexport GREP_OPTIONS
   217         kx 
   217         kx # We are using a recursive build, so we need to do a little thinking
   217         kx # to get the ordering right.
   217         kx #
   217         kx # Most importantly: sub-Makefiles should only ever modify files in
   217         kx # their own directory. If in some directory we have a dependency on
   217         kx # a file in another dir (which doesn't happen often, but it's often
   217         kx # unavoidable when linking the built-in.o targets which finally
   217         kx # turn into vmlinux), we will call a sub make in that other dir, and
   217         kx # after that we are sure that everything which is in that other dir
   217         kx # is now up to date.
   217         kx #
   217         kx # The only cases where we need to modify files which have global
   217         kx # effects are thus separated out and done before the recursive
   217         kx # descending is started. They are now explicitly listed as the
   217         kx # prepare rule.
   217         kx 
   217         kx # Beautify output
   217         kx # ---------------------------------------------------------------------------
   217         kx #
   217         kx # Normally, we echo the whole command before executing it. By making
   217         kx # that echo $($(quiet)$(cmd)), we now have the possibility to set
   217         kx # $(quiet) to choose other forms of output instead, e.g.
   217         kx #
   217         kx #         quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
   217         kx #         cmd_cc_o_c       = $(CC) $(c_flags) -c -o $@ $<
   217         kx #
   217         kx # If $(quiet) is empty, the whole command will be printed.
   217         kx # If it is set to "quiet_", only the short version will be printed.
   217         kx # If it is set to "silent_", nothing will be printed at all, since
   217         kx # the variable $(silent_cmd_cc_o_c) doesn't exist.
   217         kx #
   217         kx # A simple variant is to prefix commands with $(Q) - that's useful
   217         kx # for commands that shall be hidden in non-verbose mode.
   217         kx #
   217         kx #	$(Q)ln $@ :<
   217         kx #
   217         kx # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
   217         kx # If KBUILD_VERBOSE equals 1 then the above command is displayed.
   217         kx #
   217         kx # To put more focus on warnings, be less verbose as default
   217         kx # Use 'make V=1' to see the full commands
   217         kx 
   217         kx ifeq ("$(origin V)", "command line")
   217         kx   KBUILD_VERBOSE = $(V)
   217         kx endif
   217         kx ifndef KBUILD_VERBOSE
   217         kx   KBUILD_VERBOSE = 0
   217         kx endif
   217         kx 
   217         kx ifeq ($(KBUILD_VERBOSE),1)
   217         kx   quiet =
   217         kx   Q =
   217         kx else
   217         kx   quiet=quiet_
   217         kx   Q = @
   217         kx endif
   217         kx 
   217         kx # If the user is running make -s (silent mode), suppress echoing of
   217         kx # commands
   217         kx 
   217         kx ifneq ($(filter 4.%,$(MAKE_VERSION)),)	# make-4
   217         kx ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
   217         kx   quiet=silent_
   217         kx endif
   217         kx else					# make-3.8x
   217         kx ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
   217         kx   quiet=silent_
   217         kx endif
   217         kx endif
   217         kx 
   217         kx export quiet Q KBUILD_VERBOSE
   217         kx 
   217         kx # kbuild supports saving output files in a separate directory.
   217         kx # To locate output files in a separate directory two syntaxes are supported.
   217         kx # In both cases the working directory must be the root of the kernel src.
   217         kx # 1) O=
   217         kx # Use "make O=dir/to/store/output/files/"
   217         kx #
   217         kx # 2) Set KBUILD_OUTPUT
   217         kx # Set the environment variable KBUILD_OUTPUT to point to the directory
   217         kx # where the output files shall be placed.
   217         kx # export KBUILD_OUTPUT=dir/to/store/output/files/
   217         kx # make
   217         kx #
   217         kx # The O= assignment takes precedence over the KBUILD_OUTPUT environment
   217         kx # variable.
   217         kx 
   217         kx # KBUILD_SRC is set on invocation of make in OBJ directory
   217         kx # KBUILD_SRC is not intended to be used by the regular user (for now)
   217         kx ifeq ($(KBUILD_SRC),)
   217         kx 
   217         kx # OK, Make called in directory where kernel src resides
   217         kx # Do we want to locate output files in a separate directory?
   217         kx ifeq ("$(origin O)", "command line")
   217         kx   KBUILD_OUTPUT := $(O)
   217         kx endif
   217         kx 
   217         kx # That's our default target when none is given on the command line
   217         kx PHONY := _all
   217         kx _all:
   217         kx 
   217         kx # Cancel implicit rules on top Makefile
   217         kx $(CURDIR)/Makefile Makefile: ;
   217         kx 
   217         kx ifneq ($(KBUILD_OUTPUT),)
   217         kx # Invoke a second make in the output directory, passing relevant variables
   217         kx # check that the output directory actually exists
   217         kx saved-output := $(KBUILD_OUTPUT)
   217         kx KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
   217         kx 								&& /bin/pwd)
   217         kx $(if $(KBUILD_OUTPUT),, \
   217         kx      $(error failed to create output directory "$(saved-output)"))
   217         kx 
   217         kx # Look for make include files relative to root of kernel src
   217         kx #
   217         kx # This does not become effective immediately because MAKEFLAGS is re-parsed
   217         kx # once after the Makefile is read.  It is OK since we are going to invoke
   217         kx # 'sub-make' below.
   217         kx MAKEFLAGS += --include-dir=$(CURDIR)
   217         kx 
   217         kx PHONY += $(MAKECMDGOALS) sub-make
   217         kx 
   217         kx $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
   217         kx 	@:
   217         kx 
   217         kx sub-make: FORCE
   217         kx 	$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
   217         kx 	-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
   217         kx 
   217         kx # Leave processing to above invocation of make
   217         kx skip-makefile := 1
   217         kx endif # ifneq ($(KBUILD_OUTPUT),)
   217         kx endif # ifeq ($(KBUILD_SRC),)
   217         kx 
   217         kx # We process the rest of the Makefile if this is the final invocation of make
   217         kx ifeq ($(skip-makefile),)
   217         kx 
   217         kx # Do not print "Entering directory ...",
   217         kx # but we want to display it when entering to the output directory
   217         kx # so that IDEs/editors are able to understand relative filenames.
   217         kx MAKEFLAGS += --no-print-directory
   217         kx 
   217         kx # Call a source code checker (by default, "sparse") as part of the
   217         kx # C compilation.
   217         kx #
   217         kx # Use 'make C=1' to enable checking of only re-compiled files.
   217         kx # Use 'make C=2' to enable checking of *all* source files, regardless
   217         kx # of whether they are re-compiled or not.
   217         kx #
   217         kx # See the file "doc/sparse.txt" for more details, including
   217         kx # where to get the "sparse" utility.
   217         kx 
   217         kx ifeq ("$(origin C)", "command line")
   217         kx   KBUILD_CHECKSRC = $(C)
   217         kx endif
   217         kx ifndef KBUILD_CHECKSRC
   217         kx   KBUILD_CHECKSRC = 0
   217         kx endif
   217         kx 
   217         kx # Use make M=dir to specify directory of external module to build
   217         kx # Old syntax make ... SUBDIRS=$PWD is still supported
   217         kx # Setting the environment variable KBUILD_EXTMOD take precedence
   217         kx ifdef SUBDIRS
   217         kx   KBUILD_EXTMOD ?= $(SUBDIRS)
   217         kx endif
   217         kx 
   217         kx ifeq ("$(origin M)", "command line")
   217         kx   KBUILD_EXTMOD := $(M)
   217         kx endif
   217         kx 
   217         kx # If building an external module we do not care about the all: rule
   217         kx # but instead _all depend on modules
   217         kx PHONY += all
   217         kx ifeq ($(KBUILD_EXTMOD),)
   217         kx _all: all
   217         kx else
   217         kx _all: modules
   217         kx endif
   217         kx 
   217         kx ifeq ($(KBUILD_SRC),)
   217         kx         # building in the source tree
   217         kx         srctree := .
   217         kx else
   217         kx         ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
   217         kx                 # building in a subdirectory of the source tree
   217         kx                 srctree := ..
   217         kx         else
   217         kx                 srctree := $(KBUILD_SRC)
   217         kx         endif
   217         kx endif
   217         kx objtree		:= .
   217         kx src		:= $(srctree)
   217         kx obj		:= $(objtree)
   217         kx 
   217         kx VPATH		:= $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
   217         kx 
   217         kx export srctree objtree VPATH
   217         kx 
   217         kx # Make sure CDPATH settings don't interfere
   217         kx unexport CDPATH
   217         kx 
   217         kx #########################################################################
   217         kx 
   217         kx HOSTARCH := $(shell uname -m | \
   217         kx 	sed -e s/i.86/x86/ \
   217         kx 	    -e s/sun4u/sparc64/ \
   217         kx 	    -e s/arm.*/arm/ \
   217         kx 	    -e s/sa110/arm/ \
   217         kx 	    -e s/ppc64/powerpc/ \
   217         kx 	    -e s/ppc/powerpc/ \
   217         kx 	    -e s/macppc/powerpc/\
   217         kx 	    -e s/sh.*/sh/)
   217         kx 
   217         kx HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
   217         kx 	    sed -e 's/\(cygwin\).*/cygwin/')
   217         kx 
   217         kx export	HOSTARCH HOSTOS
   217         kx 
   217         kx #########################################################################
   217         kx 
   217         kx # set default to nothing for native builds
   217         kx ifeq ($(HOSTARCH),$(ARCH))
   217         kx CROSS_COMPILE ?=
   217         kx endif
   217         kx 
   217         kx KCONFIG_CONFIG	?= .config
   217         kx export KCONFIG_CONFIG
   217         kx 
   217         kx # SHELL used by kbuild
   217         kx CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
   217         kx 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
   217         kx 	  else echo sh; fi ; fi)
   217         kx 
   217         kx HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null)
   217         kx HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null)
   217         kx HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
   217         kx 
   217         kx HOSTCC       = cc
   217         kx HOSTCXX      = c++
   217         kx KBUILD_HOSTCFLAGS   := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
   217         kx 		$(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
   217         kx KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
   217         kx KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
   217         kx KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
   217         kx 
   217         kx # With the move to GCC 6, we have implicitly upgraded our language
   217         kx # standard to GNU11 (see https://gcc.gnu.org/gcc-5/porting_to.html).
   217         kx # Some Linux distributions (including RHEL7, SLES13, Debian 8) still
   217         kx # have older compilers as their default, so we make it explicit for
   217         kx # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions).
   217         kx CSTD_FLAG := -std=gnu11
   217         kx ifeq ($(HOSTOS),linux)
   217         kx KBUILD_HOSTCFLAGS += $(CSTD_FLAG)
   217         kx endif
   217         kx 
   217         kx ifeq ($(HOSTOS),cygwin)
   217         kx KBUILD_HOSTCFLAGS	+= -ansi
   217         kx endif
   217         kx 
   217         kx # Mac OS X / Darwin's C preprocessor is Apple specific.  It
   217         kx # generates numerous errors and warnings.  We want to bypass it
   217         kx # and use GNU C's cpp.	To do this we pass the -traditional-cpp
   217         kx # option to the compiler.  Note that the -traditional-cpp flag
   217         kx # DOES NOT have the same semantics as GNU C's flag, all it does
   217         kx # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
   217         kx #
   217         kx # Apple's linker is similar, thanks to the new 2 stage linking
   217         kx # multiple symbol definitions are treated as errors, hence the
   217         kx # -multiply_defined suppress option to turn off this error.
   217         kx #
   217         kx ifeq ($(HOSTOS),darwin)
   217         kx # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
   217         kx DARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
   217         kx DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
   217         kx 
   217         kx os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
   217         kx 	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
   217         kx 
   217         kx os_x_after = $(shell if [ $(DARWIN_MAJOR_VERSION) -ge $(1) -a \
   217         kx 	$(DARWIN_MINOR_VERSION) -ge $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)	
   217         kx 
   217         kx # Snow Leopards build environment has no longer restrictions as described above
   217         kx HOSTCC       = $(call os_x_before, 10, 5, "cc", "gcc")
   217         kx KBUILD_HOSTCFLAGS  += $(call os_x_before, 10, 4, "-traditional-cpp")
   217         kx KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
   217         kx 
   217         kx # macOS Mojave (10.14.X) 
   217         kx # Undefined symbols for architecture x86_64: "_PyArg_ParseTuple"
   217         kx KBUILD_HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "")
   217         kx endif
   217         kx 
   217         kx # Decide whether to build built-in, modular, or both.
   217         kx # Normally, just do built-in.
   217         kx 
   217         kx KBUILD_MODULES :=
   217         kx KBUILD_BUILTIN := 1
   217         kx 
   217         kx # If we have only "make modules", don't compile built-in objects.
   217         kx # When we're building modules with modversions, we need to consider
   217         kx # the built-in objects during the descend as well, in order to
   217         kx # make sure the checksums are up to date before we record them.
   217         kx 
   217         kx ifeq ($(MAKECMDGOALS),modules)
   217         kx   KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
   217         kx endif
   217         kx 
   217         kx # If we have "make <whatever> modules", compile modules
   217         kx # in addition to whatever we do anyway.
   217         kx # Just "make" or "make all" shall build modules as well
   217         kx 
   217         kx # U-Boot does not need modules
   217         kx #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
   217         kx #  KBUILD_MODULES := 1
   217         kx #endif
   217         kx 
   217         kx #ifeq ($(MAKECMDGOALS),)
   217         kx #  KBUILD_MODULES := 1
   217         kx #endif
   217         kx 
   217         kx # Check ths size of a binary:
   217         kx # Args:
   217         kx #   $1: File to check
   217         kx #   #2: Size limit in bytes (decimal or 0xhex)
   217         kx define size_check
   217         kx 	actual=$$( wc -c $1 | awk '{print $$1}'); \
   217         kx 	limit=$$( printf "%d" $2 ); \
   217         kx 	if test $$actual -gt $$limit; then \
   217         kx 		echo "$1 exceeds file size limit:" >&2; \
   217         kx 		echo "  limit:  $$(printf %#x $$limit) bytes" >&2; \
   217         kx 		echo "  actual: $$(printf %#x $$actual) bytes" >&2; \
   217         kx 		echo "  excess: $$(printf %#x $$((actual - limit))) bytes" >&2;\
   217         kx 		exit 1; \
   217         kx 	fi
   217         kx endef
   217         kx export size_check
   217         kx 
   217         kx export KBUILD_MODULES KBUILD_BUILTIN
   217         kx export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
   217         kx 
   217         kx # We need some generic definitions (do not try to remake the file).
   217         kx scripts/Kbuild.include: ;
   217         kx include scripts/Kbuild.include
   217         kx 
   217         kx # Make variables (CC, etc...)
   217         kx 
   217         kx AS		= $(CROSS_COMPILE)as
   217         kx # Always use GNU ld
   217         kx ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
   217         kx LD		= $(CROSS_COMPILE)ld.bfd
   217         kx else
   217         kx LD		= $(CROSS_COMPILE)ld
   217         kx endif
   217         kx CC		= $(CROSS_COMPILE)gcc
   217         kx CPP		= $(CC) -E
   217         kx AR		= $(CROSS_COMPILE)ar
   217         kx NM		= $(CROSS_COMPILE)nm
   217         kx LDR		= $(CROSS_COMPILE)ldr
   217         kx STRIP		= $(CROSS_COMPILE)strip
   217         kx OBJCOPY		= $(CROSS_COMPILE)objcopy
   217         kx OBJDUMP		= $(CROSS_COMPILE)objdump
   217         kx LEX		= flex
   217         kx YACC		= bison
   217         kx AWK		= awk
   217         kx PERL		= perl
   217         kx PYTHON		?= python
   217         kx PYTHON2		= python2
   217         kx PYTHON3		?= python3
   217         kx DTC		?= $(objtree)/scripts/dtc/dtc
   217         kx CHECK		= sparse
   217         kx 
   217         kx CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
   217         kx 		  -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
   217         kx 
   217         kx KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
   217         kx 
   217         kx KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
   217         kx 		   -Wno-format-security \
   217         kx 		   -fno-builtin -ffreestanding $(CSTD_FLAG)
   217         kx KBUILD_CFLAGS	+= -fshort-wchar -fno-strict-aliasing
   217         kx KBUILD_AFLAGS   := -D__ASSEMBLY__
   217         kx KBUILD_LDFLAGS  :=
   217         kx 
   217         kx ifeq ($(cc-name),clang)
   217         kx ifneq ($(CROSS_COMPILE),)
   217         kx CLANG_TARGET	:= --target=$(notdir $(CROSS_COMPILE:%-=%))
   217         kx GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
   217         kx CLANG_PREFIX	:= --prefix=$(GCC_TOOLCHAIN_DIR)
   217         kx GCC_TOOLCHAIN	:= $(realpath $(GCC_TOOLCHAIN_DIR)/..)
   217         kx endif
   217         kx ifneq ($(GCC_TOOLCHAIN),)
   217         kx CLANG_GCC_TC	:= --gcc-toolchain=$(GCC_TOOLCHAIN)
   217         kx endif
   217         kx KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
   217         kx KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX)
   217         kx KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
   217         kx KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
   217         kx endif
   217         kx 
   217         kx # Don't generate position independent code
   217         kx KBUILD_CFLAGS	+= $(call cc-option,-fno-PIE)
   217         kx KBUILD_AFLAGS	+= $(call cc-option,-fno-PIE)
   217         kx 
   217         kx # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
   217         kx UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
   217         kx UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
   217         kx 
   217         kx export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
   217         kx export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
   217         kx export CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC
   217         kx export CPP AR NM LDR STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
   217         kx export MAKE LEX YACC AWK PERL PYTHON PYTHON2 PYTHON3
   217         kx export HOSTCXX KBUILD_HOSTCXXFLAGS CHECK CHECKFLAGS DTC DTC_FLAGS
   217         kx 
   217         kx export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
   217         kx export KBUILD_CFLAGS KBUILD_AFLAGS
   217         kx 
   217         kx export CC_VERSION_TEXT := $(shell $(CC) --version | head -n 1)
   217         kx 
   217         kx # When compiling out-of-tree modules, put MODVERDIR in the module
   217         kx # tree rather than in the kernel tree. The kernel tree might
   217         kx # even be read-only.
   217         kx export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
   217         kx 
   217         kx # Files to ignore in find ... statements
   217         kx 
   217         kx export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o    \
   217         kx 			  -name CVS -o -name .pc -o -name .hg -o -name .git \) \
   217         kx 			  -prune -o
   217         kx export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
   217         kx 			 --exclude CVS --exclude .pc --exclude .hg --exclude .git
   217         kx 
   217         kx # ===========================================================================
   217         kx # Rules shared between *config targets and build targets
   217         kx 
   217         kx # Basic helpers built in scripts/
   217         kx PHONY += scripts_basic
   217         kx scripts_basic:
   217         kx 	$(Q)$(MAKE) $(build)=scripts/basic
   217         kx 	$(Q)rm -f .tmp_quiet_recordmcount
   217         kx 
   217         kx # To avoid any implicit rule to kick in, define an empty command.
   217         kx scripts/basic/%: scripts_basic ;
   217         kx 
   217         kx PHONY += outputmakefile
   217         kx # outputmakefile generates a Makefile in the output directory, if using a
   217         kx # separate output directory. This allows convenient use of make in the
   217         kx # output directory.
   217         kx outputmakefile:
   217         kx ifneq ($(KBUILD_SRC),)
   217         kx 	$(Q)ln -fsn $(srctree) source
   217         kx 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
   217         kx endif
   217         kx 
   217         kx # To make sure we do not include .config for any of the *config targets
   217         kx # catch them early, and hand them over to scripts/kconfig/Makefile
   217         kx # It is allowed to specify more targets when calling make, including
   217         kx # mixing *config targets and build targets.
   217         kx # For example 'make oldconfig all'.
   217         kx # Detect when mixed targets is specified, and make a second invocation
   217         kx # of make so .config is not included in this case either (for *config).
   217         kx 
   217         kx version_h := include/generated/version_autogenerated.h
   217         kx timestamp_h := include/generated/timestamp_autogenerated.h
   217         kx defaultenv_h := include/generated/defaultenv_autogenerated.h
   217         kx dt_h := include/generated/dt.h
   217         kx 
   217         kx no-dot-config-targets := clean clobber mrproper distclean \
   217         kx 			 help %docs check% coccicheck \
   217         kx 			 ubootversion backup tests check qcheck tcheck
   217         kx 
   217         kx config-targets := 0
   217         kx mixed-targets  := 0
   217         kx dot-config     := 1
   217         kx 
   217         kx ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
   217         kx 	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
   217         kx 		dot-config := 0
   217         kx 	endif
   217         kx endif
   217         kx 
   217         kx ifeq ($(KBUILD_EXTMOD),)
   217         kx         ifneq ($(filter config %config,$(MAKECMDGOALS)),)
   217         kx                 config-targets := 1
   217         kx                 ifneq ($(words $(MAKECMDGOALS)),1)
   217         kx                         mixed-targets := 1
   217         kx                 endif
   217         kx         endif
   217         kx endif
   217         kx 
   217         kx ifeq ($(mixed-targets),1)
   217         kx # ===========================================================================
   217         kx # We're called with mixed targets (*config and build targets).
   217         kx # Handle them one by one.
   217         kx 
   217         kx PHONY += $(MAKECMDGOALS) __build_one_by_one
   217         kx 
   217         kx $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
   217         kx 	@:
   217         kx 
   217         kx __build_one_by_one:
   217         kx 	$(Q)set -e; \
   217         kx 	for i in $(MAKECMDGOALS); do \
   217         kx 		$(MAKE) -f $(srctree)/Makefile $$i; \
   217         kx 	done
   217         kx 
   217         kx else
   217         kx ifeq ($(config-targets),1)
   217         kx # ===========================================================================
   217         kx # *config targets only - make sure prerequisites are updated, and descend
   217         kx # in scripts/kconfig to make the *config target
   217         kx 
   217         kx KBUILD_DEFCONFIG := sandbox_defconfig
   217         kx export KBUILD_DEFCONFIG KBUILD_KCONFIG
   217         kx 
   217         kx config: scripts_basic outputmakefile FORCE
   217         kx 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
   217         kx 
   217         kx %config: scripts_basic outputmakefile FORCE
   217         kx 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
   217         kx 
   217         kx else
   217         kx # ===========================================================================
   217         kx # Build targets only - this includes vmlinux, arch specific targets, clean
   217         kx # targets and others. In general all targets except *config targets.
   217         kx 
   217         kx # Additional helpers built in scripts/
   217         kx # Carefully list dependencies so we do not try to build scripts twice
   217         kx # in parallel
   217         kx PHONY += scripts
   217         kx scripts: scripts_basic scripts_dtc include/config/auto.conf
   217         kx 	$(Q)$(MAKE) $(build)=$(@)
   217         kx 
   217         kx ifeq ($(dot-config),1)
   217         kx # Read in config
   217         kx -include include/config/auto.conf
   217         kx 
   217         kx # Read in dependencies to all Kconfig* files, make sure to run
   217         kx # oldconfig if changes are detected.
   217         kx -include include/config/auto.conf.cmd
   217         kx 
   217         kx # To avoid any implicit rule to kick in, define an empty command
   217         kx $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
   217         kx 
   217         kx # If .config is newer than include/config/auto.conf, someone tinkered
   217         kx # with it and forgot to run make oldconfig.
   217         kx # if auto.conf.cmd is missing then we are probably in a cleaned tree so
   217         kx # we execute the config step to be sure to catch updated Kconfig files
   217         kx include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
   217         kx 	$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
   217         kx 	@# If the following part fails, include/config/auto.conf should be
   217         kx 	@# deleted so "make silentoldconfig" will be re-run on the next build.
   217         kx 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \
   217         kx 		{ rm -f include/config/auto.conf; false; }
   217         kx 	@# include/config.h has been updated after "make silentoldconfig".
   217         kx 	@# We need to touch include/config/auto.conf so it gets newer
   217         kx 	@# than include/config.h.
   217         kx 	@# Otherwise, 'make silentoldconfig' would be invoked twice.
   217         kx 	$(Q)touch include/config/auto.conf
   217         kx 
   217         kx u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg:
   217         kx 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)
   217         kx 
   217         kx -include include/autoconf.mk
   217         kx -include include/autoconf.mk.dep
   217         kx 
   217         kx # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf
   217         kx # is up-to-date. When we switch to a different board configuration, old CONFIG
   217         kx # macros are still remaining in include/config/auto.conf. Without the following
   217         kx # gimmick, wrong config.mk would be included leading nasty warnings/errors.
   217         kx ifneq ($(wildcard $(KCONFIG_CONFIG)),)
   217         kx ifneq ($(wildcard include/config/auto.conf),)
   217         kx autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \
   217         kx 						include/config/auto.conf)
   217         kx ifeq ($(autoconf_is_old),)
   217         kx include config.mk
   217         kx include arch/$(ARCH)/Makefile
   217         kx endif
   217         kx endif
   217         kx endif
   217         kx 
   217         kx # These are set by the arch-specific config.mk. Make sure they are exported
   217         kx # so they can be used when building an EFI application.
   217         kx export EFI_LDS		# Filename of EFI link script in arch/$(ARCH)/lib
   217         kx export EFI_CRT0		# Filename of EFI CRT0 in arch/$(ARCH)/lib
   217         kx export EFI_RELOC	# Filename of EFU relocation code in arch/$(ARCH)/lib
   217         kx export CFLAGS_EFI	# Compiler flags to add when building EFI app
   217         kx export CFLAGS_NON_EFI	# Compiler flags to remove when building EFI app
   217         kx export EFI_TARGET	# binutils target if EFI is natively supported
   217         kx 
   217         kx # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
   217         kx # that (or fail if absent).  Otherwise, search for a linker script in a
   217         kx # standard location.
   217         kx 
   217         kx ifndef LDSCRIPT
   217         kx 	#LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug
   217         kx 	ifdef CONFIG_SYS_LDSCRIPT
   217         kx 		# need to strip off double quotes
   217         kx 		LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%)
   217         kx 	endif
   217         kx endif
   217         kx 
   217         kx # If there is no specified link script, we look in a number of places for it
   217         kx ifndef LDSCRIPT
   217         kx 	ifeq ($(wildcard $(LDSCRIPT)),)
   217         kx 		LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds
   217         kx 	endif
   217         kx 	ifeq ($(wildcard $(LDSCRIPT)),)
   217         kx 		LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds
   217         kx 	endif
   217         kx 	ifeq ($(wildcard $(LDSCRIPT)),)
   217         kx 		LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds
   217         kx 	endif
   217         kx endif
   217         kx 
   217         kx else
   217         kx # Dummy target needed, because used as prerequisite
   217         kx include/config/auto.conf: ;
   217         kx endif # $(dot-config)
   217         kx 
   217         kx #
   217         kx # Xtensa linker script cannot be preprocessed with -ansi because of
   217         kx # preprocessor operations on strings that don't make C identifiers.
   217         kx #
   217         kx ifeq ($(CONFIG_XTENSA),)
   217         kx LDPPFLAGS	+= -ansi
   217         kx endif
   217         kx 
   217         kx ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
   217         kx KBUILD_CFLAGS	+= -Os
   217         kx else
   217         kx KBUILD_CFLAGS	+= -O2
   217         kx endif
   217         kx 
   217         kx LTO_CFLAGS :=
   217         kx LTO_FINAL_LDFLAGS :=
   217         kx export LTO_CFLAGS LTO_FINAL_LDFLAGS
   217         kx ifdef CONFIG_LTO
   217         kx 	ifeq ($(cc-name),clang)
   217         kx 		LTO_CFLAGS		+= -flto
   217         kx 		LTO_FINAL_LDFLAGS	+= -flto
   217         kx 
   217         kx 		AR			= $(shell $(CC) -print-prog-name=llvm-ar)
   217         kx 		NM			= $(shell $(CC) -print-prog-name=llvm-nm)
   217         kx 	else
   217         kx 		NPROC			:= $(shell nproc 2>/dev/null || echo 1)
   217         kx 		LTO_CFLAGS		+= -flto=$(NPROC)
   217         kx 		LTO_FINAL_LDFLAGS	+= -fuse-linker-plugin -flto=$(NPROC)
   217         kx 
   217         kx 		# use plugin aware tools
   217         kx 		AR			= $(CROSS_COMPILE)gcc-ar
   217         kx 		NM			= $(CROSS_COMPILE)gcc-nm
   217         kx 	endif
   217         kx 
   217         kx 	CFLAGS_NON_EFI			+= $(LTO_CFLAGS)
   217         kx 
   217         kx 	KBUILD_CFLAGS			+= $(LTO_CFLAGS)
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_STACKPROTECTOR),y)
   217         kx KBUILD_CFLAGS += $(call cc-option,-fstack-protector-strong)
   217         kx CFLAGS_EFI += $(call cc-option,-fno-stack-protector)
   217         kx else
   217         kx KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
   217         kx endif
   217         kx KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks)
   217         kx 
   217         kx # disable pointer signed / unsigned warnings in gcc 4.0
   217         kx KBUILD_CFLAGS += -Wno-pointer-sign
   217         kx 
   217         kx # disable stringop warnings in gcc 8+
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
   217         kx 
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
   217         kx 
   217         kx # Enabled with W=2, disabled by default as noisy
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
   217         kx 
   217         kx # change __FILE__ to the relative path from the srctree
   217         kx KBUILD_CFLAGS	+= $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
   217         kx 
   217         kx KBUILD_CFLAGS	+= -g
   217         kx # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
   217         kx # option to the assembler.
   217         kx KBUILD_AFLAGS	+= -g
   217         kx 
   217         kx # Report stack usage if supported
   217         kx # ARC tools based on GCC 7.1 has an issue with stack usage
   217         kx # with naked functions, see commit message for more details
   217         kx ifndef CONFIG_ARC
   217         kx ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y)
   217         kx 	KBUILD_CFLAGS += -fstack-usage
   217         kx endif
   217         kx endif
   217         kx 
   217         kx KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
   217         kx 
   217         kx ifdef CONFIG_CC_IS_CLANG
   217         kx KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
   217         kx # Quiet clang warning: comparison of unsigned expression < 0 is always false
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
   217         kx # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
   217         kx # source of a reference will be _MergedGlobals and not on of the whitelisted names.
   217         kx # See modpost pattern 2
   217         kx KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
   217         kx KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
   217         kx endif
   217         kx 
   217         kx # These warnings generated too much noise in a regular build.
   217         kx # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
   217         kx KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
   217         kx 
   217         kx # Prohibit date/time macros, which would make the build non-deterministic
   217         kx KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
   217         kx 
   217         kx include scripts/Makefile.extrawarn
   217         kx 
   217         kx # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
   217         kx KBUILD_CPPFLAGS += $(KCPPFLAGS)
   217         kx KBUILD_AFLAGS += $(KAFLAGS)
   217         kx KBUILD_CFLAGS += $(KCFLAGS)
   217         kx 
   217         kx KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
   217         kx 
   217         kx # Use UBOOTINCLUDE when you must reference the include/ directory.
   217         kx # Needed to be compatible with the O= option
   217         kx UBOOTINCLUDE    := \
   217         kx 	-Iinclude \
   217         kx 	$(if $(KBUILD_SRC), -I$(srctree)/include) \
   217         kx 	$(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \
   217         kx 		$(if $(CONFIG_HAS_THUMB2), \
   217         kx 			$(if $(CONFIG_CPU_V7M), \
   217         kx 				-I$(srctree)/arch/arm/thumb1/include), \
   217         kx 			-I$(srctree)/arch/arm/thumb1/include)) \
   217         kx 	-I$(srctree)/arch/$(ARCH)/include \
   217         kx 	-include $(srctree)/include/linux/kconfig.h
   217         kx 
   217         kx NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
   217         kx 
   217         kx # FIX ME
   217         kx cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
   217         kx 							$(NOSTDINC_FLAGS)
   217         kx c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
   217         kx 
   217         kx #########################################################################
   217         kx # U-Boot objects....order is important (i.e. start must be first)
   217         kx 
   217         kx HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
   217         kx 
   217         kx libs-$(CONFIG_API) += api/
   217         kx libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
   217         kx libs-y += cmd/
   217         kx libs-y += common/
   217         kx libs-$(CONFIG_OF_EMBED) += dts/
   217         kx libs-y += env/
   217         kx libs-y += lib/
   217         kx libs-y += fs/
   217         kx libs-y += net/
   217         kx libs-y += disk/
   217         kx libs-y += drivers/
   217         kx libs-y += drivers/dma/
   217         kx libs-y += drivers/gpio/
   217         kx libs-y += drivers/net/
   217         kx libs-y += drivers/net/phy/
   217         kx libs-y += drivers/power/ \
   217         kx 	drivers/power/domain/ \
   217         kx 	drivers/power/fuel_gauge/ \
   217         kx 	drivers/power/mfd/ \
   217         kx 	drivers/power/pmic/ \
   217         kx 	drivers/power/battery/ \
   217         kx 	drivers/power/regulator/
   217         kx libs-y += drivers/spi/
   217         kx libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
   217         kx libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
   217         kx libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/
   217         kx libs-$(CONFIG_$(SPL_)ALTERA_SDRAM) += drivers/ddr/altera/
   217         kx libs-y += drivers/serial/
   217         kx libs-y += drivers/usb/cdns3/
   217         kx libs-y += drivers/usb/dwc3/
   217         kx libs-y += drivers/usb/common/
   217         kx libs-y += drivers/usb/emul/
   217         kx libs-y += drivers/usb/eth/
   217         kx libs-$(CONFIG_USB_DEVICE) += drivers/usb/gadget/
   217         kx libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/
   217         kx libs-$(CONFIG_USB_GADGET) += drivers/usb/gadget/udc/
   217         kx libs-y += drivers/usb/host/
   217         kx libs-y += drivers/usb/mtu3/
   217         kx libs-y += drivers/usb/musb/
   217         kx libs-y += drivers/usb/musb-new/
   217         kx libs-y += drivers/usb/phy/
   217         kx libs-y += drivers/usb/ulpi/
   217         kx ifdef CONFIG_POST
   217         kx libs-y += post/
   217         kx endif
   217         kx libs-$(CONFIG_UNIT_TEST) += test/
   217         kx libs-$(CONFIG_UT_ENV) += test/env/
   217         kx libs-$(CONFIG_UT_OPTEE) += test/optee/
   217         kx libs-$(CONFIG_UT_OVERLAY) += test/overlay/
   217         kx 
   217         kx libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
   217         kx 
   217         kx libs-y := $(sort $(libs-y))
   217         kx 
   217         kx u-boot-dirs	:= $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples
   217         kx 
   217         kx u-boot-alldirs	:= $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-))))
   217         kx 
   217         kx libs-y		:= $(patsubst %/, %/built-in.o, $(libs-y))
   217         kx 
   217         kx u-boot-init := $(head-y)
   217         kx u-boot-main := $(libs-y)
   217         kx 
   217         kx 
   217         kx # Add GCC lib
   217         kx ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
   217         kx PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
   217         kx else
   217         kx PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
   217         kx endif
   217         kx PLATFORM_LIBS += $(PLATFORM_LIBGCC)
   217         kx 
   217         kx ifdef CONFIG_CC_COVERAGE
   217         kx KBUILD_CFLAGS += --coverage
   217         kx PLATFORM_LIBGCC += -lgcov
   217         kx endif
   217         kx 
   217         kx export PLATFORM_LIBS
   217         kx export PLATFORM_LIBGCC
   217         kx 
   217         kx # Special flags for CPP when processing the linker script.
   217         kx # Pass the version down so we can handle backwards compatibility
   217         kx # on the fly.
   217         kx LDPPFLAGS += \
   217         kx 	-include $(srctree)/include/u-boot/u-boot.lds.h \
   217         kx 	-DCPUDIR=$(CPUDIR) \
   217         kx 	$(shell $(LD) --version | \
   217         kx 	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
   217         kx 
   217         kx #########################################################################
   217         kx #########################################################################
   217         kx 
   217         kx ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
   217         kx BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
   217         kx else
   217         kx BOARD_SIZE_CHECK =
   217         kx endif
   217         kx 
   217         kx ifneq ($(CONFIG_SPL_SIZE_LIMIT),0x0)
   217         kx SPL_SIZE_CHECK = @$(call size_check,$@,$$(tools/spl_size_limit))
   217         kx else
   217         kx SPL_SIZE_CHECK =
   217         kx endif
   217         kx 
   217         kx ifneq ($(CONFIG_TPL_SIZE_LIMIT),0x0)
   217         kx TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT))
   217         kx else
   217         kx TPL_SIZE_CHECK =
   217         kx endif
   217         kx 
   217         kx # Statically apply RELA-style relocations (currently arm64 only)
   217         kx # This is useful for arm64 where static relocation needs to be performed on
   217         kx # the raw binary, but certain simulators only accept an ELF file (but don't
   217         kx # do the relocation).
   217         kx ifneq ($(CONFIG_STATIC_RELA),)
   217         kx # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
   217         kx quiet_cmd_static_rela = RELOC   $@
   217         kx cmd_static_rela = \
   217         kx 	start=$$($(NM) $(2) | grep __rel_dyn_start | cut -f 1 -d ' '); \
   217         kx 	end=$$($(NM) $(2) | grep __rel_dyn_end | cut -f 1 -d ' '); \
   217         kx 	tools/relocate-rela $(3) $(4) $$start $$end
   217         kx else
   217         kx quiet_cmd_static_rela =
   217         kx cmd_static_rela =
   217         kx endif
   217         kx 
   217         kx # Always append INPUTS so that arch config.mk's can add custom ones
   217         kx INPUTS-y += u-boot.srec u-boot.bin u-boot.sym System.map binary_size_check
   217         kx 
   217         kx INPUTS-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
   217         kx ifeq ($(CONFIG_SPL_FSL_PBL),y)
   217         kx INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin
   217         kx else
   217         kx ifneq ($(CONFIG_NXP_ESBC), y)
   217         kx # For Secure Boot The Image needs to be signed and Header must also
   217         kx # be included. So The image has to be built explicitly
   217         kx INPUTS-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
   217         kx endif
   217         kx endif
   217         kx INPUTS-$(CONFIG_SPL) += spl/u-boot-spl.bin
   217         kx ifeq ($(CONFIG_MX6)$(CONFIG_IMX_HAB), yy)
   217         kx INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img
   217         kx else
   217         kx ifeq ($(CONFIG_MX7)$(CONFIG_IMX_HAB), yy)
   217         kx INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot-ivt.img
   217         kx else
   217         kx INPUTS-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
   217         kx endif
   217         kx endif
   217         kx INPUTS-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
   217         kx INPUTS-$(CONFIG_OF_SEPARATE) += u-boot.dtb
   217         kx INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb
   217         kx ifeq ($(CONFIG_SPL_FRAMEWORK),y)
   217         kx INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
   217         kx endif
   217         kx INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
   217         kx ifneq ($(CONFIG_SPL_TARGET),)
   217         kx INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
   217         kx endif
   217         kx INPUTS-$(CONFIG_REMAKE_ELF) += u-boot.elf
   217         kx INPUTS-$(CONFIG_EFI_APP) += u-boot-app.efi
   217         kx INPUTS-$(CONFIG_EFI_STUB) += u-boot-payload.efi
   217         kx 
   217         kx # Generate this input file for binman
   217         kx ifeq ($(CONFIG_SPL),)
   217         kx INPUTS-$(CONFIG_ARCH_MEDIATEK) += u-boot-mtk.bin
   217         kx endif
   217         kx 
   217         kx # Add optional build target if defined in board/cpu/soc headers
   217         kx ifneq ($(CONFIG_BUILD_TARGET),)
   217         kx INPUTS-y += $(CONFIG_BUILD_TARGET:"%"=%)
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
   217         kx INPUTS-y += init_sp_bss_offset_check
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
   217         kx INPUTS-y += u-boot-with-dtb.bin
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
   217         kx # On ARM64 this target is produced by binman so we don't need this dep
   217         kx ifeq ($(CONFIG_ARM64),y)
   217         kx ifeq ($(CONFIG_SPL),y)
   217         kx # TODO: Get binman to generate this too
   217         kx INPUTS-y += u-boot-rockchip.bin
   217         kx endif
   217         kx else
   217         kx ifeq ($(CONFIG_SPL),y)
   217         kx # Generate these inputs for binman which will create the output files
   217         kx INPUTS-y += idbloader.img u-boot.img
   217         kx endif
   217         kx endif
   217         kx endif
   217         kx 
   217         kx INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \
   217         kx 	$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
   217         kx 	$(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin)
   217         kx 
   217         kx LDFLAGS_u-boot += $(LDFLAGS_FINAL)
   217         kx 
   217         kx # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
   217         kx LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) $(call ld-option,--no-warn-rwx-segments)
   217         kx 
   217         kx LDFLAGS_u-boot += --build-id=none
   217         kx 
   217         kx ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),)
   217         kx LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
   217         kx endif
   217         kx 
   217         kx # insure the checker run with the right endianness
   217         kx CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian)
   217         kx 
   217         kx # the checker needs the correct machine size
   217         kx CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32)
   217         kx 
   217         kx # Normally we fill empty space with 0xff
   217         kx quiet_cmd_objcopy = OBJCOPY $@
   217         kx cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
   217         kx 	$(OBJCOPYFLAGS_$(@F)) $< $@
   217         kx 
   217         kx # Provide a version which does not do this, for use by EFI
   217         kx quiet_cmd_zobjcopy = OBJCOPY $@
   217         kx cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
   217         kx 
   217         kx quiet_cmd_efipayload = OBJCOPY $@
   217         kx cmd_efipayload = $(OBJCOPY) -I binary -O $(EFIPAYLOAD_BFDTARGET) -B $(EFIPAYLOAD_BFDARCH) $< $@
   217         kx 
   217         kx MKIMAGEOUTPUT ?= /dev/null
   217         kx 
   217         kx quiet_cmd_mkimage = MKIMAGE $@
   217         kx cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
   217         kx 	>$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
   217         kx 
   217         kx quiet_cmd_mkfitimage = MKIMAGE $@
   217         kx cmd_mkfitimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) \
   217         kx 	-f $(U_BOOT_ITS) -p $(CONFIG_FIT_EXTERNAL_OFFSET) $@ \
   217         kx 	>$(MKIMAGEOUTPUT) $(if $(KBUILD_VERBOSE:0=), && cat $(MKIMAGEOUTPUT))
   217         kx 
   217         kx quiet_cmd_cat = CAT     $@
   217         kx cmd_cat = cat $(filter-out $(PHONY), $^) > $@
   217         kx 
   217         kx append = cat $(filter-out $< $(PHONY), $^) >> $@
   217         kx 
   217         kx quiet_cmd_pad_cat = CAT     $@
   217         kx cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; }
   217         kx 
   217         kx quiet_cmd_lzma = LZMA    $@
   217         kx cmd_lzma = lzma -c -z -k -9 $< > $@
   217         kx 
   217         kx cfg: u-boot.cfg
   217         kx 
   217         kx quiet_cmd_cfgcheck = CFGCHK  $2
   217         kx cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \
   217         kx 		$(srctree)/scripts/config_whitelist.txt $(srctree)
   217         kx 
   217         kx # Concat the value of all the CONFIGs (result is 'y' or 'yy', etc. )
   217         kx got = $(foreach cfg,$(1),$($(cfg)))
   217         kx 
   217         kx # expected value 'y for each one
   217         kx expect = $(foreach cfg,$(1),y)
   217         kx 
   217         kx # Show a deprecation message
   217         kx # Args:
   217         kx # 1: List of CONFIG_DM_... to migrate to (e.g. "CONFIG_DM_MMC CONFIG_BLK")
   217         kx # 2: Name of component (e.g . "Ethernet drivers")
   217         kx # 3: Release deadline (e.g. "v202.07")
   217         kx # 4: Condition to require before checking (e.g. "$(CONFIG_NET)")
   217         kx # Note: Script avoids bash construct, hence the strange double 'if'
   217         kx # (patches welcome!)
   217         kx define deprecated
   217         kx 	@if [ -n "$(strip $(4))" ]; then if [ "$(got)" != "$(expect)" ]; then \
   217         kx 		echo >&2 "===================== WARNING ======================"; \
   217         kx 		echo >&2 "This board does not use $(firstword $(1)) (Driver Model"; \
   217         kx 		echo >&2 "for $(2)). Please update the board to use"; \
   217         kx 		echo >&2 "$(firstword $(1)) before the $(3) release. Failure to"; \
   217         kx 		echo >&2 "update by the deadline may result in board removal."; \
   217         kx 		echo >&2 "See doc/driver-model/migration.rst for more info."; \
   217         kx 		echo >&2 "===================================================="; \
   217         kx 	fi; fi
   217         kx 
   217         kx endef
   217         kx 
   217         kx PHONY += inputs
   217         kx inputs: $(INPUTS-y)
   217         kx 
   217         kx all: .binman_stamp inputs
   217         kx ifeq ($(CONFIG_BINMAN),y)
   217         kx 	$(call if_changed,binman)
   217         kx endif
   217         kx 
   217         kx # Timestamp file to make sure that binman always runs
   217         kx .binman_stamp: FORCE
   217         kx 	@touch $@
   217         kx 
   217         kx ifeq ($(CONFIG_DEPRECATED),y)
   217         kx 	$(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.")
   217         kx endif
   217         kx ifeq ($(CONFIG_OF_EMBED),y)
   217         kx 	@echo >&2 "===================== WARNING ======================"
   217         kx 	@echo >&2 "CONFIG_OF_EMBED is enabled. This option should only"
   217         kx 	@echo >&2 "be used for debugging purposes. Please use"
   217         kx 	@echo >&2 "CONFIG_OF_SEPARATE for boards in mainline."
   217         kx 	@echo >&2 "See doc/README.fdt-control for more info."
   217         kx 	@echo >&2 "===================================================="
   217         kx endif
   217         kx ifneq ($(CONFIG_SPL_FIT_GENERATOR),)
   217         kx 	@echo >&2 "===================== WARNING ======================"
   217         kx 	@echo >&2 "This board uses CONFIG_SPL_FIT_GENERATOR. Please migrate"
   217         kx 	@echo >&2 "to binman instead, to avoid the proliferation of"
   217         kx 	@echo >&2 "arch-specific scripts with no tests."
   217         kx 	@echo >&2 "===================================================="
   217         kx endif
   217         kx ifneq ($(CONFIG_DM),y)
   217         kx 	@echo >&2 "===================== WARNING ======================"
   217         kx 	@echo >&2 "This board does not use CONFIG_DM. CONFIG_DM will be"
   217         kx 	@echo >&2 "compulsory starting with the v2020.01 release."
   217         kx 	@echo >&2 "Failure to update may result in board removal."
   217         kx 	@echo >&2 "See doc/driver-model/migration.rst for more info."
   217         kx 	@echo >&2 "===================================================="
   217         kx endif
   217         kx 	$(call deprecated,CONFIG_WDT,DM watchdog,v2019.10,\
   217         kx 		$(CONFIG_WATCHDOG)$(CONFIG_HW_WATCHDOG))
   217         kx 	$(call deprecated,CONFIG_DM_ETH,Ethernet drivers,v2020.07,$(CONFIG_NET))
   217         kx 	$(call deprecated,CONFIG_DM_I2C,I2C drivers,v2022.04,$(CONFIG_SYS_I2C_LEGACY))
   217         kx 	@# Check that this build does not use CONFIG options that we do not
   217         kx 	@# know about unless they are in Kconfig. All the existing CONFIG
   217         kx 	@# options are whitelisted, so new ones should not be added.
   217         kx 	$(call cmd,cfgcheck,u-boot.cfg)
   217         kx 
   217         kx PHONY += dtbs
   217         kx dtbs: dts/dt.dtb
   217         kx 	@:
   217         kx dts/dt.dtb: u-boot
   217         kx 	$(Q)$(MAKE) $(build)=dts dtbs
   217         kx 
   217         kx quiet_cmd_copy = COPY    $@
   217         kx       cmd_copy = cp $< $@
   217         kx 
   217         kx ifeq ($(CONFIG_MULTI_DTB_FIT),y)
   217         kx 
   217         kx ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
   217         kx FINAL_DTB_CONTAINER = fit-dtb.blob.lzo
   217         kx else ifeq ($(CONFIG_MULTI_DTB_FIT_GZIP),y)
   217         kx FINAL_DTB_CONTAINER = fit-dtb.blob.gz
   217         kx else
   217         kx FINAL_DTB_CONTAINER = fit-dtb.blob
   217         kx endif
   217         kx 
   217         kx fit-dtb.blob.gz: fit-dtb.blob
   217         kx 	@gzip -kf9 $< > $@
   217         kx 
   217         kx fit-dtb.blob.lzo: fit-dtb.blob
   217         kx 	@lzop -f9 $< > $@
   217         kx 
   217         kx fit-dtb.blob: dts/dt.dtb FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx ifneq ($(SOURCE_DATE_EPOCH),)
   217         kx 	touch -d @$(SOURCE_DATE_EPOCH) fit-dtb.blob
   217         kx 	chmod 0600 fit-dtb.blob
   217         kx endif
   217         kx 
   217         kx MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
   217         kx 	-a 0 -e 0 -E \
   217         kx 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d /dev/null
   217         kx 
   217         kx MKIMAGEFLAGS_fit-dtb.blob += -B 0x8
   217         kx 
   217         kx ifneq ($(EXT_DTB),)
   217         kx u-boot-fit-dtb.bin: u-boot-nodtb.bin $(EXT_DTB)
   217         kx 		$(call if_changed,cat)
   217         kx else
   217         kx u-boot-fit-dtb.bin: u-boot-nodtb.bin $(FINAL_DTB_CONTAINER)
   217         kx 	$(call if_changed,cat)
   217         kx endif
   217         kx 
   217         kx u-boot.bin: u-boot-fit-dtb.bin FORCE
   217         kx 	$(call if_changed,copy)
   217         kx 
   217         kx u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
   217         kx 	$(call if_changed,cat)
   217         kx 
   217         kx else ifeq ($(CONFIG_OF_SEPARATE),y)
   217         kx u-boot-dtb.bin: u-boot-nodtb.bin dts/dt.dtb FORCE
   217         kx 	$(call if_changed,cat)
   217         kx 
   217         kx u-boot.bin: u-boot-dtb.bin FORCE
   217         kx 	$(call if_changed,copy)
   217         kx else
   217         kx u-boot.bin: u-boot-nodtb.bin FORCE
   217         kx 	$(call if_changed,copy)
   217         kx endif
   217         kx 
   217         kx # we call Makefile in arch/arm/mach-imx which
   217         kx # has targets which are dependent on targets defined
   217         kx # here. make could not resolve them and we must ensure
   217         kx # that they are finished before calling imx targets
   217         kx ifeq ($(CONFIG_MULTI_DTB_FIT),y)
   217         kx IMX_DEPS = u-boot-fit-dtb.bin
   217         kx endif
   217         kx 
   217         kx %.imx: $(IMX_DEPS) %.bin
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx 	$(BOARD_SIZE_CHECK)
   217         kx 
   217         kx %.vyb: %.imx
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/cpu/armv7/vf610 $@
   217         kx 
   217         kx quiet_cmd_copy = COPY    $@
   217         kx       cmd_copy = cp $< $@
   217         kx 
   217         kx u-boot.dtb: dts/dt.dtb
   217         kx 	$(call cmd,copy)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot.hex := -O ihex
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot.srec := -O srec
   217         kx 
   217         kx u-boot.hex u-boot.srec: u-boot FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-elf.srec := $(OBJCOPYFLAGS_u-boot.srec)
   217         kx 
   217         kx u-boot-elf.srec: u-boot.elf FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-spl.srec = $(OBJCOPYFLAGS_u-boot.srec)
   217         kx 
   217         kx spl/u-boot-spl.srec: spl/u-boot-spl FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx %.scif: %.srec
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-rmobile $@
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
   217         kx 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
   217         kx 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
   217         kx 
   217         kx binary_size_check: u-boot-nodtb.bin FORCE
   217         kx 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
   217         kx 	map_size=$(shell cat u-boot.map | \
   217         kx 		awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
   217         kx 		| sed 's/0X//g' \
   217         kx 		| bc); \
   217         kx 	if [ "" != "$$map_size" ]; then \
   217         kx 		if test $$map_size -ne $$file_size; then \
   217         kx 			echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
   217         kx 			echo "  but u-boot-nodtb.bin shows $$file_size" >&2 ; \
   217         kx 			exit 1; \
   217         kx 		fi \
   217         kx 	fi
   217         kx 
   217         kx ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
   217         kx ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
   217         kx subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN)))
   217         kx else
   217         kx subtract_sys_malloc_f_len = true
   217         kx endif
   217         kx # The 1/4 margin below is somewhat arbitrary. The likely initial SP usage is
   217         kx # so low that the DTB could probably use 90%+ of the available space, for
   217         kx # current values of CONFIG_SYS_INIT_SP_BSS_OFFSET at least. However, let's be
   217         kx # safe for now and tweak this later if space becomes tight.
   217         kx # A rejected alternative would be to check that some absolute minimum stack
   217         kx # space was available. However, since CONFIG_SYS_INIT_SP_BSS_OFFSET is
   217         kx # deliberately build-specific, to take account of build-to-build stack usage
   217         kx # differences due to different feature sets, there is no common absolute value
   217         kx # to check against.
   217         kx init_sp_bss_offset_check: u-boot.dtb FORCE
   217         kx 	@dtb_size=$(shell wc -c u-boot.dtb | awk '{print $$1}') ; \
   217         kx 	space=$(CONFIG_SYS_INIT_SP_BSS_OFFSET) ; \
   217         kx 	$(subtract_sys_malloc_f_len) ; \
   217         kx 	quarter_space=$$(($${space} / 4)) ; \
   217         kx 	if [ $${dtb_size} -gt $${quarter_space} ]; then \
   217         kx 		echo "u-boot.dtb is larger than 1 quarter of " >&2 ; \
   217         kx 		echo "(CONFIG_SYS_INIT_SP_BSS_OFFSET - CONFIG_SYS_MALLOC_F_LEN)" >&2 ; \
   217         kx 		exit 1 ; \
   217         kx 	fi
   217         kx endif
   217         kx 
   217         kx shell_cmd = { $(call echo-cmd,$(1)) $(cmd_$(1)); }
   217         kx 
   217         kx quiet_cmd_objcopy_uboot = OBJCOPY $@
   217         kx ifdef cmd_static_rela
   217         kx cmd_objcopy_uboot = $(cmd_objcopy) && $(call shell_cmd,static_rela,$<,$@,$(CONFIG_SYS_TEXT_BASE)) || { rm -f $@; false; }
   217         kx else
   217         kx cmd_objcopy_uboot = $(cmd_objcopy)
   217         kx endif
   217         kx 
   217         kx u-boot-nodtb.bin: u-boot FORCE
   217         kx 	$(call if_changed,objcopy_uboot)
   217         kx 	$(BOARD_SIZE_CHECK)
   217         kx 
   217         kx u-boot.ldr:	u-boot
   217         kx 		$(CREATE_LDR_ENV)
   217         kx 		$(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS)
   217         kx 		$(BOARD_SIZE_CHECK)
   217         kx 
   217         kx # binman
   217         kx # ---------------------------------------------------------------------------
   217         kx # Use 'make BINMAN_DEBUG=1' to enable debugging
   217         kx # Use 'make BINMAN_VERBOSE=3' to set vebosity level
   217         kx default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
   217         kx 
   217         kx # Tell binman whether we have a devicetree for SPL and TPL
   217         kx have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL))
   217         kx have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL))
   217         kx 
   217         kx quiet_cmd_binman = BINMAN  $@
   217         kx cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
   217         kx                 --toolpath $(objtree)/tools \
   217         kx 		$(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
   217         kx 		build -u -d u-boot.dtb -O . -m --allow-missing \
   217         kx 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
   217         kx 		-I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
   217         kx 		-a atf-bl31-path=${BL31} \
   217         kx 		-a opensbi-path=${OPENSBI} \
   217         kx 		-a default-dt=$(default_dt) \
   217         kx 		-a scp-path=$(SCP) \
   217         kx 		-a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
   217         kx 		-a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
   217         kx 		-a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \
   217         kx 		$(BINMAN_$(@F))
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
   217         kx 
   217         kx u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx #
   217         kx # U-Boot entry point, needed for booting of full-blown U-Boot
   217         kx # from the SPL U-Boot version.
   217         kx #
   217         kx ifndef CONFIG_SYS_UBOOT_START
   217         kx CONFIG_SYS_UBOOT_START := $(CONFIG_SYS_TEXT_BASE)
   217         kx endif
   217         kx 
   217         kx # Boards with more complex image requirements can provide an .its source file
   217         kx # or a generator script
   217         kx # NOTE: Please do not use this. We are migrating away from Makefile rules to use
   217         kx # binman instead.
   217         kx ifneq ($(CONFIG_SPL_FIT_SOURCE),"")
   217         kx U_BOOT_ITS := u-boot.its
   217         kx $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE))
   217         kx 	$(call if_changed,copy)
   217         kx else
   217         kx ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),)
   217         kx U_BOOT_ITS := u-boot.its
   217         kx ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh")
   217         kx U_BOOT_ITS_DEPS += u-boot-nodtb.bin
   217         kx endif
   217         kx ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py")
   217         kx U_BOOT_ITS_DEPS += u-boot
   217         kx endif
   217         kx $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
   217         kx 	$(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \
   217         kx 	$(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
   217         kx endif
   217         kx endif
   217         kx 
   217         kx ifdef CONFIG_SPL_LOAD_FIT
   217         kx MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
   217         kx 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
   217         kx 	-p $(CONFIG_FIT_EXTERNAL_OFFSET) \
   217         kx 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
   217         kx 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \
   217         kx 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
   217         kx 	$(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
   217         kx else
   217         kx MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
   217         kx 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
   217         kx 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
   217         kx MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
   217         kx 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
   217         kx 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
   217         kx u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
   217         kx endif
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
   217         kx 
   217         kx # Some boards have the kwbimage.cfg file written in advance, while some
   217         kx # other boards generate it on the fly during the build in the build tree.
   217         kx # Let's check if the file exists in the build tree first, otherwise we
   217         kx # fall back to use the one in the source tree.
   217         kx KWD_CONFIG_FILE = $(shell \
   217         kx 	if [ -f $(objtree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) ]; then \
   217         kx 		echo -n $(objtree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%); \
   217         kx 	else \
   217         kx 		echo -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%); \
   217         kx 	fi)
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot.kwb = -n $(KWD_CONFIG_FILE) \
   217         kx 	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot-spl.kwb = -n $(KWD_CONFIG_FILE) \
   217         kx 	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
   217         kx 	$(if $(KEYDIR),-k $(KEYDIR))
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
   217         kx 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
   217         kx 
   217         kx ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
   217         kx UBOOT_BIN := u-boot-with-dtb.bin
   217         kx else
   217         kx UBOOT_BIN := u-boot.bin
   217         kx endif
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \
   217         kx 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
   217         kx 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
   217         kx 
   217         kx u-boot.bin.lzma: u-boot.bin FORCE
   217         kx 	$(call if_changed,lzma)
   217         kx 
   217         kx u-boot-lzma.img: u-boot.bin.lzma FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \
   217         kx 		$(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \
   217         kx 			$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \
   217         kx 		,$(UBOOT_BIN)) FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 	$(BOARD_SIZE_CHECK)
   217         kx 
   217         kx ifeq ($(CONFIG_SPL_LOAD_FIT_FULL),y)
   217         kx MKIMAGEFLAGS_u-boot.itb =
   217         kx else
   217         kx MKIMAGEFLAGS_u-boot.itb = -E
   217         kx endif
   217         kx MKIMAGEFLAGS_u-boot.itb += -B 0x8
   217         kx 
   217         kx ifdef U_BOOT_ITS
   217         kx u-boot.itb: u-boot-nodtb.bin \
   217         kx 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \
   217         kx 		$(U_BOOT_ITS) FORCE
   217         kx 	$(call if_changed,mkfitimage)
   217         kx 	$(BOARD_SIZE_CHECK)
   217         kx endif
   217         kx 
   217         kx u-boot-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx u-boot.sha1:	u-boot.bin
   217         kx 		tools/ubsha1 u-boot.bin
   217         kx 
   217         kx u-boot.dis:	u-boot
   217         kx 		$(OBJDUMP) -d $< > $@
   217         kx 
   217         kx ifneq ($(CONFIG_SPL_PAYLOAD),)
   217         kx SPL_PAYLOAD := $(CONFIG_SPL_PAYLOAD:"%"=%)
   217         kx else
   217         kx SPL_PAYLOAD := u-boot.bin
   217         kx endif
   217         kx 
   217         kx SPL_IMAGE := $(CONFIG_SPL_IMAGE:"%"=%)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
   217         kx 				   --pad-to=$(CONFIG_SPL_PAD_TO)
   217         kx u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx 
   217         kx ifeq ($(CONFIG_ARCH_ROCKCHIP),y)
   217         kx 
   217         kx # TPL + SPL
   217         kx ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy)
   217         kx MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd
   217         kx tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,cat)
   217         kx else
   217         kx MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd
   217         kx idbloader.img: spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_ARM64),y)
   217         kx OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \
   217         kx 	--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
   217         kx u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx endif # CONFIG_ARM64
   217         kx 
   217         kx endif # CONFIG_ARCH_ROCKCHIP
   217         kx 
   217         kx ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
   217         kx MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
   217         kx 
   217         kx lpc32xx-spl.img: spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
   217         kx 
   217         kx lpc32xx-boot-0.bin: lpc32xx-spl.img FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
   217         kx 
   217         kx lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE
   217         kx 	$(call if_changed,cat)
   217         kx 
   217         kx endif
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
   217         kx 				   --pad-to=$(CONFIG_TPL_PAD_TO)
   217         kx tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx 
   217         kx SPL: spl/u-boot-spl.bin FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx 
   217         kx ifeq ($(CONFIG_ARCH_IMX8M)$(CONFIG_ARCH_IMX8), y)
   217         kx ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y)
   217         kx u-boot.cnt: u-boot.bin FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx 
   217         kx flash.bin: spl/u-boot-spl.bin u-boot.cnt FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx else
   217         kx ifeq ($(CONFIG_BINMAN),y)
   217         kx flash.bin: spl/u-boot-spl.bin $(INPUTS-y) FORCE
   217         kx 	$(call if_changed,binman)
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx else
   217         kx flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx endif
   217         kx endif
   217         kx endif
   217         kx 
   217         kx u-boot.uim: u-boot.bin FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx 
   217         kx u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE)
   217         kx 
   217         kx u-boot.ubl: u-boot-with-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \
   217         kx 	$(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \
   217         kx 	-T aisimage -e $(CONFIG_SPL_TEXT_BASE)
   217         kx spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
   217         kx u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx 
   217         kx u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb
   217         kx u-boot.sb: u-boot.bin spl/u-boot-spl.bin
   217         kx 	$(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb
   217         kx 
   217         kx MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \
   217         kx 	-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER
   217         kx spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx ifneq ($(CONFIG_ARCH_SOCFPGA),)
   217         kx quiet_cmd_gensplx4 = GENSPLX4 $@
   217         kx cmd_gensplx4 = $(OBJCOPY) -I binary -O binary --gap-fill=0x0		\
   217         kx 			--pad-to=$(CONFIG_SPL_PAD_TO)			\
   217         kx 			spl/u-boot-spl.sfp spl/u-boot-spl.sfp &&        \
   217         kx 		cat	spl/u-boot-spl.sfp spl/u-boot-spl.sfp		\
   217         kx 			spl/u-boot-spl.sfp spl/u-boot-spl.sfp > $@ || { rm -f $@; false; }
   217         kx spl/u-boot-splx4.sfp: spl/u-boot-spl.sfp FORCE
   217         kx 	$(call if_changed,gensplx4)
   217         kx 
   217         kx quiet_cmd_socboot = SOCBOOT $@
   217         kx cmd_socboot = cat	spl/u-boot-splx4.sfp u-boot.img > $@ || { rm -f $@; false; }
   217         kx u-boot-with-spl.sfp: spl/u-boot-splx4.sfp u-boot.img FORCE
   217         kx 	$(call if_changed,socboot)
   217         kx 
   217         kx quiet_cmd_gensplpadx4 = GENSPLPADX4 $@
   217         kx cmd_gensplpadx4 =  dd if=/dev/zero of=spl/u-boot-spl.pad bs=64 count=1024 ; \
   217         kx 		   cat	spl/u-boot-spl.sfp spl/u-boot-spl.pad \
   217         kx 			spl/u-boot-spl.sfp spl/u-boot-spl.pad \
   217         kx 			spl/u-boot-spl.sfp spl/u-boot-spl.pad \
   217         kx 			spl/u-boot-spl.sfp spl/u-boot-spl.pad > $@ || \
   217         kx 			{ rm -f $@ spl/u-boot-spl.pad; false; }
   217         kx u-boot-spl-padx4.sfp: spl/u-boot-spl.sfp FORCE
   217         kx 	$(call if_changed,gensplpadx4)
   217         kx 
   217         kx quiet_cmd_socnandboot = SOCNANDBOOT $@
   217         kx cmd_socnandboot = cat	u-boot-spl-padx4.sfp u-boot.img > $@ || { rm -f $@; false; }
   217         kx u-boot-with-nand-spl.sfp: u-boot-spl-padx4.sfp u-boot.img FORCE
   217         kx 	$(call if_changed,socnandboot)
   217         kx 
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
   217         kx u-boot-with-dtb.bin: u-boot.bin u-boot.dtb \
   217         kx 	$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin) FORCE
   217         kx 	$(call if_changed,binman)
   217         kx 
   217         kx ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR),y)
   217         kx OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec
   217         kx u-boot-br.bin: u-boot FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx endif
   217         kx endif
   217         kx 
   217         kx quiet_cmd_ldr = LD      $@
   217         kx cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
   217         kx 	       $(filter-out FORCE,$^) -o $@
   217         kx 
   217         kx ifdef CONFIG_X86
   217         kx OBJCOPYFLAGS_u-boot-x86-start16.bin := -O binary -j .start16
   217         kx u-boot-x86-start16.bin: u-boot FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-x86-reset16.bin := -O binary -j .resetvec
   217         kx u-boot-x86-reset16.bin: u-boot FORCE
   217         kx 	$(call if_changed,objcopy)
   217         kx 
   217         kx endif # CONFIG_X86
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-app.efi := $(OBJCOPYFLAGS_EFI)
   217         kx u-boot-app.efi: u-boot FORCE
   217         kx 	$(call if_changed,zobjcopy)
   217         kx 
   217         kx u-boot.bin.o: u-boot.bin FORCE
   217         kx 	$(call if_changed,efipayload)
   217         kx 
   217         kx u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE
   217         kx 	$(call if_changed_dep,cpp_lds)
   217         kx 
   217         kx # Rule to link the EFI payload which contains a stub and a U-Boot binary
   217         kx quiet_cmd_u-boot_payload ?= LD      $@
   217         kx       cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \
   217         kx       -T u-boot-payload.lds arch/x86/cpu/call32.o \
   217         kx       lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \
   217         kx       $(addprefix arch/$(ARCH)/lib/,$(EFISTUB))
   217         kx 
   217         kx u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE
   217         kx 	$(call if_changed,u-boot_payload)
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-payload.efi := $(OBJCOPYFLAGS_EFI)
   217         kx u-boot-payload.efi: u-boot-payload FORCE
   217         kx 	$(call if_changed,zobjcopy)
   217         kx 
   217         kx u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
   217         kx 	$(call if_changed,cat)
   217         kx 
   217         kx #Add a target to create boot binary having SPL binary in PBI format
   217         kx #concatenated with u-boot binary. It is need by PowerPC SoC having
   217         kx #internal SRAM <= 512KB.
   217         kx MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
   217         kx 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
   217         kx 		-A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE)
   217         kx 
   217         kx spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx 
   217         kx ifeq ($(ARCH),arm)
   217         kx UBOOT_BINLOAD := u-boot.img
   217         kx else
   217         kx ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
   217         kx UBOOT_BINLOAD := u-boot-with-dtb.bin
   217         kx else
   217         kx UBOOT_BINLOAD := u-boot.bin
   217         kx endif
   217         kx endif
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
   217         kx 			  --gap-fill=0xff
   217         kx 
   217         kx u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx 
   217         kx # PPC4xx needs the SPL at the end of the image, since the reset vector
   217         kx # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
   217         kx # and need to introduce a new build target with the full blown U-Boot
   217         kx # at the start padded up to the start of the SPL image. And then concat
   217         kx # the SPL image to the end.
   217         kx 
   217         kx OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
   217         kx 	--pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff
   217         kx u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
   217         kx 	$(call if_changed,pad_cat)
   217         kx 
   217         kx quiet_cmd_u-boot-elf ?= LD      $@
   217         kx 	cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \
   217         kx 	-T u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \
   217         kx 	-Ttext=$(CONFIG_SYS_TEXT_BASE)
   217         kx u-boot.elf: u-boot.bin u-boot-elf.lds
   217         kx 	$(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o
   217         kx 	$(call if_changed,u-boot-elf)
   217         kx 
   217         kx u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE
   217         kx 	$(call if_changed_dep,cpp_lds)
   217         kx 
   217         kx # MediaTek's ARM-based u-boot needs a header to contains its load address
   217         kx # which is parsed by the BootROM.
   217         kx # If the SPL build is enabled, the header will be added to the spl binary,
   217         kx # and the spl binary and the u-boot.img will be combined into one file.
   217         kx # Otherwise the header will be added to the u-boot.bin directly.
   217         kx 
   217         kx ifeq ($(CONFIG_SPL),y)
   217         kx spl/u-boot-spl-mtk.bin: spl/u-boot-spl
   217         kx 
   217         kx u-boot-mtk.bin: u-boot-with-spl.bin
   217         kx 	$(call if_changed,copy)
   217         kx else
   217         kx MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
   217         kx 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
   217         kx 	-n "$(patsubst "%",%,$(CONFIG_MTK_BROM_HEADER_INFO))"
   217         kx 
   217         kx u-boot-mtk.bin: u-boot.bin FORCE
   217         kx 	$(call if_changed,mkimage)
   217         kx endif
   217         kx 
   217         kx quiet_cmd_endian_swap = SWAP    $@
   217         kx       cmd_endian_swap = $(srctree)/tools/endian-swap.py $< $@
   217         kx 
   217         kx u-boot-swap.bin: u-boot.bin FORCE
   217         kx 	$(call if_changed,endian_swap)
   217         kx 
   217         kx ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(ARCH)/Makefile.postlink)
   217         kx 
   217         kx # Generate linker list symbols references to force compiler to not optimize
   217         kx # them away when compiling with LTO
   217         kx ifdef CONFIG_LTO
   217         kx u-boot-keep-syms-lto := keep-syms-lto.o
   217         kx u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto))
   217         kx 
   217         kx quiet_cmd_keep_syms_lto = KSL     $@
   217         kx       cmd_keep_syms_lto = \
   217         kx 	$(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@
   217         kx 
   217         kx quiet_cmd_keep_syms_lto_cc = KSLCC   $@
   217         kx       cmd_keep_syms_lto_cc = \
   217         kx 	$(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o $@ $<
   217         kx 
   217         kx $(u-boot-keep-syms-lto_c): $(u-boot-main)
   217         kx 	$(call if_changed,keep_syms_lto)
   217         kx $(u-boot-keep-syms-lto): $(u-boot-keep-syms-lto_c)
   217         kx 	$(call if_changed,keep_syms_lto_cc)
   217         kx else
   217         kx u-boot-keep-syms-lto :=
   217         kx endif
   217         kx 
   217         kx # Rule to link u-boot
   217         kx # May be overridden by arch/$(ARCH)/config.mk
   217         kx ifdef CONFIG_LTO
   217         kx quiet_cmd_u-boot__ ?= LTO     $@
   217         kx       cmd_u-boot__ ?= 								\
   217         kx 		$(CC) -nostdlib -nostartfiles					\
   217         kx 		$(LTO_FINAL_LDFLAGS) $(c_flags)					\
   217         kx 		$(KBUILD_LDFLAGS:%=-Wl,%) $(LDFLAGS_u-boot:%=-Wl,%) -o $@	\
   217         kx 		-T u-boot.lds $(u-boot-init)					\
   217         kx 		-Wl,--whole-archive						\
   217         kx 			$(u-boot-main)						\
   217         kx 			$(u-boot-keep-syms-lto)					\
   217         kx 			$(PLATFORM_LIBS)					\
   217         kx 		-Wl,--no-whole-archive						\
   217         kx 		-Wl,-Map,u-boot.map;						\
   217         kx 		$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
   217         kx else
   217         kx quiet_cmd_u-boot__ ?= LD      $@
   217         kx       cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@		\
   217         kx 		-T u-boot.lds $(u-boot-init)					\
   217         kx 		--whole-archive							\
   217         kx 			$(u-boot-main)						\
   217         kx 		--no-whole-archive						\
   217         kx 		$(PLATFORM_LIBS) -Map u-boot.map;				\
   217         kx 		$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
   217         kx endif
   217         kx 
   217         kx quiet_cmd_smap = GEN     common/system_map.o
   217         kx cmd_smap = \
   217         kx 	smap=`$(call SYSTEM_MAP,u-boot) | \
   217         kx 		awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
   217         kx 	$(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
   217         kx 		-c $(srctree)/common/system_map.c -o common/system_map.o
   217         kx 
   217         kx u-boot:	$(u-boot-init) $(u-boot-main) $(u-boot-keep-syms-lto) u-boot.lds FORCE
   217         kx 	+$(call if_changed,u-boot__)
   217         kx ifeq ($(CONFIG_KALLSYMS),y)
   217         kx 	$(call cmd,smap)
   217         kx 	$(call cmd,u-boot__) common/system_map.o
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_RISCV),y)
   217         kx 	@tools/prelink-riscv $@ 0
   217         kx endif
   217         kx 
   217         kx quiet_cmd_sym ?= SYM     $@
   217         kx       cmd_sym ?= $(OBJDUMP) -t $< > $@
   217         kx u-boot.sym: u-boot FORCE
   217         kx 	$(call if_changed,sym)
   217         kx 
   217         kx # The actual objects are generated when descending,
   217         kx # make sure no implicit rule kicks in
   217         kx $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ;
   217         kx 
   217         kx # Handle descending into subdirectories listed in $(u-boot-dirs)
   217         kx # Preset locale variables to speed up the build process. Limit locale
   217         kx # tweaks to this spot to avoid wrong language settings when running
   217         kx # make menuconfig etc.
   217         kx # Error messages still appears in the original language
   217         kx 
   217         kx PHONY += $(u-boot-dirs)
   217         kx $(u-boot-dirs): prepare scripts
   217         kx 	$(Q)$(MAKE) $(build)=$@
   217         kx 
   217         kx tools: prepare
   217         kx # The "tools" are needed early
   217         kx $(filter-out tools, $(u-boot-dirs)): tools
   217         kx # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
   217         kx # is "yes"), so compile examples after U-Boot is compiled.
   217         kx examples: $(filter-out examples, $(u-boot-dirs))
   217         kx 
   217         kx define filechk_uboot.release
   217         kx 	echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
   217         kx endef
   217         kx 
   217         kx # Store (new) UBOOTRELEASE string in include/config/uboot.release
   217         kx include/config/uboot.release: include/config/auto.conf FORCE
   217         kx 	$(call filechk,uboot.release)
   217         kx 
   217         kx 
   217         kx # Things we need to do before we recursively start building the kernel
   217         kx # or the modules are listed in "prepare".
   217         kx # A multi level approach is used. prepareN is processed before prepareN-1.
   217         kx # archprepare is used in arch Makefiles and when processed asm symlink,
   217         kx # version.h and scripts_basic is processed / created.
   217         kx 
   217         kx # Listed in dependency order
   217         kx PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
   217         kx 
   217         kx # prepare3 is used to check if we are building in a separate output directory,
   217         kx # and if so do:
   217         kx # 1) Check that make has not been executed in the kernel src $(srctree)
   217         kx prepare3: include/config/uboot.release
   217         kx ifneq ($(KBUILD_SRC),)
   217         kx 	@$(kecho) '  Using $(srctree) as source for U-Boot'
   217         kx 	$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
   217         kx 		echo >&2 "  $(srctree) is not clean, please run 'make mrproper'"; \
   217         kx 		echo >&2 "  in the '$(srctree)' directory.";\
   217         kx 		/bin/false; \
   217         kx 	fi;
   217         kx endif
   217         kx 
   217         kx # prepare2 creates a makefile if using a separate output directory
   217         kx prepare2: prepare3 outputmakefile cfg
   217         kx 
   217         kx prepare1: prepare2 $(version_h) $(timestamp_h) $(dt_h) \
   217         kx                    include/config/auto.conf
   217         kx ifeq ($(wildcard $(LDSCRIPT)),)
   217         kx 	@echo >&2 "  Could not find linker script."
   217         kx 	@/bin/false
   217         kx endif
   217         kx 
   217         kx ifeq ($(CONFIG_USE_DEFAULT_ENV_FILE),y)
   217         kx prepare1: $(defaultenv_h)
   217         kx 
   217         kx envtools: $(defaultenv_h)
   217         kx endif
   217         kx 
   217         kx archprepare: prepare1 scripts_basic
   217         kx 
   217         kx prepare0: archprepare FORCE
   217         kx 	$(Q)$(MAKE) $(build)=.
   217         kx 
   217         kx # All the preparing..
   217         kx prepare: prepare0
   217         kx 
   217         kx # Generate some files
   217         kx # ---------------------------------------------------------------------------
   217         kx 
   217         kx # Use sed to remove leading zeros from PATCHLEVEL to avoid using octal numbers
   217         kx define filechk_version.h
   217         kx 	(echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
   217         kx 	echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
   217         kx 	echo \#define U_BOOT_VERSION_NUM $(VERSION); \
   217         kx 	echo \#define U_BOOT_VERSION_NUM_PATCH $$(echo $(PATCHLEVEL) | \
   217         kx 		sed -e "s/^0*//"); \
   217         kx 	echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
   217         kx 	echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
   217         kx endef
   217         kx 
   217         kx # The SOURCE_DATE_EPOCH mechanism requires a date that behaves like GNU date.
   217         kx # The BSD date on the other hand behaves different and would produce errors
   217         kx # with the misused '-d' switch.  Respect that and search a working date with
   217         kx # well known pre- and suffixes for the GNU variant of date.
   217         kx define filechk_timestamp.h
   217         kx 	(if test -n "$${SOURCE_DATE_EPOCH}"; then \
   217         kx 		SOURCE_DATE="@$${SOURCE_DATE_EPOCH}"; \
   217         kx 		DATE=""; \
   217         kx 		for date in gdate date.gnu date; do \
   217         kx 			$${date} -u -d "$${SOURCE_DATE}" >/dev/null 2>&1 && DATE="$${date}"; \
   217         kx 		done; \
   217         kx 		if test -n "$${DATE}"; then \
   217         kx 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
   217         kx 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \
   217         kx 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \
   217         kx 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \
   217         kx 			LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_EPOCH %s'; \
   217         kx 		else \
   217         kx 			return 42; \
   217         kx 		fi; \
   217         kx 	else \
   217         kx 		LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \
   217         kx 		LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \
   217         kx 		LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \
   217         kx 		LC_ALL=C date +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \
   217         kx 		LC_ALL=C date +'#define U_BOOT_EPOCH %s'; \
   217         kx 	fi)
   217         kx endef
   217         kx 
   217         kx define filechk_defaultenv.h
   217         kx 	( { grep -v '^#' | grep -v '^$$' || true ; echo '' ; } | \
   217         kx 	 tr '\n' '\0' | \
   217         kx 	 sed -e 's/\\\x0\s*//g' | \
   217         kx 	 xxd -i ; )
   217         kx endef
   217         kx 
   217         kx define filechk_dt.h
   217         kx 	(if test -n "$${DEVICE_TREE}"; then \
   217         kx 		echo \#define DEVICE_TREE \"$(DEVICE_TREE)\"; \
   217         kx 	else \
   217         kx 		echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; \
   217         kx 	fi)
   217         kx endef
   217         kx 
   217         kx $(version_h): include/config/uboot.release FORCE
   217         kx 	$(call filechk,version.h)
   217         kx 
   217         kx $(timestamp_h): $(srctree)/Makefile FORCE
   217         kx 	$(call filechk,timestamp.h)
   217         kx 
   217         kx $(dt_h): $(srctree)/Makefile FORCE
   217         kx 	$(call filechk,dt.h)
   217         kx 
   217         kx $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
   217         kx 	$(call filechk,defaultenv.h)
   217         kx 
   217         kx # ---------------------------------------------------------------------------
   217         kx # Devicetree files
   217         kx 
   217         kx ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/boot/dts/),)
   217         kx dtstree := arch/$(SRCARCH)/boot/dts
   217         kx endif
   217         kx 
   217         kx ifneq ($(dtstree),)
   217         kx 
   217         kx %.dtb: prepare3 scripts_dtc
   217         kx 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
   217         kx 
   217         kx PHONY += dtbs dtbs_install
   217         kx dtbs: prepare3 scripts_dtc
   217         kx 	$(Q)$(MAKE) $(build)=$(dtstree)
   217         kx 
   217         kx dtbs_install:
   217         kx 	$(Q)$(MAKE) $(dtbinst)=$(dtstree)
   217         kx 
   217         kx ifdef CONFIG_OF_EARLY_FLATTREE
   217         kx all: dtbs
   217         kx endif
   217         kx 
   217         kx endif
   217         kx 
   217         kx PHONY += scripts_dtc
   217         kx scripts_dtc: scripts_basic
   217         kx 	$(Q)$(MAKE) $(build)=scripts/dtc
   217         kx 
   217         kx # ---------------------------------------------------------------------------
   217         kx quiet_cmd_cpp_lds = LDS     $@
   217         kx cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
   217         kx 		-D__ASSEMBLY__ -x assembler-with-cpp -std=c99 -P -o $@ $<
   217         kx 
   217         kx u-boot.lds: $(LDSCRIPT) prepare FORCE
   217         kx 	$(call if_changed_dep,cpp_lds)
   217         kx 
   217         kx spl/u-boot-spl.bin: spl/u-boot-spl
   217         kx 	@:
   217         kx 	$(SPL_SIZE_CHECK)
   217         kx 
   217         kx spl/u-boot-spl-dtb.bin: spl/u-boot-spl
   217         kx 	@:
   217         kx 
   217         kx spl/u-boot-spl-dtb.hex: spl/u-boot-spl
   217         kx 	@:
   217         kx 
   217         kx spl/u-boot-spl: tools prepare \
   217         kx 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
   217         kx 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
   217         kx 	$(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
   217         kx 
   217         kx spl/sunxi-spl.bin: spl/u-boot-spl
   217         kx 	@:
   217         kx 
   217         kx spl/sunxi-spl-with-ecc.bin: spl/sunxi-spl.bin
   217         kx 	@:
   217         kx 
   217         kx spl/u-boot-spl.sfp: spl/u-boot-spl
   217         kx 	@:
   217         kx 
   217         kx spl/boot.bin: spl/u-boot-spl
   217         kx 	@:
   217         kx 
   217         kx tpl/u-boot-tpl.bin: tools prepare \
   217         kx 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb)
   217         kx 	$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
   217         kx 	$(TPL_SIZE_CHECK)
   217         kx 
   217         kx TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
   217         kx 
   217         kx FIND := find
   217         kx FINDFLAGS := -L
   217         kx 
   217         kx tags ctags:
   217         kx 		ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
   217         kx 						-name '*.[chS]' -print`
   217         kx 		ln -s ctags tags
   217         kx 
   217         kx etags:
   217         kx 		etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
   217         kx 						-name '*.[chS]' -print`
   217         kx cscope:
   217         kx 		$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
   217         kx 						cscope.files
   217         kx 		@find $(TAG_SUBDIRS) -name '*.[chS]' -type l -print | \
   217         kx 			grep -xvf - cscope.files > cscope.files.no-symlinks; \
   217         kx 		mv cscope.files.no-symlinks cscope.files
   217         kx 		cscope -b -q -k
   217         kx 
   217         kx SYSTEM_MAP = \
   217         kx 		$(NM) $1 | \
   217         kx 		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
   217         kx 		LC_ALL=C sort
   217         kx System.map:	u-boot
   217         kx 		@$(call SYSTEM_MAP,$<) > $@
   217         kx 
   217         kx #########################################################################
   217         kx 
   217         kx # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
   217         kx # R_AARCH64_RELATIVE (64-bit).
   217         kx checkarmreloc: u-boot
   217         kx 	@RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
   217         kx 		grep R_A | sort -u`"; \
   217         kx 	if test "$$RELOC" != "R_ARM_RELATIVE" -a \
   217         kx 		 "$$RELOC" != "R_AARCH64_RELATIVE"; then \
   217         kx 		echo "$< contains unexpected relocations: $$RELOC"; \
   217         kx 		false; \
   217         kx 	fi
   217         kx 
   217         kx tools/version.h: include/version.h
   217         kx 	$(Q)mkdir -p $(dir $@)
   217         kx 	$(call if_changed,copy)
   217         kx 
   217         kx envtools: scripts_basic $(version_h) $(timestamp_h) tools/version.h
   217         kx 	$(Q)$(MAKE) $(build)=tools/env
   217         kx 
   217         kx tools-only: export TOOLS_ONLY=y
   217         kx tools-only: scripts_basic $(version_h) $(timestamp_h) tools/version.h
   217         kx 	$(Q)$(MAKE) $(build)=tools
   217         kx 
   217         kx tools-all: export HOST_TOOLS_ALL=y
   217         kx tools-all: envtools tools ;
   217         kx 
   217         kx cross_tools: export CROSS_BUILD_TOOLS=y
   217         kx cross_tools: tools ;
   217         kx 
   217         kx .PHONY : CHANGELOG
   217         kx CHANGELOG:
   217         kx 	git log --no-merges U-Boot-1_1_5.. | \
   217         kx 	unexpand -a | sed -e 's/\s\s*$$//' > $@
   217         kx 
   217         kx #########################################################################
   217         kx 
   217         kx ###
   217         kx # Cleaning is done on three levels.
   217         kx # make clean     Delete most generated files
   217         kx #                Leave enough to build external modules
   217         kx # make mrproper  Delete the current configuration, and all generated files
   217         kx # make distclean Remove editor backup files, patch leftover files and the like
   217         kx 
   217         kx # Directories & files removed with 'make clean'
   217         kx CLEAN_DIRS  += $(MODVERDIR) \
   217         kx 	       $(foreach d, spl tpl, $(patsubst %,$d/%, \
   217         kx 			$(filter-out include, $(shell ls -1 $d 2>/dev/null))))
   217         kx 
   217         kx CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
   217         kx 	       boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
   217         kx 	       u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
   217         kx 	       lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
   217         kx 	       idbloader.img flash.bin flash.log defconfig keep-syms-lto.c
   217         kx 
   217         kx # Directories & files removed with 'make mrproper'
   217         kx MRPROPER_DIRS  += include/config include/generated spl tpl \
   217         kx 		  .tmp_objdiff doc/output include/asm
   217         kx 
   217         kx # Remove include/asm symlink created by U-Boot before v2014.01
   217         kx MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \
   217         kx 		  ctags etags tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
   217         kx 		  drivers/video/fonts/*.S include/asm
   217         kx 
   217         kx # clean - Delete most, but leave enough to build external modules
   217         kx #
   217         kx clean: rm-dirs  := $(CLEAN_DIRS)
   217         kx clean: rm-files := $(CLEAN_FILES)
   217         kx 
   217         kx clean-dirs	:= $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f))
   217         kx 
   217         kx clean-dirs      := $(addprefix _clean_, $(clean-dirs))
   217         kx 
   217         kx PHONY += $(clean-dirs) clean archclean
   217         kx $(clean-dirs):
   217         kx 	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
   217         kx 
   217         kx clean: $(clean-dirs)
   217         kx 	$(call cmd,rmdirs)
   217         kx 	$(call cmd,rmfiles)
   217         kx 	@find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
   217         kx 		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
   217         kx 		-o -name '*.ko.*' -o -name '*.su' -o -name '*.pyc' \
   217         kx 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
   217         kx 		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
   217         kx 		-o -name '*.asn1.[ch]' \
   217         kx 		-o -name '*.symtypes' -o -name 'modules.order' \
   217         kx 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
   217         kx 		-o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
   217         kx 		-o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
   217         kx 		-type f -print | xargs rm -f
   217         kx 
   217         kx # mrproper - Delete all generated files, including .config
   217         kx #
   217         kx mrproper: rm-dirs  := $(wildcard $(MRPROPER_DIRS))
   217         kx mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
   217         kx mrproper-dirs      := $(addprefix _mrproper_,scripts)
   217         kx 
   217         kx PHONY += $(mrproper-dirs) mrproper archmrproper
   217         kx $(mrproper-dirs):
   217         kx 	$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
   217         kx 
   217         kx mrproper: clean $(mrproper-dirs)
   217         kx 	$(call cmd,rmdirs)
   217         kx 	$(call cmd,rmfiles)
   217         kx 	@rm -f arch/*/include/asm/arch
   217         kx 
   217         kx # distclean
   217         kx #
   217         kx PHONY += distclean
   217         kx 
   217         kx distclean: mrproper
   217         kx 	@find $(srctree) $(RCS_FIND_IGNORE) \
   217         kx 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
   217         kx 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
   217         kx 		-o -name '.*.rej' -o -name '*%' -o -name 'core' \
   217         kx 		-o -name '*.pyc' \) \
   217         kx 		-type f -print | xargs rm -f
   217         kx 	@rm -f boards.cfg CHANGELOG
   217         kx 
   217         kx backup:
   217         kx 	F=`basename $(srctree)` ; cd .. ; \
   217         kx 	gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
   217         kx 
   217         kx help:
   217         kx 	@echo  'Cleaning targets:'
   217         kx 	@echo  '  clean		  - Remove most generated files but keep the config'
   217         kx 	@echo  '  mrproper	  - Remove all generated files + config + various backup files'
   217         kx 	@echo  '  distclean	  - mrproper + remove editor backup and patch files'
   217         kx 	@echo  ''
   217         kx 	@echo  'Configuration targets:'
   217         kx 	@$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
   217         kx 	@echo  ''
   217         kx 	@echo  'Test targets:'
   217         kx 	@echo  ''
   217         kx 	@echo  '  check           - Run all automated tests that use sandbox'
   217         kx 	@echo  '  qcheck          - Run quick automated tests that use sandbox'
   217         kx 	@echo  '  tcheck          - Run quick automated tests on tools'
   217         kx 	@echo  ''
   217         kx 	@echo  'Other generic targets:'
   217         kx 	@echo  '  all		  - Build all necessary images depending on configuration'
   217         kx 	@echo  '  tests		  - Build U-Boot for sandbox and run tests'
   217         kx 	@echo  '* u-boot	  - Build the bare u-boot'
   217         kx 	@echo  '  dir/            - Build all files in dir and below'
   217         kx 	@echo  '  dir/file.[oisS] - Build specified target only'
   217         kx 	@echo  '  dir/file.lst    - Build specified mixed source/assembly target only'
   217         kx 	@echo  '                    (requires a recent binutils and recent build (System.map))'
   217         kx 	@echo  '  tags/ctags	  - Generate ctags file for editors'
   217         kx 	@echo  '  etags		  - Generate etags file for editors'
   217         kx 	@echo  '  cscope	  - Generate cscope index'
   217         kx 	@echo  '  ubootrelease	  - Output the release version string (use with make -s)'
   217         kx 	@echo  '  ubootversion	  - Output the version stored in Makefile (use with make -s)'
   217         kx 	@echo  "  cfg		  - Don't build, just create the .cfg files"
   217         kx 	@echo  "  envtools	  - Build only the target-side environment tools"
   217         kx 	@echo  ''
   217         kx 	@echo  'Static analysers'
   217         kx 	@echo  '  checkstack      - Generate a list of stack hogs'
   217         kx 	@echo  '  coccicheck      - Execute static code analysis with Coccinelle'
   217         kx 	@echo  ''
   217         kx 	@echo  'Documentation targets:'
   217         kx 	@$(MAKE) -f $(srctree)/doc/Makefile dochelp
   217         kx 	@echo  ''
   217         kx 	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
   217         kx 	@echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
   217         kx 	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
   217         kx 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
   217         kx 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
   217         kx 	@echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
   217         kx 	@echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
   217         kx 	@echo  '		1: warnings which may be relevant and do not occur too often'
   217         kx 	@echo  '		2: warnings which occur quite often but may still be relevant'
   217         kx 	@echo  '		3: more obscure warnings, can most likely be ignored'
   217         kx 	@echo  '		Multiple levels can be combined with W=12 or W=123'
   217         kx 	@echo  ''
   217         kx 	@echo  'Execute "make" or "make all" to build all targets marked with [*] '
   217         kx 	@echo  'For further info see the ./README file'
   217         kx 
   217         kx tests check:
   217         kx 	$(srctree)/test/run
   217         kx 
   217         kx qcheck:
   217         kx 	$(srctree)/test/run quick
   217         kx 
   217         kx tcheck:
   217         kx 	$(srctree)/test/run tools
   217         kx 
   217         kx # Documentation targets
   217         kx # ---------------------------------------------------------------------------
   217         kx DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
   217         kx 	       linkcheckdocs dochelp refcheckdocs
   217         kx PHONY += $(DOC_TARGETS)
   217         kx $(DOC_TARGETS): scripts_basic FORCE
   217         kx 	$(Q)$(MAKE) $(build)=doc $@
   217         kx 
   217         kx PHONY += checkstack ubootrelease ubootversion
   217         kx 
   217         kx checkstack:
   217         kx 	$(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
   217         kx 	$(PERL) $(src)/scripts/checkstack.pl $(ARCH)
   217         kx 
   217         kx ubootrelease:
   217         kx 	@echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
   217         kx 
   217         kx ubootversion:
   217         kx 	@echo $(UBOOTVERSION)
   217         kx 
   217         kx # Single targets
   217         kx # ---------------------------------------------------------------------------
   217         kx # Single targets are compatible with:
   217         kx # - build with mixed source and output
   217         kx # - build with separate output dir 'make O=...'
   217         kx # - external modules
   217         kx #
   217         kx #  target-dir => where to store outputfile
   217         kx #  build-dir  => directory in kernel source tree to use
   217         kx 
   217         kx ifeq ($(KBUILD_EXTMOD),)
   217         kx         build-dir  = $(patsubst %/,%,$(dir $@))
   217         kx         target-dir = $(dir $@)
   217         kx else
   217         kx         zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
   217         kx         build-dir  = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
   217         kx         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
   217         kx endif
   217         kx 
   217         kx %.s: %.c prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.i: %.c prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.o: %.c prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.lst: %.c prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.s: %.S prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.o: %.S prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx %.symtypes: %.c prepare scripts FORCE
   217         kx 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
   217         kx 
   217         kx # Modules
   217         kx /: prepare scripts FORCE
   217         kx 	$(cmd_crmodverdir)
   217         kx 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
   217         kx 	$(build)=$(build-dir)
   217         kx %/: prepare scripts FORCE
   217         kx 	$(cmd_crmodverdir)
   217         kx 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
   217         kx 	$(build)=$(build-dir)
   217         kx %.ko: prepare scripts FORCE
   217         kx 	$(cmd_crmodverdir)
   217         kx 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
   217         kx 	$(build)=$(build-dir) $(@:.ko=.o)
   217         kx 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
   217         kx 
   217         kx quiet_cmd_genenv = GENENV  $@
   217         kx cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
   217         kx 	sed --in-place -e 's/\x00/\x0A/g' $@
   217         kx 
   217         kx u-boot-initial-env: u-boot.bin
   217         kx 	$(call if_changed,genenv)
   217         kx 
   217         kx # Consistency checks
   217         kx # ---------------------------------------------------------------------------
   217         kx 
   217         kx PHONY += coccicheck
   217         kx 
   217         kx coccicheck:
   217         kx 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
   217         kx 
   217         kx # FIXME Should go into a make.lib or something
   217         kx # ===========================================================================
   217         kx 
   217         kx quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
   217         kx       cmd_rmdirs = rm -rf $(rm-dirs)
   217         kx 
   217         kx quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
   217         kx       cmd_rmfiles = rm -f $(rm-files)
   217         kx 
   217         kx # read all saved command lines
   217         kx 
   217         kx cmd_files := $(wildcard .*.cmd)
   217         kx 
   217         kx ifneq ($(cmd_files),)
   217         kx   $(cmd_files): ;	# Do not try to update included dependency files
   217         kx   include $(cmd_files)
   217         kx endif
   217         kx 
   217         kx endif    #ifeq ($(config-targets),1)
   217         kx endif    #ifeq ($(mixed-targets),1)
   217         kx endif	# skip-makefile
   217         kx 
   217         kx PHONY += FORCE
   217         kx FORCE:
   217         kx 
   217         kx # Declare the contents of the PHONY variable as phony.  We keep that
   217         kx # information in a variable so we can use it in if_changed and friends.
   217         kx .PHONY: $(PHONY)