Makefile 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #
  2. # (C) Copyright 2000-2006
  3. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. #
  5. # SPDX-License-Identifier: GPL-2.0+
  6. #
  7. # Enable all the config-independent tools
  8. ifneq ($(HOST_TOOLS_ALL),)
  9. CONFIG_LCD_LOGO = y
  10. CONFIG_CMD_LOADS = y
  11. CONFIG_CMD_NET = y
  12. CONFIG_XWAY_SWAP_BYTES = y
  13. CONFIG_NETCONSOLE = y
  14. CONFIG_SHA1_CHECK_UB_IMG = y
  15. CONFIG_ARCH_SUNXI = y
  16. endif
  17. subdir-$(HOST_TOOLS_ALL) += easylogo
  18. subdir-$(HOST_TOOLS_ALL) += gdb
  19. # Merge all the different vars for envcrc into one
  20. ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
  21. ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
  22. ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
  23. ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
  24. ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
  25. ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
  26. ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
  27. CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
  28. hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
  29. hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
  30. hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
  31. HOSTCFLAGS_bmp_logo.o := -pedantic
  32. hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
  33. envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
  34. hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
  35. HOSTCFLAGS_gen_eth_addr.o := -pedantic
  36. hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
  37. gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
  38. HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
  39. hostprogs-$(CONFIG_CMD_LOADS) += img2srec
  40. HOSTCFLAGS_img2srec.o := -pedantic
  41. hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
  42. HOSTCFLAGS_xway-swap-bytes.o := -pedantic
  43. hostprogs-y += mkenvimage
  44. mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
  45. hostprogs-y += dumpimage mkimage
  46. hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
  47. FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
  48. # The following files are synced with upstream DTC.
  49. # Use synced versions from scripts/dtc/libfdt/.
  50. LIBFDT_SRCS_SYNCED := fdt.c fdt_wip.c fdt_sw.c fdt_strerror.c fdt_empty_tree.c \
  51. fdt_addresses.c fdt_overlay.c
  52. # The following files are locally modified for U-Boot (unfotunately).
  53. # Use U-Boot own versions from lib/libfdt/.
  54. LIBFDT_SRCS_UNSYNCED := fdt_ro.c fdt_rw.c fdt_region.c
  55. LIBFDT_OBJS := $(addprefix libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_SYNCED))) \
  56. $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_UNSYNCED)))
  57. RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
  58. rsa-sign.o rsa-verify.o rsa-checksum.o \
  59. rsa-mod-exp.o)
  60. ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
  61. # common objs for dumpimage and mkimage
  62. dumpimage-mkimage-objs := aisimage.o \
  63. atmelimage.o \
  64. $(FIT_SIG_OBJS-y) \
  65. common/bootm.o \
  66. lib/crc32.o \
  67. default_image.o \
  68. lib/fdtdec_common.o \
  69. lib/fdtdec.o \
  70. fit_common.o \
  71. fit_image.o \
  72. common/image-fit.o \
  73. image-host.o \
  74. common/image.o \
  75. imagetool.o \
  76. imximage.o \
  77. kwbimage.o \
  78. lib/md5.o \
  79. lpc32xximage.o \
  80. mxsimage.o \
  81. omapimage.o \
  82. os_support.o \
  83. pblimage.o \
  84. pbl_crc32.o \
  85. vybridimage.o \
  86. $(ROCKCHIP_OBS) \
  87. socfpgaimage.o \
  88. lib/sha1.o \
  89. lib/sha256.o \
  90. common/hash.o \
  91. ublimage.o \
  92. zynqimage.o \
  93. zynqmpimage.o \
  94. $(LIBFDT_OBJS) \
  95. gpimage.o \
  96. gpimage-common.o \
  97. $(RSA_OBJS-y)
  98. dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
  99. mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
  100. fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
  101. fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
  102. ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
  103. # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
  104. # the mxsimage support within tools/mxsimage.c .
  105. HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
  106. endif
  107. ifdef CONFIG_FIT_SIGNATURE
  108. # This affects include/image.h, but including the board config file
  109. # is tricky, so manually define this options here.
  110. HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE
  111. endif
  112. ifdef CONFIG_SYS_U_BOOT_OFFS
  113. HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
  114. endif
  115. ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
  116. HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
  117. endif
  118. # MXSImage needs LibSSL
  119. ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
  120. HOSTLOADLIBES_mkimage += \
  121. $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
  122. # OS X deprecate openssl in favour of CommonCrypto, supress deprecation
  123. # warnings on those systems
  124. ifeq ($(HOSTOS),darwin)
  125. HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
  126. HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
  127. HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
  128. endif
  129. endif
  130. HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
  131. HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
  132. HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
  133. HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
  134. hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
  135. hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
  136. HOSTCFLAGS_mkexynosspl.o := -pedantic
  137. ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
  138. hostprogs-$(CONFIG_X86) += ifdtool
  139. hostprogs-$(CONFIG_MX23) += mxsboot
  140. hostprogs-$(CONFIG_MX28) += mxsboot
  141. HOSTCFLAGS_mxsboot.o := -pedantic
  142. hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
  143. hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
  144. sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
  145. hostprogs-$(CONFIG_NETCONSOLE) += ncb
  146. hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
  147. ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
  148. HOSTCFLAGS_ubsha1.o := -pedantic
  149. hostprogs-$(CONFIG_KIRKWOOD) += kwboot
  150. hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
  151. hostprogs-y += proftool
  152. hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
  153. hostprogs-y += fdtgrep
  154. fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o
  155. hostprogs-$(CONFIG_MIPS) += mips-relocs
  156. # We build some files with extra pedantic flags to try to minimize things
  157. # that won't build on some weird host compiler -- though there are lots of
  158. # exceptions for files that aren't complaint.
  159. HOSTCFLAGS_crc32.o := -pedantic
  160. HOSTCFLAGS_crc8.o := -pedantic
  161. HOSTCFLAGS_md5.o := -pedantic
  162. HOSTCFLAGS_sha1.o := -pedantic
  163. HOSTCFLAGS_sha256.o := -pedantic
  164. quiet_cmd_wrap = WRAP $@
  165. cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
  166. $(obj)/lib/%.c $(obj)/common/%.c $(obj)/env/%.c:
  167. $(call cmd,wrap)
  168. clean-dirs := lib common
  169. always := $(hostprogs-y)
  170. # Generated LCD/video logo
  171. LOGO_H = $(objtree)/include/bmp_logo.h
  172. LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
  173. LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
  174. LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
  175. LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
  176. LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
  177. # Generic logo
  178. ifeq ($(LOGO_BMP),)
  179. LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
  180. # Use board logo and fallback to vendor
  181. ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
  182. LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
  183. else
  184. ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
  185. LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
  186. endif
  187. endif
  188. endif # !LOGO_BMP
  189. #
  190. # Use native tools and options
  191. # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
  192. # Define _GNU_SOURCE to obtain the getline prototype from stdio.h
  193. #
  194. HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
  195. $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
  196. -I$(srctree)/lib/libfdt \
  197. -I$(srctree)/tools \
  198. -DUSE_HOSTCC \
  199. -D__KERNEL_STRICT_NAMES \
  200. -D_GNU_SOURCE
  201. __build: $(LOGO-y)
  202. $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
  203. $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
  204. $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
  205. $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
  206. # Let clean descend into subdirs
  207. subdir- += env
  208. ifneq ($(CROSS_BUILD_TOOLS),)
  209. override HOSTCC = $(CC)
  210. quiet_cmd_crosstools_strip = STRIP $^
  211. cmd_crosstools_strip = $(STRIP) $^; touch $@
  212. $(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y)))
  213. $(call cmd,crosstools_strip)
  214. always += .strip
  215. endif
  216. clean-files += .strip