Makefile 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. #
  2. # (C) Copyright 2000-2013
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. VERSION = 2014
  8. PATCHLEVEL = 01
  9. SUBLEVEL =
  10. EXTRAVERSION =
  11. ifneq "$(SUBLEVEL)" ""
  12. U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  13. else
  14. U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION)
  15. endif
  16. TIMESTAMP_FILE = $(obj)include/generated/timestamp_autogenerated.h
  17. VERSION_FILE = $(obj)include/generated/version_autogenerated.h
  18. HOSTARCH := $(shell uname -m | \
  19. sed -e s/i.86/x86/ \
  20. -e s/sun4u/sparc64/ \
  21. -e s/arm.*/arm/ \
  22. -e s/sa110/arm/ \
  23. -e s/ppc64/powerpc/ \
  24. -e s/ppc/powerpc/ \
  25. -e s/macppc/powerpc/\
  26. -e s/sh.*/sh/)
  27. HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
  28. sed -e 's/\(cygwin\).*/cygwin/')
  29. export HOSTARCH HOSTOS
  30. # Deal with colliding definitions from tcsh etc.
  31. VENDOR=
  32. #########################################################################
  33. # Allow for silent builds
  34. ifeq (,$(findstring s,$(MAKEFLAGS)))
  35. XECHO = echo
  36. else
  37. XECHO = :
  38. endif
  39. #########################################################################
  40. #
  41. # U-boot build supports generating object files in a separate external
  42. # directory. Two use cases are supported:
  43. #
  44. # 1) Add O= to the make command line
  45. # 'make O=/tmp/build all'
  46. #
  47. # 2) Set environment variable BUILD_DIR to point to the desired location
  48. # 'export BUILD_DIR=/tmp/build'
  49. # 'make'
  50. #
  51. # The second approach can also be used with a MAKEALL script
  52. # 'export BUILD_DIR=/tmp/build'
  53. # './MAKEALL'
  54. #
  55. # Command line 'O=' setting overrides BUILD_DIR environment variable.
  56. #
  57. # When none of the above methods is used the local build is performed and
  58. # the object files are placed in the source directory.
  59. #
  60. ifeq ("$(origin O)", "command line")
  61. BUILD_DIR := $(O)
  62. endif
  63. # Call a source code checker (by default, "sparse") as part of the
  64. # C compilation.
  65. #
  66. # Use 'make C=1' to enable checking of re-compiled files.
  67. #
  68. # See the linux kernel file "Documentation/sparse.txt" for more details,
  69. # including where to get the "sparse" utility.
  70. ifdef C
  71. ifeq ("$(origin C)", "command line")
  72. CHECKSRC := $(C)
  73. endif
  74. endif
  75. ifndef CHECKSRC
  76. CHECKSRC = 0
  77. endif
  78. export CHECKSRC
  79. ifneq ($(BUILD_DIR),)
  80. saved-output := $(BUILD_DIR)
  81. # Attempt to create a output directory.
  82. $(shell [ -d ${BUILD_DIR} ] || mkdir -p ${BUILD_DIR})
  83. # Verify if it was successful.
  84. BUILD_DIR := $(shell cd $(BUILD_DIR) && /bin/pwd)
  85. $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist))
  86. endif # ifneq ($(BUILD_DIR),)
  87. OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
  88. SPLTREE := $(OBJTREE)/spl
  89. TPLTREE := $(OBJTREE)/tpl
  90. SRCTREE := $(CURDIR)
  91. srctree := $(SRCTREE)
  92. TOPDIR := $(SRCTREE)
  93. LNDIR := $(OBJTREE)
  94. export TOPDIR SRCTREE srctree OBJTREE SPLTREE TPLTREE
  95. MKCONFIG := $(SRCTREE)/mkconfig
  96. export MKCONFIG
  97. # $(obj) and (src) are defined in config.mk but here in main Makefile
  98. # we also need them before config.mk is included which is the case for
  99. # some targets like unconfig, clean, clobber, distclean, etc.
  100. ifneq ($(OBJTREE),$(SRCTREE))
  101. obj := $(OBJTREE)/
  102. src := $(SRCTREE)/
  103. else
  104. obj :=
  105. src :=
  106. endif
  107. export obj src
  108. # Make sure CDPATH settings don't interfere
  109. unexport CDPATH
  110. #########################################################################
  111. # The "tools" are needed early, so put this first
  112. # Don't include stuff already done in $(LIBS)
  113. # The "examples" conditionally depend on U-Boot (say, when USE_PRIVATE_LIBGCC
  114. # is "yes"), so compile examples after U-Boot is compiled.
  115. SUBDIR_TOOLS = tools
  116. SUBDIRS = $(SUBDIR_TOOLS)
  117. .PHONY : $(SUBDIRS) $(VERSION_FILE) $(TIMESTAMP_FILE)
  118. ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
  119. # Include autoconf.mk before config.mk so that the config options are available
  120. # to all top level build files. We need the dummy all: target to prevent the
  121. # dependency target in autoconf.mk.dep from being the default.
  122. all:
  123. sinclude $(obj)include/autoconf.mk.dep
  124. sinclude $(obj)include/autoconf.mk
  125. SUBDIR_EXAMPLES-y := examples/standalone
  126. SUBDIR_EXAMPLES-$(CONFIG_API) += examples/api
  127. ifndef CONFIG_SANDBOX
  128. SUBDIRS += $(SUBDIR_EXAMPLES-y)
  129. endif
  130. # load ARCH, BOARD, and CPU configuration
  131. include $(obj)include/config.mk
  132. export ARCH CPU BOARD VENDOR SOC
  133. # set default to nothing for native builds
  134. ifeq ($(HOSTARCH),$(ARCH))
  135. CROSS_COMPILE ?=
  136. endif
  137. # SHELL used by kbuild
  138. CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  139. else if [ -x /bin/bash ]; then echo /bin/bash; \
  140. else echo sh; fi ; fi)
  141. HOSTCC = gcc
  142. HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
  143. ifeq ($(HOSTOS),cygwin)
  144. HOSTCFLAGS += -ansi
  145. endif
  146. # Mac OS X / Darwin's C preprocessor is Apple specific. It
  147. # generates numerous errors and warnings. We want to bypass it
  148. # and use GNU C's cpp. To do this we pass the -traditional-cpp
  149. # option to the compiler. Note that the -traditional-cpp flag
  150. # DOES NOT have the same semantics as GNU C's flag, all it does
  151. # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
  152. #
  153. # Apple's linker is similar, thanks to the new 2 stage linking
  154. # multiple symbol definitions are treated as errors, hence the
  155. # -multiply_defined suppress option to turn off this error.
  156. #
  157. ifeq ($(HOSTOS),darwin)
  158. # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
  159. DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.')
  160. DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.')
  161. os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
  162. $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)
  163. # Snow Leopards build environment has no longer restrictions as described above
  164. HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc")
  165. HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp")
  166. HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress")
  167. endif
  168. # We need some generic definitions (do not try to remake the file).
  169. $(srctree)/scripts/Kbuild.include: ;
  170. include $(srctree)/scripts/Kbuild.include
  171. # Make variables (CC, etc...)
  172. AS = $(CROSS_COMPILE)as
  173. # Always use GNU ld
  174. ifneq ($(shell $(CROSS_COMPILE)ld.bfd -v 2> /dev/null),)
  175. LD = $(CROSS_COMPILE)ld.bfd
  176. else
  177. LD = $(CROSS_COMPILE)ld
  178. endif
  179. CC = $(CROSS_COMPILE)gcc
  180. CPP = $(CC) -E
  181. AR = $(CROSS_COMPILE)ar
  182. NM = $(CROSS_COMPILE)nm
  183. LDR = $(CROSS_COMPILE)ldr
  184. STRIP = $(CROSS_COMPILE)strip
  185. OBJCOPY = $(CROSS_COMPILE)objcopy
  186. OBJDUMP = $(CROSS_COMPILE)objdump
  187. AWK = awk
  188. RANLIB = $(CROSS_COMPILE)RANLIB
  189. DTC = dtc
  190. CHECK = sparse
  191. CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
  192. -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
  193. # Use UBOOTINCLUDE when you must reference the include/ directory.
  194. # Needed to be compatible with the O= option
  195. UBOOTINCLUDE :=
  196. ifneq ($(OBJTREE),$(SRCTREE))
  197. UBOOTINCLUDE += -I$(OBJTREE)/include
  198. endif
  199. UBOOTINCLUDE += -I$(srctree)/include \
  200. -I$(srctree)/arch/$(ARCH)/include
  201. KBUILD_CPPFLAGS := -D__KERNEL__
  202. KBUILD_CFLAGS := -Wall -Wstrict-prototypes \
  203. -Wno-format-security \
  204. -fno-builtin -ffreestanding
  205. KBUILD_AFLAGS := -D__ASSEMBLY__
  206. export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
  207. export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
  208. export MAKE AWK
  209. export DTC CHECK CHECKFLAGS
  210. export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
  211. export KBUILD_CFLAGS KBUILD_AFLAGS
  212. KBUILD_CFLAGS += -Os #-fomit-frame-pointer
  213. ifdef BUILD_TAG
  214. KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
  215. endif
  216. KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
  217. KBUILD_CFLAGS += -g
  218. # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g<format>
  219. # option to the assembler.
  220. KBUILD_AFLAGS += -g
  221. NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
  222. CHECKFLAGS += $(NOSTDINC_FLAGS)
  223. # Report stack usage if supported
  224. KBUILD_CFLAGS += $(call cc-option,-fstack-usage)
  225. KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral)
  226. # turn jbsr into jsr for m68k
  227. ifeq ($(ARCH),m68k)
  228. ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4)
  229. KBUILD_AFLAGS += -Wa,-gstabs,-S
  230. endif
  231. endif
  232. # load other configuration
  233. include $(TOPDIR)/config.mk
  234. # Targets which don't build the source code
  235. NON_BUILD_TARGETS = backup clean clobber distclean mrproper tidy unconfig
  236. # Only do the generic board check when actually building, not configuring
  237. ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
  238. ifeq ($(findstring _config,$(MAKECMDGOALS)),)
  239. $(CHECK_GENERIC_BOARD)
  240. endif
  241. endif
  242. # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
  243. # that (or fail if absent). Otherwise, search for a linker script in a
  244. # standard location.
  245. LDSCRIPT_MAKEFILE_DIR = $(dir $(LDSCRIPT))
  246. ifndef LDSCRIPT
  247. #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
  248. ifdef CONFIG_SYS_LDSCRIPT
  249. # need to strip off double quotes
  250. LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
  251. endif
  252. endif
  253. # If there is no specified link script, we look in a number of places for it
  254. ifndef LDSCRIPT
  255. ifeq ($(CONFIG_NAND_U_BOOT),y)
  256. LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
  257. ifeq ($(wildcard $(LDSCRIPT)),)
  258. LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
  259. endif
  260. endif
  261. ifeq ($(wildcard $(LDSCRIPT)),)
  262. LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
  263. endif
  264. ifeq ($(wildcard $(LDSCRIPT)),)
  265. LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
  266. endif
  267. ifeq ($(wildcard $(LDSCRIPT)),)
  268. LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
  269. # We don't expect a Makefile here
  270. LDSCRIPT_MAKEFILE_DIR =
  271. endif
  272. ifeq ($(wildcard $(LDSCRIPT)),)
  273. $(error could not find linker script)
  274. endif
  275. endif
  276. #########################################################################
  277. # U-Boot objects....order is important (i.e. start must be first)
  278. head-y := $(CPUDIR)/start.o
  279. head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
  280. head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
  281. OBJS := $(addprefix $(obj),$(head-y))
  282. HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
  283. LIBS-y += lib/
  284. LIBS-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
  285. LIBS-y += $(CPUDIR)/
  286. ifdef SOC
  287. LIBS-y += $(CPUDIR)/$(SOC)/
  288. endif
  289. LIBS-$(CONFIG_IXP4XX_NPE) += drivers/net/npe/
  290. LIBS-$(CONFIG_OF_EMBED) += dts/
  291. LIBS-y += arch/$(ARCH)/lib/
  292. LIBS-y += fs/
  293. LIBS-y += net/
  294. LIBS-y += disk/
  295. LIBS-y += drivers/
  296. LIBS-y += drivers/dma/
  297. LIBS-y += drivers/gpio/
  298. LIBS-y += drivers/i2c/
  299. LIBS-y += drivers/input/
  300. LIBS-y += drivers/mmc/
  301. LIBS-y += drivers/mtd/
  302. LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
  303. LIBS-y += drivers/mtd/onenand/
  304. LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
  305. LIBS-y += drivers/mtd/spi/
  306. LIBS-y += drivers/net/
  307. LIBS-y += drivers/net/phy/
  308. LIBS-y += drivers/pci/
  309. LIBS-y += drivers/power/ \
  310. drivers/power/fuel_gauge/ \
  311. drivers/power/mfd/ \
  312. drivers/power/pmic/ \
  313. drivers/power/battery/
  314. LIBS-y += drivers/spi/
  315. LIBS-$(CONFIG_FMAN_ENET) += drivers/net/fm/
  316. LIBS-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
  317. LIBS-y += drivers/serial/
  318. LIBS-y += drivers/usb/eth/
  319. LIBS-y += drivers/usb/gadget/
  320. LIBS-y += drivers/usb/host/
  321. LIBS-y += drivers/usb/musb/
  322. LIBS-y += drivers/usb/musb-new/
  323. LIBS-y += drivers/usb/phy/
  324. LIBS-y += drivers/usb/ulpi/
  325. LIBS-y += common/
  326. LIBS-y += lib/libfdt/
  327. LIBS-$(CONFIG_API) += api/
  328. LIBS-$(CONFIG_HAS_POST) += post/
  329. LIBS-y += test/
  330. ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
  331. LIBS-y += arch/$(ARCH)/imx-common/
  332. endif
  333. LIBS-$(CONFIG_ARM) += arch/arm/cpu/
  334. LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
  335. LIBS-y += board/$(BOARDDIR)/
  336. LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
  337. LIBS := $(addprefix $(obj),$(sort $(LIBS-y)))
  338. .PHONY : $(LIBS)
  339. # Add GCC lib
  340. ifdef USE_PRIVATE_LIBGCC
  341. ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
  342. PLATFORM_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/libgcc.o
  343. else
  344. PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
  345. endif
  346. else
  347. PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
  348. endif
  349. PLATFORM_LIBS += $(PLATFORM_LIBGCC)
  350. export PLATFORM_LIBS
  351. # Special flags for CPP when processing the linker script.
  352. # Pass the version down so we can handle backwards compatibility
  353. # on the fly.
  354. LDPPFLAGS += \
  355. -include $(TOPDIR)/include/u-boot/u-boot.lds.h \
  356. -DCPUDIR=$(CPUDIR) \
  357. $(shell $(LD) --version | \
  358. sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
  359. __OBJS := $(subst $(obj),,$(OBJS))
  360. __LIBS := $(subst $(obj),,$(LIBS))
  361. #########################################################################
  362. #########################################################################
  363. ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
  364. BOARD_SIZE_CHECK = \
  365. @actual=`wc -c $@ | awk '{print $$1}'`; \
  366. limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
  367. if test $$actual -gt $$limit; then \
  368. echo "$@ exceeds file size limit:" >&2 ; \
  369. echo " limit: $$limit bytes" >&2 ; \
  370. echo " actual: $$actual bytes" >&2 ; \
  371. echo " excess: $$((actual - limit)) bytes" >&2; \
  372. exit 1; \
  373. fi
  374. else
  375. BOARD_SIZE_CHECK =
  376. endif
  377. # Statically apply RELA-style relocations (currently arm64 only)
  378. ifneq ($(CONFIG_STATIC_RELA),)
  379. # $(1) is u-boot ELF, $(2) is u-boot bin, $(3) is text base
  380. DO_STATIC_RELA = \
  381. start=$$($(NM) $(1) | grep __rel_dyn_start | cut -f 1 -d ' '); \
  382. end=$$($(NM) $(1) | grep __rel_dyn_end | cut -f 1 -d ' '); \
  383. $(obj)tools/relocate-rela $(2) $(3) $$start $$end
  384. else
  385. DO_STATIC_RELA =
  386. endif
  387. # Always append ALL so that arch config.mk's can add custom ones
  388. ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
  389. ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
  390. ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
  391. ALL-$(CONFIG_RAMBOOT_PBL) += $(obj)u-boot.pbl
  392. ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
  393. ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
  394. ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
  395. ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
  396. ifneq ($(CONFIG_SPL_TARGET),)
  397. ALL-$(CONFIG_SPL) += $(obj)$(CONFIG_SPL_TARGET:"%"=%)
  398. endif
  399. ALL-$(CONFIG_REMAKE_ELF) += $(obj)u-boot.elf
  400. # enable combined SPL/u-boot/dtb rules for tegra
  401. ifneq ($(CONFIG_TEGRA),)
  402. ifeq ($(CONFIG_SPL),y)
  403. ifeq ($(CONFIG_OF_SEPARATE),y)
  404. ALL-y += $(obj)u-boot-dtb-tegra.bin
  405. else
  406. ALL-y += $(obj)u-boot-nodtb-tegra.bin
  407. endif
  408. endif
  409. endif
  410. all: $(ALL-y) $(SUBDIR_EXAMPLES-y)
  411. $(obj)u-boot.dtb: checkdtc $(obj)u-boot
  412. $(MAKE) $(build) dts binary
  413. mv $(obj)dts/dt.dtb $@
  414. $(obj)u-boot-dtb.bin: $(obj)u-boot.bin $(obj)u-boot.dtb
  415. cat $^ >$@
  416. $(obj)u-boot.hex: $(obj)u-boot
  417. $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
  418. $(obj)u-boot.srec: $(obj)u-boot
  419. $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
  420. $(obj)u-boot.bin: $(obj)u-boot
  421. $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
  422. $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE))
  423. $(BOARD_SIZE_CHECK)
  424. $(obj)u-boot.ldr: $(obj)u-boot
  425. $(CREATE_LDR_ENV)
  426. $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
  427. $(BOARD_SIZE_CHECK)
  428. $(obj)u-boot.ldr.hex: $(obj)u-boot.ldr
  429. $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
  430. $(obj)u-boot.ldr.srec: $(obj)u-boot.ldr
  431. $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
  432. #
  433. # U-Boot entry point, needed for booting of full-blown U-Boot
  434. # from the SPL U-Boot version.
  435. #
  436. ifndef CONFIG_SYS_UBOOT_START
  437. CONFIG_SYS_UBOOT_START := 0
  438. endif
  439. $(obj)u-boot.img: $(obj)u-boot.bin
  440. $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
  441. -O u-boot -a $(CONFIG_SYS_TEXT_BASE) \
  442. -e $(CONFIG_SYS_UBOOT_START) \
  443. -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
  444. sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \
  445. -d $< $@
  446. $(obj)u-boot.imx: $(obj)u-boot.bin depend
  447. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common $(OBJTREE)/u-boot.imx
  448. $(obj)u-boot.kwb: $(obj)u-boot.bin
  449. $(obj)tools/mkimage -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
  450. -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
  451. $(obj)u-boot.pbl: $(obj)u-boot.bin
  452. $(obj)tools/mkimage -n $(CONFIG_SYS_FSL_PBL_RCW) \
  453. -R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage \
  454. -d $< $@
  455. $(obj)u-boot.sha1: $(obj)u-boot.bin
  456. $(obj)tools/ubsha1 $(obj)u-boot.bin
  457. $(obj)u-boot.dis: $(obj)u-boot
  458. $(OBJDUMP) -d $< > $@
  459. # $@ is output, $(1) and $(2) are inputs, $(3) is padded intermediate,
  460. # $(4) is pad-to
  461. SPL_PAD_APPEND = \
  462. $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(4) -I binary -O binary \
  463. $(1) $(obj)$(3); \
  464. cat $(obj)$(3) $(2) > $@; \
  465. rm $(obj)$(3)
  466. ifdef CONFIG_TPL
  467. SPL_PAYLOAD := $(obj)tpl/u-boot-with-tpl.bin
  468. else
  469. SPL_PAYLOAD := $(obj)u-boot.bin
  470. endif
  471. $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(SPL_PAYLOAD)
  472. $(call SPL_PAD_APPEND,$<,$(SPL_PAYLOAD),spl/u-boot-spl-pad.bin,$(CONFIG_SPL_PAD_TO))
  473. $(obj)tpl/u-boot-with-tpl.bin: $(obj)tpl/u-boot-tpl.bin $(obj)u-boot.bin
  474. $(call SPL_PAD_APPEND,$<,$(obj)u-boot.bin,tpl/u-boot-tpl-pad.bin,$(CONFIG_TPL_PAD_TO))
  475. $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  476. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
  477. $(OBJTREE)/u-boot-with-spl.imx
  478. $(obj)u-boot-with-nand-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  479. $(MAKE) $(build) $(SRCTREE)/arch/arm/imx-common \
  480. $(OBJTREE)/u-boot-with-nand-spl.imx
  481. $(obj)u-boot.ubl: $(obj)u-boot-with-spl.bin
  482. $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
  483. -e $(CONFIG_SYS_TEXT_BASE) -d $< $(obj)u-boot.ubl
  484. $(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  485. $(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
  486. -T aisimage \
  487. -e $(CONFIG_SPL_TEXT_BASE) \
  488. -d $(obj)spl/u-boot-spl.bin \
  489. $(obj)spl/u-boot-spl.ais
  490. $(OBJCOPY) ${OBJCFLAGS} -I binary \
  491. --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \
  492. $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais
  493. cat $(obj)spl/u-boot-spl-pad.ais $(obj)u-boot.img > \
  494. $(obj)u-boot.ais
  495. $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
  496. $(MAKE) $(build) $(SRCTREE)/$(CPUDIR)/$(SOC)/ $(OBJTREE)/u-boot.sb
  497. # On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
  498. # Both images are created using mkimage (crc etc), so that the ROM
  499. # bootloader can check its integrity. Padding needs to be done to the
  500. # SPL image (with mkimage header) and not the binary. Otherwise the resulting image
  501. # which is loaded/copied by the ROM bootloader to SRAM doesn't fit.
  502. # The resulting image containing both U-Boot images is called u-boot.spr
  503. $(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin
  504. $(obj)tools/mkimage -A $(ARCH) -T firmware -C none \
  505. -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n XLOADER \
  506. -d $(obj)spl/u-boot-spl.bin $@
  507. $(OBJCOPY) -I binary -O binary \
  508. --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
  509. cat $(obj)u-boot.img >> $@
  510. ifneq ($(CONFIG_TEGRA),)
  511. $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  512. $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
  513. cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
  514. rm $(obj)spl/u-boot-spl-pad.bin
  515. ifeq ($(CONFIG_OF_SEPARATE),y)
  516. $(obj)u-boot-dtb-tegra.bin: $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb
  517. cat $(obj)u-boot-nodtb-tegra.bin $(obj)u-boot.dtb > $@
  518. endif
  519. endif
  520. $(obj)u-boot-img.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  521. cat $(obj)spl/u-boot-spl.bin $(obj)u-boot.img > $@
  522. # PPC4xx needs the SPL at the end of the image, since the reset vector
  523. # is located at 0xfffffffc. So we can't use the "u-boot-img.bin" target
  524. # and need to introduce a new build target with the full blown U-Boot
  525. # at the start padded up to the start of the SPL image. And then concat
  526. # the SPL image to the end.
  527. $(obj)u-boot-img-spl-at-end.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.img
  528. $(OBJCOPY) -I binary -O binary --pad-to=$(CONFIG_UBOOT_PAD_TO) \
  529. --gap-fill=0xff $(obj)u-boot.img $@
  530. cat $(obj)spl/u-boot-spl.bin >> $@
  531. # Create a new ELF from a raw binary file. This is useful for arm64
  532. # where static relocation needs to be performed on the raw binary,
  533. # but certain simulators only accept an ELF file (but don't do the
  534. # relocation).
  535. # FIXME refactor dts/Makefile to share target/arch detection
  536. $(obj)u-boot.elf: $(obj)u-boot.bin
  537. @$(OBJCOPY) -B aarch64 -I binary -O elf64-littleaarch64 \
  538. $< $(obj)u-boot-elf.o
  539. @$(LD) $(obj)u-boot-elf.o -o $@ \
  540. --defsym=_start=$(CONFIG_SYS_TEXT_BASE) \
  541. -Ttext=$(CONFIG_SYS_TEXT_BASE)
  542. ifeq ($(CONFIG_SANDBOX),y)
  543. GEN_UBOOT = \
  544. cd $(LNDIR) && $(CC) $(SYMS) -T $(obj)u-boot.lds \
  545. -Wl,--start-group $(__LIBS) -Wl,--end-group \
  546. $(PLATFORM_LIBS) -Wl,-Map -Wl,u-boot.map -o u-boot
  547. else
  548. GEN_UBOOT = \
  549. cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
  550. $(__OBJS) \
  551. --start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
  552. -Map u-boot.map -o u-boot
  553. endif
  554. $(obj)u-boot: depend \
  555. $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(obj)u-boot.lds
  556. $(GEN_UBOOT)
  557. ifeq ($(CONFIG_KALLSYMS),y)
  558. smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
  559. awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
  560. $(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" \
  561. -c common/system_map.c -o $(obj)common/system_map.o
  562. $(GEN_UBOOT) $(obj)common/system_map.o
  563. endif
  564. $(OBJS):
  565. @:
  566. $(LIBS): depend $(SUBDIR_TOOLS)
  567. $(MAKE) $(build) $(dir $(subst $(obj),,$@))
  568. $(SUBDIRS): depend
  569. $(MAKE) $(build) $@ all
  570. $(SUBDIR_EXAMPLES-y): $(obj)u-boot
  571. $(obj)u-boot.lds: $(LDSCRIPT) depend
  572. $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
  573. nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
  574. $(MAKE) $(build) nand_spl/board/$(BOARDDIR) all
  575. $(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin
  576. cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
  577. $(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
  578. $(MAKE) -C spl all
  579. $(obj)tpl/u-boot-tpl.bin: $(SUBDIR_TOOLS) depend
  580. $(MAKE) -C spl all CONFIG_TPL_BUILD=y
  581. # Explicitly make _depend in subdirs containing multiple targets to prevent
  582. # parallel sub-makes creating .depend files simultaneously.
  583. depend dep: $(TIMESTAMP_FILE) $(VERSION_FILE) \
  584. $(obj)include/spl-autoconf.mk \
  585. $(obj)include/tpl-autoconf.mk \
  586. $(obj)include/autoconf.mk \
  587. $(obj)include/generated/generic-asm-offsets.h \
  588. $(obj)include/generated/asm-offsets.h
  589. TAG_SUBDIRS = $(SUBDIRS)
  590. TAG_SUBDIRS += $(dir $(__LIBS))
  591. TAG_SUBDIRS += include
  592. FIND := find
  593. FINDFLAGS := -L
  594. checkstack:
  595. $(CROSS_COMPILE)objdump -d $(obj)u-boot \
  596. `$(FIND) $(obj) -name u-boot-spl -print` | \
  597. perl $(src)scripts/checkstack.pl $(ARCH)
  598. tags ctags:
  599. ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  600. -name '*.[chS]' -print`
  601. etags:
  602. etags -a -o $(obj)etags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
  603. -name '*.[chS]' -print`
  604. cscope:
  605. $(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) -name '*.[chS]' -print > \
  606. cscope.files
  607. cscope -b -q -k
  608. SYSTEM_MAP = \
  609. $(NM) $1 | \
  610. grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
  611. LC_ALL=C sort
  612. $(obj)System.map: $(obj)u-boot
  613. @$(call SYSTEM_MAP,$<) > $@
  614. checkthumb:
  615. @if test $(call cc-version) -lt 0404; then \
  616. echo -n '*** Your GCC does not produce working '; \
  617. echo 'binaries in THUMB mode.'; \
  618. echo '*** Your board is configured for THUMB mode.'; \
  619. false; \
  620. fi
  621. # GCC 3.x is reported to have problems generating the type of relocation
  622. # that U-Boot wants.
  623. # See http://lists.denx.de/pipermail/u-boot/2012-September/135156.html
  624. checkgcc4:
  625. @if test $(call cc-version) -lt 0400; then \
  626. echo -n '*** Your GCC is too old, please upgrade to GCC 4.x or newer'; \
  627. false; \
  628. fi
  629. checkdtc:
  630. @if test $(call dtc-version) -lt 0104; then \
  631. echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
  632. false; \
  633. fi
  634. #
  635. # Auto-generate the autoconf.mk file (which is included by all makefiles)
  636. #
  637. # This target actually generates 2 files; autoconf.mk and autoconf.mk.dep.
  638. # the dep file is only include in this top level makefile to determine when
  639. # to regenerate the autoconf.mk file.
  640. $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
  641. @$(XECHO) Generating $@ ; \
  642. : Generate the dependancies ; \
  643. $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
  644. -MQ $(obj)include/autoconf.mk include/common.h > $@ || \
  645. rm $@
  646. $(obj)include/autoconf.mk: $(obj)include/config.h
  647. @$(XECHO) Generating $@ ; \
  648. : Extract the config macros ; \
  649. $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  650. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  651. rm $@.tmp
  652. # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
  653. $(obj)include/tpl-autoconf.mk: $(obj)include/config.h
  654. @$(XECHO) Generating $@ ; \
  655. : Extract the config macros ; \
  656. $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD -DCONFIG_SPL_BUILD\
  657. -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  658. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  659. rm $@.tmp
  660. $(obj)include/spl-autoconf.mk: $(obj)include/config.h
  661. @$(XECHO) Generating $@ ; \
  662. : Extract the config macros ; \
  663. $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
  664. sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
  665. rm $@.tmp
  666. $(obj)include/generated/generic-asm-offsets.h: $(obj)lib/asm-offsets.s
  667. @$(XECHO) Generating $@
  668. tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
  669. $(obj)lib/asm-offsets.s: $(obj)include/config.h $(src)lib/asm-offsets.c
  670. @mkdir -p $(obj)lib
  671. $(CC) -DDO_DEPS_ONLY \
  672. $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  673. -o $@ $(src)lib/asm-offsets.c -c -S
  674. $(obj)include/generated/asm-offsets.h: $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
  675. @$(XECHO) Generating $@
  676. tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
  677. $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/config.h
  678. @mkdir -p $(obj)$(CPUDIR)/$(SOC)
  679. if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
  680. $(CC) -DDO_DEPS_ONLY \
  681. $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
  682. -o $@ $(src)$(CPUDIR)/$(SOC)/asm-offsets.c -c -S; \
  683. else \
  684. touch $@; \
  685. fi
  686. #########################################################################
  687. else # !config.mk
  688. all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
  689. $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
  690. $(filter-out tools,$(SUBDIRS)) \
  691. depend dep tags ctags etags cscope $(obj)System.map:
  692. @echo "System not configured - see README" >&2
  693. @ exit 1
  694. tools: $(VERSION_FILE) $(TIMESTAMP_FILE)
  695. $(MAKE) $(build) $@ all
  696. endif # config.mk
  697. # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
  698. # R_AARCH64_RELATIVE (64-bit).
  699. checkarmreloc: $(obj)u-boot
  700. @RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
  701. grep R_A | sort -u`"; \
  702. if test "$$RELOC" != "R_ARM_RELATIVE" -a \
  703. "$$RELOC" != "R_AARCH64_RELATIVE"; then \
  704. echo "$< contains unexpected relocations: $$RELOC"; \
  705. false; \
  706. fi
  707. $(VERSION_FILE):
  708. @mkdir -p $(dir $(VERSION_FILE))
  709. @( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
  710. printf '#define PLAIN_VERSION "%s%s"\n' \
  711. "$(U_BOOT_VERSION)" "$${localvers}" ; \
  712. printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
  713. "$(U_BOOT_VERSION)" "$${localvers}" ; \
  714. ) > $@.tmp
  715. @( printf '#define CC_VERSION_STRING "%s"\n' \
  716. '$(shell $(CC) --version | head -n 1)' )>> $@.tmp
  717. @( printf '#define LD_VERSION_STRING "%s"\n' \
  718. '$(shell $(LD) -v | head -n 1)' )>> $@.tmp
  719. @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
  720. $(TIMESTAMP_FILE):
  721. @mkdir -p $(dir $(TIMESTAMP_FILE))
  722. @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp
  723. @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp
  724. @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
  725. easylogo env gdb:
  726. $(MAKE) $(build) tools/$@ MTD_VERSION=${MTD_VERSION}
  727. gdbtools: gdb
  728. xmldocs pdfdocs psdocs htmldocs mandocs: tools/kernel-doc/docproc
  729. $(MAKE) U_BOOT_VERSION=$(U_BOOT_VERSION) -C doc/DocBook/ $@
  730. tools-all: easylogo env gdb $(VERSION_FILE) $(TIMESTAMP_FILE)
  731. $(MAKE) $(build) tools HOST_TOOLS_ALL=y
  732. .PHONY : CHANGELOG
  733. CHANGELOG:
  734. git log --no-merges U-Boot-1_1_5.. | \
  735. unexpand -a | sed -e 's/\s\s*$$//' > $@
  736. include/license.h: tools/bin2header COPYING
  737. cat COPYING | gzip -9 -c | ./tools/bin2header license_gzip > include/license.h
  738. #########################################################################
  739. unconfig:
  740. @rm -f $(obj)include/config.h $(obj)include/config.mk \
  741. $(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \
  742. $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \
  743. $(obj)include/spl-autoconf.mk \
  744. $(obj)include/tpl-autoconf.mk
  745. %_config:: unconfig
  746. @$(MKCONFIG) -A $(@:_config=)
  747. sinclude $(obj).boards.depend
  748. $(obj).boards.depend: boards.cfg
  749. @awk '(NF && $$1 !~ /^#/) { print $$7 ": " $$7 "_config; $$(MAKE)" }' $< > $@
  750. #########################################################################
  751. #########################################################################
  752. clean:
  753. @rm -f $(obj)examples/standalone/atmel_df_pow2 \
  754. $(obj)examples/standalone/hello_world \
  755. $(obj)examples/standalone/interrupt \
  756. $(obj)examples/standalone/mem_to_mem_idma2intr \
  757. $(obj)examples/standalone/sched \
  758. $(addprefix $(obj)examples/standalone/, smc91111_eeprom smc911x_eeprom) \
  759. $(obj)examples/standalone/test_burst \
  760. $(obj)examples/standalone/timer
  761. @rm -f $(addprefix $(obj)examples/api/, demo demo.bin)
  762. @rm -f $(obj)tools/bmp_logo $(obj)tools/easylogo/easylogo \
  763. $(obj)tools/env/fw_printenv \
  764. $(obj)tools/envcrc \
  765. $(addprefix $(obj)tools/gdb/, gdbcont gdbsend) \
  766. $(obj)tools/gen_eth_addr $(obj)tools/img2srec \
  767. $(obj)tools/dumpimage \
  768. $(addprefix $(obj)tools/, mkenvimage mkimage) \
  769. $(obj)tools/mpc86x_clk \
  770. $(addprefix $(obj)tools/, mk$(BOARD)spl mkexynosspl) \
  771. $(obj)tools/mxsboot \
  772. $(obj)tools/ncb $(obj)tools/ubsha1 \
  773. $(obj)tools/kernel-doc/docproc \
  774. $(obj)tools/proftool
  775. @rm -f $(addprefix $(obj)board/cray/L1/, bootscript.c bootscript.image) \
  776. $(obj)board/matrix_vision/*/bootscript.img \
  777. $(obj)spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl \
  778. $(obj)u-boot.lds \
  779. $(addprefix $(obj)arch/blackfin/cpu/, init.lds init.elf)
  780. @rm -f $(obj)include/bmp_logo.h
  781. @rm -f $(obj)include/bmp_logo_data.h
  782. @rm -f $(obj)lib/asm-offsets.s
  783. @rm -f $(obj)include/generated/asm-offsets.h
  784. @rm -f $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
  785. @rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
  786. @$(MAKE) -s -C doc/DocBook/ cleandocs
  787. @find $(OBJTREE) -type f \
  788. \( -name 'core' -o -name '*.bak' -o -name '*~' -o -name '*.su' \
  789. -o -name '*.o' -o -name '*.a' -o -name '*.exe' \
  790. -o -name '*.cfgtmp' \) -print \
  791. | xargs rm -f
  792. # Removes everything not needed for testing u-boot
  793. tidy: clean
  794. @find $(OBJTREE) -type f \( -name '*.depend*' \) -print | xargs rm -f
  795. clobber: tidy
  796. @find $(OBJTREE) -type f \( -name '*.srec' \
  797. -o -name '*.bin' -o -name u-boot.img \) \
  798. -print0 | xargs -0 rm -f
  799. @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
  800. $(obj)cscope.* $(obj)*.*~
  801. @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL-y)
  802. @rm -f $(obj)u-boot.kwb
  803. @rm -f $(obj)u-boot.pbl
  804. @rm -f $(obj)u-boot.imx
  805. @rm -f $(obj)u-boot-with-spl.imx
  806. @rm -f $(obj)u-boot-with-nand-spl.imx
  807. @rm -f $(obj)u-boot.ubl
  808. @rm -f $(obj)u-boot.ais
  809. @rm -f $(obj)u-boot.dtb
  810. @rm -f $(obj)u-boot.sb
  811. @rm -f $(obj)u-boot.spr
  812. @rm -f $(addprefix $(obj)nand_spl/, u-boot.lds u-boot.lst System.map)
  813. @rm -f $(addprefix $(obj)nand_spl/, u-boot-nand_spl.lds u-boot-spl u-boot-spl.map)
  814. @rm -f $(addprefix $(obj)spl/, u-boot-spl u-boot-spl.bin u-boot-spl.map)
  815. @rm -f $(obj)spl/u-boot-spl.lds
  816. @rm -f $(addprefix $(obj)tpl/, u-boot-tpl u-boot-tpl.bin u-boot-tpl.map)
  817. @rm -f $(obj)tpl/u-boot-spl.lds
  818. @rm -f $(obj)MLO MLO.byteswap
  819. @rm -f $(obj)SPL
  820. @rm -f $(obj)tools/xway-swap-bytes
  821. @rm -fr $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
  822. @rm -fr $(obj)include/generated
  823. @[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
  824. @rm -f $(obj)dts/*.tmp
  825. @rm -f $(addprefix $(obj)spl/, u-boot-spl.ais, u-boot-spl-pad.ais)
  826. mrproper \
  827. distclean: clobber unconfig
  828. ifneq ($(OBJTREE),$(SRCTREE))
  829. rm -rf $(obj)*
  830. endif
  831. backup:
  832. F=`basename $(TOPDIR)` ; cd .. ; \
  833. gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
  834. #########################################################################