]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0+ |
efee1709 | 2 | # |
f9328639 | 3 | # (C) Copyright 2000-2006 |
efee1709 | 4 | # Wolfgang Denk, DENX Software Engineering, [email protected]. |
efee1709 | 5 | |
cb9faa6f AG |
6 | # A note on target vs host configuration: |
7 | # | |
8 | # Host tools can be used across multiple targets, or different configurations | |
9 | # of the same target. Thus, host tools must be able to handle any combination | |
10 | # of target configurations. To prevent having different variations of the same | |
11 | # tool, the tool build options may not depend on target configuration. | |
12 | # | |
13 | # Some linux distributions package these utilities as u-boot-tools, and it | |
14 | # would be unmaintainable to have a different tool variation for each | |
15 | # arch or configuration. | |
16 | # | |
17 | # A couple of simple rules: | |
18 | # | |
19 | # 1) Do not use target CONFIG_* options to enable or disable features in host | |
20 | # tools. Only use the configs from tools/Kconfig | |
21 | # 2) It's okay to use target configs to disable building specific tools. | |
22 | # That's as long as the features of those tools aren't modified. | |
23 | # | |
24 | ||
c7c0d542 MF |
25 | # Enable all the config-independent tools |
26 | ifneq ($(HOST_TOOLS_ALL),) | |
bb0fb4c0 | 27 | CONFIG_ARCH_KIRKWOOD = y |
c7c0d542 | 28 | CONFIG_LCD_LOGO = y |
570d7d50 | 29 | CONFIG_CMD_LOADS = y |
c7c0d542 | 30 | CONFIG_CMD_NET = y |
60b74bde | 31 | CONFIG_XWAY_SWAP_BYTES = y |
c7c0d542 MF |
32 | CONFIG_NETCONSOLE = y |
33 | CONFIG_SHA1_CHECK_UB_IMG = y | |
d8c0d99e | 34 | CONFIG_ARCH_SUNXI = y |
c7c0d542 MF |
35 | endif |
36 | ||
2887c473 MY |
37 | subdir-$(HOST_TOOLS_ALL) += gdb |
38 | ||
2ad6e27d MF |
39 | # Merge all the different vars for envcrc into one |
40 | ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y | |
2ad6e27d MF |
41 | ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y |
42 | ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | |
43 | ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y | |
44 | ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y | |
45 | ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y | |
46 | ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y | |
47 | CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) | |
48 | ||
96b09a97 | 49 | hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params |
5c390a5b | 50 | |
96b09a97 MY |
51 | hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo |
52 | hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo | |
53 | HOSTCFLAGS_bmp_logo.o := -pedantic | |
940db16d | 54 | |
96b09a97 | 55 | hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc |
0649cd0d | 56 | envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o |
940db16d | 57 | |
96b09a97 MY |
58 | hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr |
59 | HOSTCFLAGS_gen_eth_addr.o := -pedantic | |
ee3584a5 | 60 | |
c25f01a6 | 61 | hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc |
62 | gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o | |
63 | HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic | |
64 | ||
96b09a97 MY |
65 | hostprogs-$(CONFIG_CMD_LOADS) += img2srec |
66 | HOSTCFLAGS_img2srec.o := -pedantic | |
940db16d | 67 | |
96b09a97 MY |
68 | hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes |
69 | HOSTCFLAGS_xway-swap-bytes.o := -pedantic | |
940db16d | 70 | |
96b09a97 MY |
71 | hostprogs-y += mkenvimage |
72 | mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o | |
940db16d | 73 | |
96b09a97 | 74 | hostprogs-y += dumpimage mkimage |
cb9faa6f | 75 | hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fit_info fit_check_sign |
940db16d | 76 | |
ac020196 HS |
77 | hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include |
78 | ||
cb9faa6f AG |
79 | FIT_OBJS-y := fit_common.o fit_image.o image-host.o common/image-fit.o |
80 | FIT_SIG_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := image-sig-host.o common/image-fit-sig.o | |
81 | FIT_CIPHER_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := common/image-cipher.o | |
ee95d10b | 82 | |
b38ad663 MY |
83 | # The following files are synced with upstream DTC. |
84 | # Use synced versions from scripts/dtc/libfdt/. | |
3e69db12 MY |
85 | LIBFDT_OBJS := $(addprefix libfdt/, fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o \ |
86 | fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o) | |
330274f1 | 87 | |
cb9faa6f | 88 | RSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/rsa/, \ |
0bcb28df | 89 | rsa-sign.o rsa-verify.o \ |
fc2f4246 | 90 | rsa-mod-exp.o) |
940db16d | 91 | |
cb9faa6f | 92 | ECDSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/ecdsa/, ecdsa-libcrypto.o) |
ed6c9e0b | 93 | |
cb9faa6f | 94 | AES_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/aes/, \ |
4df35781 | 95 | aes-encrypt.o aes-decrypt.o) |
7298e422 | 96 | |
4c17e5f6 | 97 | # Cryptographic helpers that depend on openssl/libcrypto |
cb9faa6f | 98 | LIBCRYPTO_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/, \ |
4c17e5f6 AG |
99 | fdt-libcrypto.o) |
100 | ||
9b03701a | 101 | ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o |
a131c1f4 | 102 | |
940db16d MY |
103 | # common objs for dumpimage and mkimage |
104 | dumpimage-mkimage-objs := aisimage.o \ | |
7b1a4117 | 105 | atmelimage.o \ |
93e07880 | 106 | $(FIT_OBJS-y) \ |
940db16d | 107 | $(FIT_SIG_OBJS-y) \ |
7298e422 | 108 | $(FIT_CIPHER_OBJS-y) \ |
3e69db12 | 109 | common/fdt_region.o \ |
ea51a628 | 110 | common/bootm.o \ |
ad80c4a3 | 111 | lib/crc32.o \ |
940db16d | 112 | default_image.o \ |
b047d671 | 113 | lib/fdtdec_common.o \ |
ad80c4a3 | 114 | lib/fdtdec.o \ |
ad80c4a3 | 115 | common/image.o \ |
5d3248a6 | 116 | common/image-host.o \ |
940db16d MY |
117 | imagetool.o \ |
118 | imximage.o \ | |
a2b96ece | 119 | imx8image.o \ |
6609c266 | 120 | imx8mimage.o \ |
940db16d | 121 | kwbimage.o \ |
ad80c4a3 | 122 | lib/md5.o \ |
39f520bb | 123 | lpc32xximage.o \ |
940db16d MY |
124 | mxsimage.o \ |
125 | omapimage.o \ | |
126 | os_support.o \ | |
127 | pblimage.o \ | |
abbc67ee | 128 | pbl_crc32.o \ |
ed0c2c0a | 129 | vybridimage.o \ |
81260e33 | 130 | stm32image.o \ |
a131c1f4 | 131 | $(ROCKCHIP_OBS) \ |
832472a9 | 132 | socfpgaimage.o \ |
6d295099 | 133 | sunxi_egon.o \ |
51c2345b | 134 | lib/crc16.o \ |
0bcb28df | 135 | lib/hash-checksum.o \ |
ad80c4a3 MY |
136 | lib/sha1.o \ |
137 | lib/sha256.o \ | |
d16b38f4 | 138 | lib/sha512.o \ |
2dd90027 | 139 | common/hash.o \ |
940db16d | 140 | ublimage.o \ |
66eef1e7 | 141 | zynqimage.o \ |
d9b58b30 | 142 | zynqmpimage.o \ |
6915dcf3 | 143 | zynqmpbif.o \ |
4c17e5f6 | 144 | $(LIBCRYPTO_OBJS-y) \ |
940db16d | 145 | $(LIBFDT_OBJS) \ |
969cd1fa SB |
146 | gpimage.o \ |
147 | gpimage-common.o \ | |
3b975a14 | 148 | mtk_image.o \ |
ed6c9e0b | 149 | $(ECDSA_OBJS-y) \ |
7298e422 PR |
150 | $(RSA_OBJS-y) \ |
151 | $(AES_OBJS-y) | |
940db16d | 152 | |
96b09a97 MY |
153 | dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o |
154 | mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o | |
155 | fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o | |
156 | fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o | |
ac020196 | 157 | file2include-objs := file2include.o |
940db16d | 158 | |
cb9faa6f | 159 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_TOOLS_LIBCRYPTO),) |
940db16d MY |
160 | # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register |
161 | # the mxsimage support within tools/mxsimage.c . | |
6825a95b | 162 | HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS |
940db16d MY |
163 | endif |
164 | ||
cb9faa6f | 165 | ifdef CONFIG_TOOLS_LIBCRYPTO |
940db16d MY |
166 | # This affects include/image.h, but including the board config file |
167 | # is tricky, so manually define this options here. | |
168 | HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE | |
cb9faa6f | 169 | HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff |
7298e422 PR |
170 | HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER |
171 | endif | |
172 | ||
97cb4e54 | 173 | # MXSImage needs LibSSL |
cb9faa6f | 174 | ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO),) |
9bdfe290 PB |
175 | HOSTCFLAGS_kwbimage.o += \ |
176 | $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") | |
587e4a42 | 177 | HOSTLDLIBS_mkimage += \ |
4839836a | 178 | $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") |
c6e3e821 AB |
179 | |
180 | # OS X deprecate openssl in favour of CommonCrypto, supress deprecation | |
181 | # warnings on those systems | |
182 | ifeq ($(HOSTOS),darwin) | |
183 | HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations | |
184 | HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations | |
185 | HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations | |
186 | endif | |
97cb4e54 MY |
187 | endif |
188 | ||
1f6049e2 | 189 | HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\" |
47a52cd1 | 190 | |
587e4a42 TR |
191 | HOSTLDLIBS_dumpimage := $(HOSTLDLIBS_mkimage) |
192 | HOSTLDLIBS_fit_info := $(HOSTLDLIBS_mkimage) | |
193 | HOSTLDLIBS_fit_check_sign := $(HOSTLDLIBS_mkimage) | |
97cb4e54 | 194 | |
96b09a97 MY |
195 | hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl |
196 | hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl | |
197 | HOSTCFLAGS_mkexynosspl.o := -pedantic | |
940db16d | 198 | |
31eca697 | 199 | ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o |
cd392fe8 SG |
200 | hostprogs-$(CONFIG_X86) += ifdtool |
201 | ||
56bf4f86 SG |
202 | ifwitool-objs := ifwitool.o |
203 | hostprogs-$(CONFIG_X86)$(CONFIG_SANDBOX) += ifwitool | |
204 | ||
96b09a97 MY |
205 | hostprogs-$(CONFIG_MX23) += mxsboot |
206 | hostprogs-$(CONFIG_MX28) += mxsboot | |
207 | HOSTCFLAGS_mxsboot.o := -pedantic | |
940db16d | 208 | |
aec9a0f1 | 209 | hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot |
594b4cc7 MR |
210 | hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder |
211 | sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o | |
50827a59 | 212 | |
96b09a97 MY |
213 | hostprogs-$(CONFIG_NETCONSOLE) += ncb |
214 | hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1 | |
940db16d | 215 | |
96b09a97 | 216 | ubsha1-objs := os_support.o ubsha1.o lib/sha1.o |
940db16d MY |
217 | |
218 | HOSTCFLAGS_ubsha1.o := -pedantic | |
219 | ||
bb0fb4c0 | 220 | hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot |
81e33f4b | 221 | hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot |
96b09a97 MY |
222 | hostprogs-y += proftool |
223 | hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela | |
42ac26f2 | 224 | hostprogs-$(CONFIG_RISCV) += prelink-riscv |
ee3584a5 | 225 | |
540a2bce SR |
226 | hostprogs-$(CONFIG_ARCH_OCTEON) += update_octeon_header |
227 | update_octeon_header-objs := update_octeon_header.o lib/crc32.o | |
228 | ||
1043d0a0 | 229 | hostprogs-y += fdtgrep |
3e69db12 | 230 | fdtgrep-objs += $(LIBFDT_OBJS) common/fdt_region.o fdtgrep.o |
1043d0a0 | 231 | |
2577015d SG |
232 | ifneq ($(TOOLS_ONLY),y) |
233 | hostprogs-y += spl_size_limit | |
234 | endif | |
235 | ||
703ec9dd PB |
236 | hostprogs-$(CONFIG_MIPS) += mips-relocs |
237 | ||
2b12196d AT |
238 | hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler |
239 | HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include | |
240 | ||
322c813f | 241 | mkeficapsule-objs := mkeficapsule.o $(LIBFDT_OBJS) |
fab430be AT |
242 | hostprogs-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += mkeficapsule |
243 | ||
940db16d MY |
244 | # We build some files with extra pedantic flags to try to minimize things |
245 | # that won't build on some weird host compiler -- though there are lots of | |
246 | # exceptions for files that aren't complaint. | |
247 | HOSTCFLAGS_crc32.o := -pedantic | |
1d3c5392 | 248 | HOSTCFLAGS_crc8.o := -pedantic |
940db16d MY |
249 | HOSTCFLAGS_md5.o := -pedantic |
250 | HOSTCFLAGS_sha1.o := -pedantic | |
2842c1c2 | 251 | HOSTCFLAGS_sha256.o := -pedantic |
d16b38f4 | 252 | HOSTCFLAGS_sha512.o := -pedantic -DCONFIG_SHA512 -DCONFIG_SHA384 |
940db16d | 253 | |
ad80c4a3 | 254 | quiet_cmd_wrap = WRAP $@ |
ffe29ebc | 255 | cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@ |
ad80c4a3 | 256 | |
0649cd0d | 257 | $(obj)/lib/%.c $(obj)/common/%.c $(obj)/env/%.c: |
ad80c4a3 MY |
258 | $(call cmd,wrap) |
259 | ||
260 | clean-dirs := lib common | |
261 | ||
940db16d | 262 | always := $(hostprogs-y) |
19c402af | 263 | |
335ffe7e | 264 | # Generated LCD/video logo |
9e414032 MY |
265 | LOGO_H = $(objtree)/include/bmp_logo.h |
266 | LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h | |
335ffe7e | 267 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H) |
c270730f | 268 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H) |
335ffe7e | 269 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H) |
c270730f | 270 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H) |
ee3584a5 | 271 | |
96903dae | 272 | # Generic logo |
ee3584a5 | 273 | ifeq ($(LOGO_BMP),) |
9e414032 | 274 | LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp |
96903dae OS |
275 | |
276 | # Use board logo and fallback to vendor | |
603f51cb | 277 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),) |
9e414032 | 278 | LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp |
96903dae | 279 | else |
603f51cb | 280 | ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),) |
9e414032 | 281 | LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp |
ee3584a5 | 282 | endif |
348de314 | 283 | endif |
ee3584a5 | 284 | |
96903dae OS |
285 | endif # !LOGO_BMP |
286 | ||
efee1709 WD |
287 | # |
288 | # Use native tools and options | |
2f8d396b | 289 | # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps |
2db1c3fc | 290 | # Define _GNU_SOURCE to obtain the getline prototype from stdio.h |
efee1709 | 291 | # |
66228220 | 292 | HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \ |
51148790 | 293 | $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ |
e0d20dc1 | 294 | -I$(srctree)/scripts/dtc/libfdt \ |
01286329 | 295 | -I$(srctree)/tools \ |
14d0a02a | 296 | -DUSE_HOSTCC \ |
2db1c3fc | 297 | -D__KERNEL_STRICT_NAMES \ |
4f03a4c7 | 298 | -D_GNU_SOURCE |
8cf30809 | 299 | |
d726f225 | 300 | __build: $(LOGO-y) |
efee1709 | 301 | |
9e414032 MY |
302 | $(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP) |
303 | $(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@ | |
c270730f | 304 | |
245b1029 HS |
305 | ifeq ($(CONFIG_DM_VIDEO),y) |
306 | $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) | |
307 | $(obj)/bmp_logo --gen-bmp $(LOGO_BMP) > $@ | |
308 | else | |
9e414032 MY |
309 | $(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP) |
310 | $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@ | |
245b1029 HS |
311 | #endif |
312 | endif | |
2887c473 MY |
313 | |
314 | # Let clean descend into subdirs | |
315 | subdir- += env | |
db5b339c MY |
316 | |
317 | ifneq ($(CROSS_BUILD_TOOLS),) | |
3b082529 | 318 | override HOSTCC = $(CC) |
72c69ea8 | 319 | override HOSTCFLAGS = $(CFLAGS) |
db5b339c MY |
320 | |
321 | quiet_cmd_crosstools_strip = STRIP $^ | |
322 | cmd_crosstools_strip = $(STRIP) $^; touch $@ | |
323 | $(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y))) | |
324 | $(call cmd,crosstools_strip) | |
325 | ||
326 | always += .strip | |
327 | endif | |
328 | clean-files += .strip |