Makefile 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562
  1. VERSION = 2015
  2. PATCHLEVEL = 10
  3. SUBLEVEL =
  4. EXTRAVERSION = -rc1
  5. NAME =
  6. # *DOCUMENTATION*
  7. # To see a list of typical targets execute "make help"
  8. # More info can be located in ./README
  9. # Comments in this file are targeted only to the developer, do not
  10. # expect to learn how to build the kernel reading this file.
  11. # o Do not use make's built-in rules and variables
  12. # (this increases performance and avoids hard-to-debug behaviour);
  13. # o Look for make include files relative to root of kernel src
  14. MAKEFLAGS += -rR --include-dir=$(CURDIR)
  15. # Avoid funny character set dependencies
  16. unexport LC_ALL
  17. LC_COLLATE=C
  18. LC_NUMERIC=C
  19. export LC_COLLATE LC_NUMERIC
  20. # Avoid interference with shell env settings
  21. unexport GREP_OPTIONS
  22. # We are using a recursive build, so we need to do a little thinking
  23. # to get the ordering right.
  24. #
  25. # Most importantly: sub-Makefiles should only ever modify files in
  26. # their own directory. If in some directory we have a dependency on
  27. # a file in another dir (which doesn't happen often, but it's often
  28. # unavoidable when linking the built-in.o targets which finally
  29. # turn into vmlinux), we will call a sub make in that other dir, and
  30. # after that we are sure that everything which is in that other dir
  31. # is now up to date.
  32. #
  33. # The only cases where we need to modify files which have global
  34. # effects are thus separated out and done before the recursive
  35. # descending is started. They are now explicitly listed as the
  36. # prepare rule.
  37. # Beautify output
  38. # ---------------------------------------------------------------------------
  39. #
  40. # Normally, we echo the whole command before executing it. By making
  41. # that echo $($(quiet)$(cmd)), we now have the possibility to set
  42. # $(quiet) to choose other forms of output instead, e.g.
  43. #
  44. # quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
  45. # cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
  46. #
  47. # If $(quiet) is empty, the whole command will be printed.
  48. # If it is set to "quiet_", only the short version will be printed.
  49. # If it is set to "silent_", nothing will be printed at all, since
  50. # the variable $(silent_cmd_cc_o_c) doesn't exist.
  51. #
  52. # A simple variant is to prefix commands with $(Q) - that's useful
  53. # for commands that shall be hidden in non-verbose mode.
  54. #
  55. # $(Q)ln $@ :<
  56. #
  57. # If KBUILD_VERBOSE equals 0 then the above command will be hidden.
  58. # If KBUILD_VERBOSE equals 1 then the above command is displayed.
  59. #
  60. # To put more focus on warnings, be less verbose as default
  61. # Use 'make V=1' to see the full commands
  62. ifeq ("$(origin V)", "command line")
  63. KBUILD_VERBOSE = $(V)
  64. endif
  65. ifndef KBUILD_VERBOSE
  66. KBUILD_VERBOSE = 0
  67. endif
  68. ifeq ($(KBUILD_VERBOSE),1)
  69. quiet =
  70. Q =
  71. else
  72. quiet=quiet_
  73. Q = @
  74. endif
  75. # If the user is running make -s (silent mode), suppress echoing of
  76. # commands
  77. ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
  78. ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
  79. quiet=silent_
  80. endif
  81. else # make-3.8x
  82. ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
  83. quiet=silent_
  84. endif
  85. endif
  86. export quiet Q KBUILD_VERBOSE
  87. # kbuild supports saving output files in a separate directory.
  88. # To locate output files in a separate directory two syntaxes are supported.
  89. # In both cases the working directory must be the root of the kernel src.
  90. # 1) O=
  91. # Use "make O=dir/to/store/output/files/"
  92. #
  93. # 2) Set KBUILD_OUTPUT
  94. # Set the environment variable KBUILD_OUTPUT to point to the directory
  95. # where the output files shall be placed.
  96. # export KBUILD_OUTPUT=dir/to/store/output/files/
  97. # make
  98. #
  99. # The O= assignment takes precedence over the KBUILD_OUTPUT environment
  100. # variable.
  101. # KBUILD_SRC is set on invocation of make in OBJ directory
  102. # KBUILD_SRC is not intended to be used by the regular user (for now)
  103. ifeq ($(KBUILD_SRC),)
  104. # OK, Make called in directory where kernel src resides
  105. # Do we want to locate output files in a separate directory?
  106. ifeq ("$(origin O)", "command line")
  107. KBUILD_OUTPUT := $(O)
  108. endif
  109. # That's our default target when none is given on the command line
  110. PHONY := _all
  111. _all:
  112. # Cancel implicit rules on top Makefile
  113. $(CURDIR)/Makefile Makefile: ;
  114. ifneq ($(KBUILD_OUTPUT),)
  115. # Invoke a second make in the output directory, passing relevant variables
  116. # check that the output directory actually exists
  117. saved-output := $(KBUILD_OUTPUT)
  118. KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
  119. && /bin/pwd)
  120. $(if $(KBUILD_OUTPUT),, \
  121. $(error failed to create output directory "$(saved-output)"))
  122. PHONY += $(MAKECMDGOALS) sub-make
  123. $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
  124. @:
  125. sub-make: FORCE
  126. $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
  127. -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
  128. # Leave processing to above invocation of make
  129. skip-makefile := 1
  130. endif # ifneq ($(KBUILD_OUTPUT),)
  131. endif # ifeq ($(KBUILD_SRC),)
  132. # We process the rest of the Makefile if this is the final invocation of make
  133. ifeq ($(skip-makefile),)
  134. # Do not print "Entering directory ...",
  135. # but we want to display it when entering to the output directory
  136. # so that IDEs/editors are able to understand relative filenames.
  137. MAKEFLAGS += --no-print-directory
  138. # Call a source code checker (by default, "sparse") as part of the
  139. # C compilation.
  140. #
  141. # Use 'make C=1' to enable checking of only re-compiled files.
  142. # Use 'make C=2' to enable checking of *all* source files, regardless
  143. # of whether they are re-compiled or not.
  144. #
  145. # See the file "Documentation/sparse.txt" for more details, including
  146. # where to get the "sparse" utility.
  147. ifeq ("$(origin C)", "command line")
  148. KBUILD_CHECKSRC = $(C)
  149. endif
  150. ifndef KBUILD_CHECKSRC
  151. KBUILD_CHECKSRC = 0
  152. endif
  153. # Use make M=dir to specify directory of external module to build
  154. # Old syntax make ... SUBDIRS=$PWD is still supported
  155. # Setting the environment variable KBUILD_EXTMOD take precedence
  156. ifdef SUBDIRS
  157. KBUILD_EXTMOD ?= $(SUBDIRS)
  158. endif
  159. ifeq ("$(origin M)", "command line")
  160. KBUILD_EXTMOD := $(M)
  161. endif
  162. # If building an external module we do not care about the all: rule
  163. # but instead _all depend on modules
  164. PHONY += all
  165. ifeq ($(KBUILD_EXTMOD),)
  166. _all: all
  167. else
  168. _all: modules
  169. endif
  170. ifeq ($(KBUILD_SRC),)
  171. # building in the source tree
  172. srctree := .
  173. else
  174. ifeq ($(KBUILD_SRC)/,$(dir $(CURDIR)))
  175. # building in a subdirectory of the source tree
  176. srctree := ..
  177. else
  178. srctree := $(KBUILD_SRC)
  179. endif
  180. endif
  181. objtree := .
  182. src := $(srctree)
  183. obj := $(objtree)
  184. VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
  185. export srctree objtree VPATH
  186. # Make sure CDPATH settings don't interfere
  187. unexport CDPATH
  188. #########################################################################
  189. HOSTARCH := $(shell uname -m | \
  190. sed -e s/i.86/x86/ \
  191. -e s/sun4u/sparc64/ \
  192. -e s/arm.*/arm/ \
  193. -e s/sa110/arm/ \
  194. -e s/ppc64/powerpc/ \
  195. -e s/ppc/powerpc/ \
  196. -e s/macppc/powerpc/\
  197. -e s/sh.*/sh/)
  198. HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
  199. sed -e 's/\(cygwin\).*/cygwin/')
  200. export HOSTARCH HOSTOS
  201. #########################################################################
  202. # set default to nothing for native builds
  203. ifeq ($(HOSTARCH),$(ARCH))
  204. CROSS_COMPILE ?=
  205. endif
  206. KCONFIG_CONFIG ?= .config
  207. export KCONFIG_CONFIG
  208. # SHELL used by kbuild
  209. CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  210. else if [ -x /bin/bash ]; then echo /bin/bash; \
  211. else echo sh; fi ; fi)
  212. HOSTCC = cc
  213. HOSTCXX = c++
  214. HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
  215. HOSTCXXFLAGS = -O2
  216. ifeq ($(HOSTOS),cygwin)
  217. HOSTCFLAGS += -ansi
  218. endif
  219. # Mac OS X / Darwin's C preprocessor is Apple specific. It
  220. # generates numerous errors and warnings. We want to bypass it
  221. # and use GNU C's cpp. To do this we pass the -traditional-cpp
  222. # option to the compiler. Note that the -traditional-cpp flag
  223. # DOES NOT have the same semantics as GNU C's flag, all it does
  224. # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
  225. #
  226. # Apple's linker is similar, thanks to the new 2 stage linking
  227. # multiple symbol definitions are treated as errors, hence the
  228. # -multiply_defined suppress option to turn off this error.
  229. #
  230. ifeq ($(HOSTOS),darwin)
  231. # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
  232. DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
  233. DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
  234. os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
  235. $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
  236. # Snow Leopards build environment has no longer restrictions as described above
  237. HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc")
  238. HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
  239. HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
  240. # since Lion (10.7) ASLR is on by default, but we use linker generated lists
  241. # in some host tools which is a problem then ... so disable ASLR for these
  242. # tools
  243. HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie")
  244. endif
  245. # Decide whether to build built-in, modular, or both.
  246. # Normally, just do built-in.
  247. KBUILD_MODULES :=
  248. KBUILD_BUILTIN := 1
  249. # If we have only "make modules", don't compile built-in objects.
  250. # When we're building modules with modversions, we need to consider
  251. # the built-in objects during the descend as well, in order to
  252. # make sure the checksums are up to date before we record them.
  253. ifeq ($(MAKECMDGOALS),modules)
  254. KBUILD_BUILTIN := $(if $(CONFIG_MODVERSIONS),1)
  255. endif
  256. # If we have "make <whatever> modules", compile modules
  257. # in addition to whatever we do anyway.
  258. # Just "make" or "make all" shall build modules as well
  259. # U-Boot does not need modules
  260. #ifneq ($(filter all _all modules,$(MAKECMDGOALS)),)
  261. # KBUILD_MODULES := 1
  262. #endif
  263. #ifeq ($(MAKECMDGOALS),)
  264. # KBUILD_MODULES := 1
  265. #endif
  266. export KBUILD_MODULES KBUILD_BUILTIN
  267. export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
  268. # We need some generic definitions (do not try to remake the file).
  269. scripts/Kbuild.include: ;
  270. include scripts/Kbuild.include
  271. # Make variables (CC, etc...)
  272. AS = $(CROSS_COMPILE)as
  273. # Always use GNU ld
  274. ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
  275. LD = $(CROSS_COMPILE)ld.bfd
  276. else
  277. LD = $(CROSS_COMPILE)ld
  278. endif
  279. CC = $(CROSS_COMPILE)gcc
  280. CPP = $(CC) -E
  281. AR = $(CROSS_COMPILE)ar
  282. NM = $(CROSS_COMPILE)nm
  283. LDR = $(CROSS_COMPILE)ldr
  284. STRIP = $(CROSS_COMPILE)strip
  285. OBJCOPY = $(CROSS_COMPILE)objcopy
  286. OBJDUMP = $(CROSS_COMPILE)objdump
  287. AWK = awk
  288. PERL = perl
  289. PYTHON = python
  290. DTC = dtc
  291. CHECK = sparse
  292. CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  293. -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
  294. KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
  295. KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
  296. -Wno-format-security \
  297. -fno-builtin -ffreestanding
  298. KBUILD_AFLAGS := -D__ASSEMBLY__
  299. # Read UBOOTRELEASE from include/config/uboot.release (if it exists)
  300. UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
  301. UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
  302. export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
  303. export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
  304. export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
  305. export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
  306. export MAKE AWK PERL PYTHON
  307. export HOSTCXX HOSTCXXFLAGS DTC CHECK CHECKFLAGS
  308. export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
  309. export KBUILD_CFLAGS KBUILD_AFLAGS
  310. # When compiling out-of-tree modules, put MODVERDIR in the module
  311. # tree rather than in the kernel tree. The kernel tree might
  312. # even be read-only.
  313. export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions
  314. # Files to ignore in find ... statements
  315. export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
  316. -name CVS -o -name .pc -o -name .hg -o -name .git \) \
  317. -prune -o
  318. export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
  319. --exclude CVS --exclude .pc --exclude .hg --exclude .git
  320. # ===========================================================================
  321. # Rules shared between *config targets and build targets
  322. # Basic helpers built in scripts/
  323. PHONY += scripts_basic
  324. scripts_basic:
  325. $(Q)$(MAKE) $(build)=scripts/basic
  326. $(Q)rm -f .tmp_quiet_recordmcount
  327. # To avoid any implicit rule to kick in, define an empty command.
  328. scripts/basic/%: scripts_basic ;
  329. PHONY += outputmakefile
  330. # outputmakefile generates a Makefile in the output directory, if using a
  331. # separate output directory. This allows convenient use of make in the
  332. # output directory.
  333. outputmakefile:
  334. ifneq ($(KBUILD_SRC),)
  335. $(Q)ln -fsn $(srctree) source
  336. $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
  337. $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
  338. endif
  339. # To make sure we do not include .config for any of the *config targets
  340. # catch them early, and hand them over to scripts/kconfig/Makefile
  341. # It is allowed to specify more targets when calling make, including
  342. # mixing *config targets and build targets.
  343. # For example 'make oldconfig all'.
  344. # Detect when mixed targets is specified, and make a second invocation
  345. # of make so .config is not included in this case either (for *config).
  346. version_h := include/generated/version_autogenerated.h
  347. timestamp_h := include/generated/timestamp_autogenerated.h
  348. no-dot-config-targets := clean clobber mrproper distclean \
  349. help %docs check% coccicheck \
  350. ubootversion backup
  351. config-targets := 0
  352. mixed-targets := 0
  353. dot-config := 1
  354. ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
  355. ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
  356. dot-config := 0
  357. endif
  358. endif
  359. ifeq ($(KBUILD_EXTMOD),)
  360. ifneq ($(filter config %config,$(MAKECMDGOALS)),)
  361. config-targets := 1
  362. ifneq ($(words $(MAKECMDGOALS)),1)
  363. mixed-targets := 1
  364. endif
  365. endif
  366. endif
  367. ifeq ($(mixed-targets),1)
  368. # ===========================================================================
  369. # We're called with mixed targets (*config and build targets).
  370. # Handle them one by one.
  371. PHONY += $(MAKECMDGOALS) __build_one_by_one
  372. $(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
  373. @:
  374. __build_one_by_one:
  375. $(Q)set -e; \
  376. for i in $(MAKECMDGOALS); do \
  377. $(MAKE) -f $(srctree)/Makefile $$i; \
  378. done
  379. else
  380. ifeq ($(config-targets),1)
  381. # ===========================================================================
  382. # *config targets only - make sure prerequisites are updated, and descend
  383. # in scripts/kconfig to make the *config target
  384. KBUILD_DEFCONFIG := sandbox_defconfig
  385. export KBUILD_DEFCONFIG KBUILD_KCONFIG
  386. config: scripts_basic outputmakefile FORCE
  387. $(Q)$(MAKE) $(build)=scripts/kconfig $@
  388. %config: scripts_basic outputmakefile FORCE
  389. $(Q)$(MAKE) $(build)=scripts/kconfig $@
  390. else
  391. # ===========================================================================
  392. # Build targets only - this includes vmlinux, arch specific targets, clean
  393. # targets and others. In general all targets except *config targets.
  394. ifeq ($(dot-config),1)
  395. # Read in config
  396. -include include/config/auto.conf
  397. # Read in dependencies to all Kconfig* files, make sure to run
  398. # oldconfig if changes are detected.
  399. -include include/config/auto.conf.cmd
  400. # To avoid any implicit rule to kick in, define an empty command
  401. $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ;
  402. # If .config is newer than include/config/auto.conf, someone tinkered
  403. # with it and forgot to run make oldconfig.
  404. # if auto.conf.cmd is missing then we are probably in a cleaned tree so
  405. # we execute the config step to be sure to catch updated Kconfig files
  406. include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd
  407. $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig
  408. @# If the following part fails, include/config/auto.conf should be
  409. @# deleted so "make silentoldconfig" will be re-run on the next build.
  410. $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf || \
  411. { rm -f include/config/auto.conf; false; }
  412. @# include/config.h has been updated after "make silentoldconfig".
  413. @# We need to touch include/config/auto.conf so it gets newer
  414. @# than include/config.h.
  415. @# Otherwise, 'make silentoldconfig' would be invoked twice.
  416. $(Q)touch include/config/auto.conf
  417. -include include/autoconf.mk
  418. -include include/autoconf.mk.dep
  419. # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf
  420. # is up-to-date. When we switch to a different board configuration, old CONFIG
  421. # macros are still remaining in include/config/auto.conf. Without the following
  422. # gimmick, wrong config.mk would be included leading nasty warnings/errors.
  423. ifneq ($(wildcard $(KCONFIG_CONFIG)),)
  424. ifneq ($(wildcard include/config/auto.conf),)
  425. autoconf_is_old := $(shell find . -path ./$(KCONFIG_CONFIG) -newer \
  426. include/config/auto.conf)
  427. ifeq ($(autoconf_is_old),)
  428. include config.mk
  429. include arch/$(ARCH)/Makefile
  430. endif
  431. endif
  432. endif
  433. # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
  434. # that (or fail if absent). Otherwise, search for a linker script in a
  435. # standard location.
  436. ifndef LDSCRIPT
  437. #LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug
  438. ifdef CONFIG_SYS_LDSCRIPT
  439. # need to strip off double quotes
  440. LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%)
  441. endif
  442. endif
  443. # If there is no specified link script, we look in a number of places for it
  444. ifndef LDSCRIPT
  445. ifeq ($(wildcard $(LDSCRIPT)),)
  446. LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds
  447. endif
  448. ifeq ($(wildcard $(LDSCRIPT)),)
  449. LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds
  450. endif
  451. ifeq ($(wildcard $(LDSCRIPT)),)
  452. LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds
  453. endif
  454. endif
  455. else
  456. # Dummy target needed, because used as prerequisite
  457. include/config/auto.conf: ;
  458. endif # $(dot-config)
  459. ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  460. KBUILD_CFLAGS += -Os
  461. else
  462. KBUILD_CFLAGS += -O2
  463. endif
  464. ifdef BUILD_TAG
  465. KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
  466. endif
  467. KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
  468. KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks)
  469. KBUILD_CFLAGS += -g
  470. # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
  471. # option to the assembler.
  472. KBUILD_AFLAGS += -g
  473. # Report stack usage if supported
  474. ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y)
  475. KBUILD_CFLAGS += -fstack-usage
  476. endif
  477. KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
  478. # turn jbsr into jsr for m68k
  479. ifeq ($(ARCH),m68k)
  480. ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
  481. KBUILD_AFLAGS += -Wa,-gstabs,-S
  482. endif
  483. endif
  484. # Prohibit date/time macros, which would make the build non-deterministic
  485. KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
  486. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  487. KBUILD_CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
  488. endif
  489. export CONFIG_SYS_TEXT_BASE
  490. include scripts/Makefile.extrawarn
  491. # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
  492. KBUILD_CPPFLAGS += $(KCPPFLAGS)
  493. KBUILD_AFLAGS += $(KAFLAGS)
  494. KBUILD_CFLAGS += $(KCFLAGS)
  495. # Use UBOOTINCLUDE when you must reference the include/ directory.
  496. # Needed to be compatible with the O= option
  497. UBOOTINCLUDE := \
  498. -Iinclude \
  499. $(if $(KBUILD_SRC), -I$(srctree)/include) \
  500. -I$(srctree)/arch/$(ARCH)/include \
  501. -include $(srctree)/include/linux/kconfig.h
  502. NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
  503. CHECKFLAGS += $(NOSTDINC_FLAGS)
  504. # FIX ME
  505. cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
  506. $(NOSTDINC_FLAGS)
  507. c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
  508. #########################################################################
  509. # U-Boot objects....order is important (i.e. start must be first)
  510. HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
  511. libs-y += lib/
  512. libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
  513. libs-$(CONFIG_OF_EMBED) += dts/
  514. libs-y += fs/
  515. libs-y += net/
  516. libs-y += disk/
  517. libs-y += drivers/
  518. libs-y += drivers/dma/
  519. libs-y += drivers/gpio/
  520. libs-y += drivers/i2c/
  521. libs-y += drivers/mmc/
  522. libs-y += drivers/mtd/
  523. libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
  524. libs-y += drivers/mtd/onenand/
  525. libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
  526. libs-y += drivers/mtd/spi/
  527. libs-y += drivers/net/
  528. libs-y += drivers/net/phy/
  529. libs-y += drivers/pci/
  530. libs-y += drivers/power/ \
  531. drivers/power/fuel_gauge/ \
  532. drivers/power/mfd/ \
  533. drivers/power/pmic/ \
  534. drivers/power/battery/ \
  535. drivers/power/regulator/
  536. libs-y += drivers/spi/
  537. libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
  538. libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
  539. libs-y += drivers/serial/
  540. libs-y += drivers/usb/dwc3/
  541. libs-y += drivers/usb/emul/
  542. libs-y += drivers/usb/eth/
  543. libs-y += drivers/usb/gadget/
  544. libs-y += drivers/usb/gadget/udc/
  545. libs-y += drivers/usb/host/
  546. libs-y += drivers/usb/musb/
  547. libs-y += drivers/usb/musb-new/
  548. libs-y += drivers/usb/phy/
  549. libs-y += drivers/usb/ulpi/
  550. libs-y += common/
  551. libs-$(CONFIG_API) += api/
  552. libs-$(CONFIG_HAS_POST) += post/
  553. libs-y += test/
  554. libs-y += test/dm/
  555. libs-$(CONFIG_UT_ENV) += test/env/
  556. libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
  557. libs-y := $(sort $(libs-y))
  558. u-boot-dirs := $(patsubst %/,%,$(filter %/, $(libs-y))) tools examples
  559. u-boot-alldirs := $(sort $(u-boot-dirs) $(patsubst %/,%,$(filter %/, $(libs-))))
  560. libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
  561. u-boot-init := $(head-y)
  562. u-boot-main := $(libs-y)
  563. # Add GCC lib
  564. ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
  565. PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
  566. else
  567. PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
  568. endif
  569. PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  570. export PLATFORM_LIBS
  571. export PLATFORM_LIBGCC
  572. # Special flags for CPP when processing the linker script.
  573. # Pass the version down so we can handle backwards compatibility
  574. # on the fly.
  575. LDPPFLAGS += \
  576. -include $(srctree)/include/u-boot/u-boot.lds.h \
  577. -DCPUDIR=$(CPUDIR) \
  578. $(shell $(LD) --version | \
  579. sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
  580. #########################################################################
  581. #########################################################################
  582. ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
  583. BOARD_SIZE_CHECK = \
  584. @actual=`wc -c $@ | awk '{print $$1}'`; \
  585. limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
  586. if test $$actual -gt $$limit; then \
  587. echo "$@ exceeds file size limit:" >&2 ; \
  588. echo " limit: $$limit bytes" >&2 ; \
  589. echo " actual: $$actual bytes" >&2 ; \
  590. echo " excess: $$((actual - limit)) bytes" >&2; \
  591. exit 1; \
  592. fi
  593. else
  594. BOARD_SIZE_CHECK =
  595. endif
  596. # Statically apply RELA-style relocations (currently arm64 only)
  597. ifneq ($(CONFIG_STATIC_RELA),)
  598. # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
  599. DO_STATIC_RELA = \
  600. start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
  601. end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
  602. tools/relocate-rela $(2) $(3) $$start $$end
  603. else
  604. DO_STATIC_RELA =
  605. endif
  606. # Always append ALL so that arch config.mk's can add custom ones
  607. ALL-y += u-boot.srec u-boot.bin System.map u-boot.cfg binary_size_check
  608. ALL-$(CONFIG_ONENAND_U_BOOT) += u-boot-onenand.bin
  609. ifeq ($(CONFIG_SPL_FSL_PBL),y)
  610. ALL-$(CONFIG_RAMBOOT_PBL) += u-boot-with-spl-pbl.bin
  611. else
  612. ifneq ($(CONFIG_SECURE_BOOT), y)
  613. # For Secure Boot The Image needs to be signed and Header must also
  614. # be included. So The image has to be built explicitly
  615. ALL-$(CONFIG_RAMBOOT_PBL) += u-boot.pbl
  616. endif
  617. endif
  618. ALL-$(CONFIG_SPL) += spl/u-boot-spl.bin
  619. ALL-$(CONFIG_SPL_FRAMEWORK) += u-boot.img
  620. ALL-$(CONFIG_TPL) += tpl/u-boot-tpl.bin
  621. ALL-$(CONFIG_OF_SEPARATE) += u-boot.dtb u-boot-dtb.bin
  622. ifeq ($(CONFIG_SPL_FRAMEWORK),y)
  623. ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img
  624. endif
  625. ALL-$(CONFIG_OF_HOSTFILE) += u-boot.dtb
  626. ifneq ($(CONFIG_SPL_TARGET),)
  627. ALL-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%)
  628. endif
  629. ALL-$(CONFIG_REMAKE_ELF) += u-boot.elf
  630. ifneq ($(BUILD_ROM),)
  631. ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom
  632. endif
  633. # enable combined SPL/u-boot/dtb rules for tegra
  634. ifneq ($(CONFIG_TEGRA),)
  635. ifeq ($(CONFIG_SPL),y)
  636. ifeq ($(CONFIG_OF_SEPARATE),y)
  637. ALL-y += u-boot-dtb-tegra.bin
  638. else
  639. ALL-y += u-boot-nodtb-tegra.bin
  640. endif
  641. endif
  642. endif
  643. # Add optional build target if defined in board/cpu/soc headers
  644. ifneq ($(CONFIG_BUILD_TARGET),)
  645. ALL-y += $(CONFIG_BUILD_TARGET:"%"=%)
  646. endif
  647. LDFLAGS_u-boot += $(LDFLAGS_FINAL)
  648. ifneq ($(CONFIG_SYS_TEXT_BASE),)
  649. LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
  650. endif
  651. # Normally we fill empty space with 0xff
  652. quiet_cmd_objcopy = OBJCOPY $@
  653. cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
  654. $(OBJCOPYFLAGS_$(@F)) $< $@
  655. # Provide a version which does not do this, for use by EFI
  656. quiet_cmd_zobjcopy = OBJCOPY $@
  657. cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
  658. quiet_cmd_mkimage = MKIMAGE $@
  659. cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
  660. $(if $(KBUILD_VERBOSE:1=), >/dev/null)
  661. quiet_cmd_cat = CAT $@
  662. cmd_cat = cat $(filter-out $(PHONY), $^) > $@
  663. append = cat $(filter-out $< $(PHONY), $^) >> $@
  664. quiet_cmd_pad_cat = CAT $@
  665. cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
  666. all: $(ALL-y)
  667. ifneq ($(CONFIG_SYS_GENERIC_BOARD),y)
  668. @echo "===================== WARNING ======================"
  669. @echo "Please convert this board to generic board."
  670. @echo "Otherwise it will be removed by the end of 2014."
  671. @echo "See doc/README.generic-board for further information"
  672. @echo "===================================================="
  673. endif
  674. ifeq ($(CONFIG_DM_I2C_COMPAT),y)
  675. @echo "===================== WARNING ======================"
  676. @echo "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
  677. @echo "(possibly in a subsequent patch in your series)"
  678. @echo "before sending patches to the mailing list."
  679. @echo "===================================================="
  680. endif
  681. PHONY += dtbs
  682. dtbs dts/dt.dtb: checkdtc u-boot
  683. $(Q)$(MAKE) $(build)=dts dtbs
  684. u-boot-dtb.bin: u-boot.bin dts/dt.dtb FORCE
  685. $(call if_changed,cat)
  686. %.imx: %.bin
  687. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  688. quiet_cmd_copy = COPY $@
  689. cmd_copy = cp $< $@
  690. u-boot.dtb: dts/dt.dtb
  691. $(call cmd,copy)
  692. OBJCOPYFLAGS_u-boot.hex := -O ihex
  693. OBJCOPYFLAGS_u-boot.srec := -O srec
  694. u-boot.hex u-boot.srec: u-boot FORCE
  695. $(call if_changed,objcopy)
  696. OBJCOPYFLAGS_u-boot.bin := -O binary \
  697. $(if $(CONFIG_X86_RESET_VECTOR),-R .start16 -R .resetvec)
  698. binary_size_check: u-boot.bin FORCE
  699. @file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
  700. map_size=$(shell cat u-boot.map | \
  701. awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
  702. | sed 's/0X//g' \
  703. | bc); \
  704. if [ "" != "$$map_size" ]; then \
  705. if test $$map_size -ne $$file_size; then \
  706. echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
  707. echo " but u-boot.bin shows $$file_size" >&2 ; \
  708. exit 1; \
  709. fi \
  710. fi
  711. u-boot.bin: u-boot FORCE
  712. $(call if_changed,objcopy)
  713. $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
  714. $(BOARD_SIZE_CHECK)
  715. u-boot.ldr: u-boot
  716. $(CREATE_LDR_ENV)
  717. $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS)
  718. $(BOARD_SIZE_CHECK)
  719. OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
  720. OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
  721. u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
  722. $(call if_changed,objcopy)
  723. #
  724. # U-Boot entry point, needed for booting of full-blown U-Boot
  725. # from the SPL U-Boot version.
  726. #
  727. ifndef CONFIG_SYS_UBOOT_START
  728. CONFIG_SYS_UBOOT_START := 0
  729. endif
  730. # Create a file containing the configuration options the image was built with
  731. quiet_cmd_cpp_cfg = CFG $@
  732. cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
  733. -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
  734. MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
  735. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
  736. -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
  737. MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
  738. -T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
  739. MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
  740. -T kwbimage -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
  741. MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
  742. -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
  743. u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
  744. $(call if_changed,mkimage)
  745. u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE
  746. $(call if_changed,mkimage)
  747. MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
  748. u-boot-dtb.img: u-boot-dtb.bin FORCE
  749. $(call if_changed,mkimage)
  750. u-boot.sha1: u-boot.bin
  751. tools/ubsha1 u-boot.bin
  752. u-boot.dis: u-boot
  753. $(OBJDUMP) -d $< > $@
  754. u-boot.cfg: include/config.h
  755. $(call if_changed,cpp_cfg)
  756. ifdef CONFIG_TPL
  757. SPL_PAYLOAD := tpl/u-boot-with-tpl.bin
  758. else
  759. SPL_PAYLOAD := u-boot.bin
  760. endif
  761. OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \
  762. --pad-to=$(CONFIG_SPL_PAD_TO)
  763. u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE
  764. $(call if_changed,pad_cat)
  765. MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE)
  766. lpc32xx-spl.img: spl/u-boot-spl.bin FORCE
  767. $(call if_changed,mkimage)
  768. OBJCOPYFLAGS_lpc32xx-boot-0.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  769. lpc32xx-boot-0.bin: lpc32xx-spl.img
  770. $(call if_changed,objcopy)
  771. OBJCOPYFLAGS_lpc32xx-boot-1.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  772. lpc32xx-boot-1.bin: lpc32xx-spl.img
  773. $(call if_changed,objcopy)
  774. lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img
  775. $(call if_changed,cat)
  776. CLEAN_FILES += lpc32xx-*
  777. OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
  778. --pad-to=$(CONFIG_TPL_PAD_TO)
  779. tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
  780. $(call if_changed,pad_cat)
  781. SPL: spl/u-boot-spl.bin FORCE
  782. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  783. u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE
  784. $(Q)$(MAKE) $(build)=arch/arm/imx-common $@
  785. MKIMAGEFLAGS_u-boot.ubl = -n $(UBL_CONFIG) -T ublimage -e $(CONFIG_SYS_TEXT_BASE)
  786. u-boot.ubl: u-boot-with-spl.bin FORCE
  787. $(call if_changed,mkimage)
  788. MKIMAGEFLAGS_u-boot-spl.ais = -s -n $(if $(CONFIG_AIS_CONFIG_FILE), \
  789. $(srctree)/$(CONFIG_AIS_CONFIG_FILE:"%"=%),"/dev/null") \
  790. -T aisimage -e $(CONFIG_SPL_TEXT_BASE)
  791. spl/u-boot-spl.ais: spl/u-boot-spl.bin FORCE
  792. $(call if_changed,mkimage)
  793. OBJCOPYFLAGS_u-boot.ais = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  794. u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE
  795. $(call if_changed,pad_cat)
  796. u-boot-signed.sb: u-boot.bin spl/u-boot-spl.bin
  797. $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot-signed.sb
  798. u-boot.sb: u-boot.bin spl/u-boot-spl.bin
  799. $(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb
  800. # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
  801. # Both images are created using mkimage (crc etc), so that the ROM
  802. # bootloader can check its integrity. Padding needs to be done to the
  803. # SPL image (with mkimage header) and not the binary. Otherwise the resulting image
  804. # which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
  805. # The resulting image containing both U-Boot images is called u-boot.spr
  806. MKIMAGEFLAGS_u-boot-spl.img = -A $(ARCH) -T firmware -C none \
  807. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER
  808. spl/u-boot-spl.img: spl/u-boot-spl.bin FORCE
  809. $(call if_changed,mkimage)
  810. OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  811. --gap-fill=0xff
  812. u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
  813. $(call if_changed,pad_cat)
  814. MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \
  815. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL
  816. spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE
  817. $(call if_changed,mkimage)
  818. OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  819. --gap-fill=0
  820. u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE
  821. $(call if_changed,pad_cat)
  822. MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \
  823. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot
  824. u-boot-nand.gph: u-boot.bin FORCE
  825. $(call if_changed,mkimage)
  826. @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@
  827. # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including
  828. # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in
  829. # the middle.
  830. ifneq ($(CONFIG_X86_RESET_VECTOR),)
  831. rom: u-boot.rom FORCE
  832. IFDTOOL=$(objtree)/tools/ifdtool
  833. IFDTOOL_FLAGS = -f 0:$(objtree)/u-boot.dtb
  834. IFDTOOL_FLAGS += -m 0x$(shell $(NM) u-boot |grep _dt_ucode_base_size |cut -d' ' -f1)
  835. IFDTOOL_FLAGS += -U $(CONFIG_SYS_TEXT_BASE):$(objtree)/u-boot.bin
  836. IFDTOOL_FLAGS += -w $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin
  837. ifneq ($(CONFIG_HAVE_INTEL_ME),)
  838. IFDTOOL_ME_FLAGS = -D $(srctree)/board/$(BOARDDIR)/descriptor.bin
  839. IFDTOOL_ME_FLAGS += -i ME:$(srctree)/board/$(BOARDDIR)/me.bin
  840. endif
  841. ifneq ($(CONFIG_HAVE_MRC),)
  842. IFDTOOL_FLAGS += -w $(CONFIG_X86_MRC_ADDR):$(srctree)/board/$(BOARDDIR)/mrc.bin
  843. endif
  844. ifneq ($(CONFIG_HAVE_FSP),)
  845. IFDTOOL_FLAGS += -w $(CONFIG_FSP_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_FSP_FILE)
  846. endif
  847. ifneq ($(CONFIG_HAVE_CMC),)
  848. IFDTOOL_FLAGS += -w $(CONFIG_CMC_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_CMC_FILE)
  849. endif
  850. ifneq ($(CONFIG_HAVE_VGA_BIOS),)
  851. IFDTOOL_FLAGS += -w $(CONFIG_VGA_BIOS_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_VGA_BIOS_FILE)
  852. endif
  853. quiet_cmd_ifdtool = IFDTOOL $@
  854. cmd_ifdtool = $(IFDTOOL) -c -r $(CONFIG_ROM_SIZE) u-boot.tmp;
  855. ifneq ($(CONFIG_HAVE_INTEL_ME),)
  856. cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_ME_FLAGS) u-boot.tmp;
  857. endif
  858. cmd_ifdtool += $(IFDTOOL) $(IFDTOOL_FLAGS) u-boot.tmp;
  859. cmd_ifdtool += mv u-boot.tmp $@
  860. u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin
  861. $(call if_changed,ifdtool)
  862. OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
  863. u-boot-x86-16bit.bin: u-boot FORCE
  864. $(call if_changed,objcopy)
  865. endif
  866. ifneq ($(CONFIG_SUNXI),)
  867. OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
  868. --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
  869. u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \
  870. u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE
  871. $(call if_changed,pad_cat)
  872. endif
  873. ifneq ($(CONFIG_TEGRA),)
  874. OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE)
  875. u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
  876. $(call if_changed,pad_cat)
  877. ifeq ($(CONFIG_OF_SEPARATE),y)
  878. u-boot-dtb-tegra.bin: u-boot-nodtb-tegra.bin dts/dt.dtb FORCE
  879. $(call if_changed,cat)
  880. endif
  881. endif
  882. u-boot-img.bin: spl/u-boot-spl.bin u-boot.img FORCE
  883. $(call if_changed,cat)
  884. #Add a target to create boot binary having SPL binary in PBI format
  885. #concatenated with u-boot binary. It is need by PowerPC SoC having
  886. #internal SRAM <= 512KB.
  887. MKIMAGEFLAGS_u-boot-spl.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
  888. -R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage \
  889. -A $(ARCH) -a $(CONFIG_SPL_TEXT_BASE)
  890. spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE
  891. $(call if_changed,mkimage)
  892. ifeq ($(ARCH),arm)
  893. UBOOT_BINLOAD := u-boot.img
  894. else
  895. UBOOT_BINLOAD := u-boot.bin
  896. endif
  897. OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
  898. --gap-fill=0xff
  899. u-boot-with-spl-pbl.bin: spl/u-boot-spl.pbl $(UBOOT_BINLOAD) FORCE
  900. $(call if_changed,pad_cat)
  901. # PPC4xx needs the SPL at the end of the image, since the reset vector
  902. # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
  903. # and need to introduce a new build target with the full blown U-Boot
  904. # at the start padded up to the start of the SPL image. And then concat
  905. # the SPL image to the end.
  906. OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \
  907. --pad-to=$(CONFIG_UBOOT_PAD_TO) --gap-fill=0xff
  908. u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE
  909. $(call if_changed,pad_cat)
  910. # Create a new ELF from a raw binary file. This is useful for arm64
  911. # where static relocation needs to be performed on the raw binary,
  912. # but certain simulators only accept an ELF file (but don't do the
  913. # relocation).
  914. # FIXME refactor dts/Makefile to share target/arch detection
  915. u-boot.elf: u-boot.bin
  916. @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
  917. $< u-boot-elf.o
  918. @$(LD) u-boot-elf.o -o $@ \
  919. --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
  920. -Ttext=$(CONFIG_SYS_TEXT_BASE)
  921. # Rule to link u-boot
  922. # May be overridden by arch/$(ARCH)/config.mk
  923. quiet_cmd_u-boot__ ?= LD $@
  924. cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \
  925. -T u-boot.lds $(u-boot-init) \
  926. --start-group $(u-boot-main) --end-group \
  927. $(PLATFORM_LIBS) -Map u-boot.map
  928. quiet_cmd_smap = GEN common/system_map.o
  929. cmd_smap = \
  930. smap=`$(call SYSTEM_MAP,u-boot) | \
  931. awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
  932. $(CC) $(c_flags) -DSYSTEM_MAP="\"$${smap}\"" \
  933. -c $(srctree)/common/system_map.c -o common/system_map.o
  934. u-boot: $(u-boot-init) $(u-boot-main) u-boot.lds
  935. $(call if_changed,u-boot__)
  936. ifeq ($(CONFIG_KALLSYMS),y)
  937. $(call cmd,smap)
  938. $(call cmd,u-boot__) common/system_map.o
  939. endif
  940. # The actual objects are generated when descending,
  941. # make sure no implicit rule kicks in
  942. $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ;
  943. # Handle descending into subdirectories listed in $(vmlinux-dirs)
  944. # Preset locale variables to speed up the build process. Limit locale
  945. # tweaks to this spot to avoid wrong language settings when running
  946. # make menuconfig etc.
  947. # Error messages still appears in the original language
  948. PHONY += $(u-boot-dirs)
  949. $(u-boot-dirs): prepare scripts
  950. $(Q)$(MAKE) $(build)=$@
  951. tools: prepare
  952. # The "tools" are needed early
  953. $(filter-out tools, $(u-boot-dirs)): tools
  954. # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
  955. # is "yes"), so compile examples after U-Boot is compiled.
  956. examples: $(filter-out examples, $(u-boot-dirs))
  957. define filechk_uboot.release
  958. echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
  959. endef
  960. # Store (new) UBOOTRELEASE string in include/config/uboot.release
  961. include/config/uboot.release: include/config/auto.conf FORCE
  962. $(call filechk,uboot.release)
  963. # Things we need to do before we recursively start building the kernel
  964. # or the modules are listed in "prepare".
  965. # A multi level approach is used. prepareN is processed before prepareN-1.
  966. # archprepare is used in arch Makefiles and when processed asm symlink,
  967. # version.h and scripts_basic is processed / created.
  968. # Listed in dependency order
  969. PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
  970. # prepare3 is used to check if we are building in a separate output directory,
  971. # and if so do:
  972. # 1) Check that make has not been executed in the kernel src $(srctree)
  973. prepare3: include/config/uboot.release
  974. ifneq ($(KBUILD_SRC),)
  975. @$(kecho) ' Using $(srctree) as source for U-Boot'
  976. $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
  977. echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \
  978. echo >&2 " in the '$(srctree)' directory.";\
  979. /bin/false; \
  980. fi;
  981. endif
  982. # prepare2 creates a makefile if using a separate output directory
  983. prepare2: prepare3 outputmakefile
  984. prepare1: prepare2 $(version_h) $(timestamp_h) \
  985. include/config/auto.conf
  986. ifeq ($(CONFIG_HAVE_GENERIC_BOARD),)
  987. ifeq ($(CONFIG_SYS_GENERIC_BOARD),y)
  988. @echo >&2 " Your architecture does not support generic board."
  989. @echo >&2 " Please undefine CONFIG_SYS_GENERIC_BOARD in your board config file."
  990. @/bin/false
  991. endif
  992. endif
  993. ifeq ($(wildcard $(LDSCRIPT)),)
  994. @echo >&2 " Could not find linker script."
  995. @/bin/false
  996. endif
  997. archprepare: prepare1 scripts_basic
  998. prepare0: archprepare FORCE
  999. $(Q)$(MAKE) $(build)=.
  1000. # All the preparing..
  1001. prepare: prepare0
  1002. # Generate some files
  1003. # ---------------------------------------------------------------------------
  1004. define filechk_version.h
  1005. (echo \#define PLAIN_VERSION \"$(UBOOTRELEASE)\"; \
  1006. echo \#define U_BOOT_VERSION \"U-Boot \" PLAIN_VERSION; \
  1007. echo \#define CC_VERSION_STRING \"$$($(CC) --version | head -n 1)\"; \
  1008. echo \#define LD_VERSION_STRING \"$$($(LD) --version | head -n 1)\"; )
  1009. endef
  1010. define filechk_timestamp.h
  1011. (SOURCE_DATE="$${SOURCE_DATE_EPOCH:+@$$SOURCE_DATE_EPOCH}"; \
  1012. LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_DATE "%b %d %C%y"'; \
  1013. LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_TIME "%T"'; \
  1014. LC_ALL=C date -u -d "$${SOURCE_DATE:-now}" +'#define U_BOOT_TZ "%z"' )
  1015. endef
  1016. $(version_h): include/config/uboot.release FORCE
  1017. $(call filechk,version.h)
  1018. $(timestamp_h): $(srctree)/Makefile FORCE
  1019. $(call filechk,timestamp.h)
  1020. # ---------------------------------------------------------------------------
  1021. quiet_cmd_cpp_lds = LDS $@
  1022. cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
  1023. -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
  1024. u-boot.lds: $(LDSCRIPT) prepare FORCE
  1025. $(call if_changed_dep,cpp_lds)
  1026. spl/u-boot-spl.bin: spl/u-boot-spl
  1027. @:
  1028. spl/u-boot-spl: tools prepare $(if $(CONFIG_OF_SEPARATE),dts/dt.dtb)
  1029. $(Q)$(MAKE) obj=spl -f $(srctree)/scripts/Makefile.spl all
  1030. spl/sunxi-spl.bin: spl/u-boot-spl
  1031. @:
  1032. tpl/u-boot-tpl.bin: tools prepare
  1033. $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
  1034. TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include)
  1035. FIND := find
  1036. FINDFLAGS := -L
  1037. tags ctags:
  1038. ctags -w -o ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  1039. -name '*.[chS]' -print`
  1040. ln -s ctags tags
  1041. etags:
  1042. etags -a -o etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  1043. -name '*.[chS]' -print`
  1044. cscope:
  1045. $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  1046. cscope.files
  1047. cscope -b -q -k
  1048. SYSTEM_MAP = \
  1049. $(NM) $1 | \
  1050. grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
  1051. LC_ALL=C sort
  1052. System.map: u-boot
  1053. @$(call SYSTEM_MAP,$<) > $@
  1054. checkdtc:
  1055. @if test $(call dtc-version) -lt 0104; then \
  1056. echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
  1057. false; \
  1058. fi
  1059. #########################################################################
  1060. # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
  1061. # R_AARCH64_RELATIVE (64-bit).
  1062. checkarmreloc: u-boot
  1063. @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
  1064. grep R_A | sort -u`"; \
  1065. if test "$$RELOC" != "R_ARM_RELATIVE" -a \
  1066. "$$RELOC" != "R_AARCH64_RELATIVE"; then \
  1067. echo "$< contains unexpected relocations: $$RELOC"; \
  1068. false; \
  1069. fi
  1070. env: scripts_basic
  1071. $(Q)$(MAKE) $(build)=tools/$@
  1072. tools-only: scripts_basic $(version_h) $(timestamp_h)
  1073. $(Q)$(MAKE) $(build)=tools
  1074. tools-all: export HOST_TOOLS_ALL=y
  1075. tools-all: env tools ;
  1076. cross_tools: export CROSS_BUILD_TOOLS=y
  1077. cross_tools: tools ;
  1078. .PHONY : CHANGELOG
  1079. CHANGELOG:
  1080. git log --no-merges U-Boot-1_1_5.. | \
  1081. unexpand -a | sed -e 's/\s\s*$$//' > $@
  1082. include/license.h: tools/bin2header COPYING
  1083. cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
  1084. #########################################################################
  1085. ###
  1086. # Cleaning is done on three levels.
  1087. # make clean Delete most generated files
  1088. # Leave enough to build external modules
  1089. # make mrproper Delete the current configuration, and all generated files
  1090. # make distclean Remove editor backup files, patch leftover files and the like
  1091. # Directories & files removed with 'make clean'
  1092. CLEAN_DIRS += $(MODVERDIR) \
  1093. $(foreach d, spl tpl, $(patsubst %,$d/%, \
  1094. $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
  1095. CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
  1096. boot* u-boot* MLO* SPL System.map
  1097. # Directories & files removed with 'make mrproper'
  1098. MRPROPER_DIRS += include/config include/generated spl tpl \
  1099. .tmp_objdiff
  1100. MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \
  1101. ctags etags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
  1102. # clean - Delete most, but leave enough to build external modules
  1103. #
  1104. clean: rm-dirs := $(CLEAN_DIRS)
  1105. clean: rm-files := $(CLEAN_FILES)
  1106. clean-dirs := $(foreach f,$(u-boot-alldirs),$(if $(wildcard $(srctree)/$f/Makefile),$f))
  1107. clean-dirs := $(addprefix _clean_, $(clean-dirs) doc/DocBook)
  1108. PHONY += $(clean-dirs) clean archclean
  1109. $(clean-dirs):
  1110. $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
  1111. # TODO: Do not use *.cfgtmp
  1112. clean: $(clean-dirs)
  1113. $(call cmd,rmdirs)
  1114. $(call cmd,rmfiles)
  1115. @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
  1116. \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
  1117. -o -name '*.ko.*' -o -name '*.su' -o -name '*.cfgtmp' \
  1118. -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
  1119. -o -name '*.symtypes' -o -name 'modules.order' \
  1120. -o -name modules.builtin -o -name '.tmp_*.o.*' \
  1121. -o -name '*.gcno' \) -type f -print | xargs rm -f
  1122. # mrproper - Delete all generated files, including .config
  1123. #
  1124. mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
  1125. mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
  1126. mrproper-dirs := $(addprefix _mrproper_,scripts)
  1127. PHONY += $(mrproper-dirs) mrproper archmrproper
  1128. $(mrproper-dirs):
  1129. $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
  1130. mrproper: clean $(mrproper-dirs)
  1131. $(call cmd,rmdirs)
  1132. $(call cmd,rmfiles)
  1133. @rm -f arch/*/include/asm/arch
  1134. # distclean
  1135. #
  1136. PHONY += distclean
  1137. distclean: mrproper
  1138. @find $(srctree) $(RCS_FIND_IGNORE) \
  1139. \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
  1140. -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
  1141. -o -name '.*.rej' -o -name '*%' -o -name 'core' \
  1142. -o -name '*.pyc' \) \
  1143. -type f -print | xargs rm -f
  1144. @rm -f boards.cfg
  1145. backup:
  1146. F=`basename $(srctree)` ; cd .. ; \
  1147. gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
  1148. help:
  1149. @echo 'Cleaning targets:'
  1150. @echo ' clean - Remove most generated files but keep the config'
  1151. @echo ' mrproper - Remove all generated files + config + various backup files'
  1152. @echo ' distclean - mrproper + remove editor backup and patch files'
  1153. @echo ''
  1154. @echo 'Configuration targets:'
  1155. @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile help
  1156. @echo ''
  1157. @echo 'Other generic targets:'
  1158. @echo ' all - Build all necessary images depending on configuration'
  1159. @echo '* u-boot - Build the bare u-boot'
  1160. @echo ' dir/ - Build all files in dir and below'
  1161. @echo ' dir/file.[oisS] - Build specified target only'
  1162. @echo ' dir/file.lst - Build specified mixed source/assembly target only'
  1163. @echo ' (requires a recent binutils and recent build (System.map))'
  1164. @echo ' tags/ctags - Generate ctags file for editors'
  1165. @echo ' etags - Generate etags file for editors'
  1166. @echo ' cscope - Generate cscope index'
  1167. @echo ' ubootrelease - Output the release version string (use with make -s)'
  1168. @echo ' ubootversion - Output the version stored in Makefile (use with make -s)'
  1169. @echo ''
  1170. @echo 'Static analysers'
  1171. @echo ' checkstack - Generate a list of stack hogs'
  1172. @echo ''
  1173. @echo 'Documentation targets:'
  1174. @$(MAKE) -f $(srctree)/doc/DocBook/Makefile dochelp
  1175. @echo ''
  1176. @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
  1177. @echo ' make V=2 [targets] 2 => give reason for rebuild of target'
  1178. @echo ' make O=dir [targets] Locate all output files in "dir", including .config'
  1179. @echo ' make C=1 [targets] Check all c source with $$CHECK (sparse by default)'
  1180. @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
  1181. @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
  1182. @echo ' make W=n [targets] Enable extra gcc checks, n=1,2,3 where'
  1183. @echo ' 1: warnings which may be relevant and do not occur too often'
  1184. @echo ' 2: warnings which occur quite often but may still be relevant'
  1185. @echo ' 3: more obscure warnings, can most likely be ignored'
  1186. @echo ' Multiple levels can be combined with W=12 or W=123'
  1187. @echo ''
  1188. @echo 'Execute "make" or "make all" to build all targets marked with [*] '
  1189. @echo 'For further info see the ./README file'
  1190. # Documentation targets
  1191. # ---------------------------------------------------------------------------
  1192. %docs: scripts_basic FORCE
  1193. $(Q)$(MAKE) $(build)=scripts build_docproc
  1194. $(Q)$(MAKE) $(build)=doc/DocBook $@
  1195. # Dummies...
  1196. PHONY += prepare scripts
  1197. prepare: ;
  1198. scripts: ;
  1199. endif #ifeq ($(config-targets),1)
  1200. endif #ifeq ($(mixed-targets),1)
  1201. PHONY += checkstack ubootrelease ubootversion
  1202. checkstack:
  1203. $(OBJDUMP) -d u-boot $$(find . -name u-boot-spl) | \
  1204. $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
  1205. ubootrelease:
  1206. @echo "$(UBOOTVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
  1207. ubootversion:
  1208. @echo $(UBOOTVERSION)
  1209. # Single targets
  1210. # ---------------------------------------------------------------------------
  1211. # Single targets are compatible with:
  1212. # - build with mixed source and output
  1213. # - build with separate output dir 'make O=...'
  1214. # - external modules
  1215. #
  1216. # target-dir => where to store outputfile
  1217. # build-dir => directory in kernel source tree to use
  1218. ifeq ($(KBUILD_EXTMOD),)
  1219. build-dir = $(patsubst %/,%,$(dir $@))
  1220. target-dir = $(dir $@)
  1221. else
  1222. zap-slash=$(filter-out .,$(patsubst %/,%,$(dir $@)))
  1223. build-dir = $(KBUILD_EXTMOD)$(if $(zap-slash),/$(zap-slash))
  1224. target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
  1225. endif
  1226. %.s: %.c prepare scripts FORCE
  1227. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1228. %.i: %.c prepare scripts FORCE
  1229. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1230. %.o: %.c prepare scripts FORCE
  1231. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1232. %.lst: %.c prepare scripts FORCE
  1233. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1234. %.s: %.S prepare scripts FORCE
  1235. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1236. %.o: %.S prepare scripts FORCE
  1237. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1238. %.symtypes: %.c prepare scripts FORCE
  1239. $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  1240. # Modules
  1241. /: prepare scripts FORCE
  1242. $(cmd_crmodverdir)
  1243. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1244. $(build)=$(build-dir)
  1245. %/: prepare scripts FORCE
  1246. $(cmd_crmodverdir)
  1247. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1248. $(build)=$(build-dir)
  1249. %.ko: prepare scripts FORCE
  1250. $(cmd_crmodverdir)
  1251. $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
  1252. $(build)=$(build-dir) $(@:.ko=.o)
  1253. $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
  1254. # FIXME Should go into a make.lib or something
  1255. # ===========================================================================
  1256. quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
  1257. cmd_rmdirs = rm -rf $(rm-dirs)
  1258. quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
  1259. cmd_rmfiles = rm -f $(rm-files)
  1260. # read all saved command lines
  1261. targets := $(wildcard $(sort $(targets)))
  1262. cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
  1263. ifneq ($(cmd_files),)
  1264. $(cmd_files): ; # Do not try to update included dependency files
  1265. include $(cmd_files)
  1266. endif
  1267. endif # skip-makefile
  1268. PHONY += FORCE
  1269. FORCE:
  1270. # Declare the contents of the .PHONY variable as phony. We keep that
  1271. # information in a variable so we can use it in if_changed and friends.
  1272. .PHONY: $(PHONY)