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