]> Git Repo - J-u-boot.git/blame - tools/Makefile
Merge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot...
[J-u-boot.git] / tools / Makefile
CommitLineData
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
26ifneq ($(HOST_TOOLS_ALL),)
bb0fb4c0 27CONFIG_ARCH_KIRKWOOD = y
c7c0d542 28CONFIG_LCD_LOGO = y
570d7d50 29CONFIG_CMD_LOADS = y
c7c0d542 30CONFIG_CMD_NET = y
60b74bde 31CONFIG_XWAY_SWAP_BYTES = y
c7c0d542
MF
32CONFIG_NETCONSOLE = y
33CONFIG_SHA1_CHECK_UB_IMG = y
d8c0d99e 34CONFIG_ARCH_SUNXI = y
c7c0d542
MF
35endif
36
2887c473
MY
37subdir-$(HOST_TOOLS_ALL) += gdb
38
2ad6e27d
MF
39# Merge all the different vars for envcrc into one
40ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
2ad6e27d
MF
41ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
42ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
43ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
44ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
45ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
46ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
47CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
48
96b09a97 49hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
5c390a5b 50
96b09a97
MY
51hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
52hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
53HOSTCFLAGS_bmp_logo.o := -pedantic
940db16d 54
96b09a97 55hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
0649cd0d 56envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
940db16d 57
96b09a97
MY
58hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
59HOSTCFLAGS_gen_eth_addr.o := -pedantic
ee3584a5 60
c25f01a6 61hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
62gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
63HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
64
96b09a97
MY
65hostprogs-$(CONFIG_CMD_LOADS) += img2srec
66HOSTCFLAGS_img2srec.o := -pedantic
940db16d 67
96b09a97
MY
68hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
69HOSTCFLAGS_xway-swap-bytes.o := -pedantic
940db16d 70
96b09a97
MY
71hostprogs-y += mkenvimage
72mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
940db16d 73
96b09a97 74hostprogs-y += dumpimage mkimage
cb9faa6f 75hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fit_info fit_check_sign
940db16d 76
ac020196
HS
77hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include
78
cb9faa6f
AG
79FIT_OBJS-y := fit_common.o fit_image.o image-host.o common/image-fit.o
80FIT_SIG_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := image-sig-host.o common/image-fit-sig.o
81FIT_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
85LIBFDT_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 88RSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/rsa/, \
0bcb28df 89 rsa-sign.o rsa-verify.o \
fc2f4246 90 rsa-mod-exp.o)
940db16d 91
cb9faa6f 92ECDSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/ecdsa/, ecdsa-libcrypto.o)
ed6c9e0b 93
cb9faa6f 94AES_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 98LIBCRYPTO_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/, \
4c17e5f6
AG
99 fdt-libcrypto.o)
100
9b03701a 101ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
a131c1f4 102
940db16d
MY
103# common objs for dumpimage and mkimage
104dumpimage-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 \
940db16d
MY
116 imagetool.o \
117 imximage.o \
a2b96ece 118 imx8image.o \
6609c266 119 imx8mimage.o \
940db16d 120 kwbimage.o \
ad80c4a3 121 lib/md5.o \
39f520bb 122 lpc32xximage.o \
940db16d
MY
123 mxsimage.o \
124 omapimage.o \
125 os_support.o \
126 pblimage.o \
abbc67ee 127 pbl_crc32.o \
ed0c2c0a 128 vybridimage.o \
81260e33 129 stm32image.o \
a131c1f4 130 $(ROCKCHIP_OBS) \
832472a9 131 socfpgaimage.o \
6d295099 132 sunxi_egon.o \
51c2345b 133 lib/crc16.o \
0bcb28df 134 lib/hash-checksum.o \
ad80c4a3
MY
135 lib/sha1.o \
136 lib/sha256.o \
d16b38f4 137 lib/sha512.o \
2dd90027 138 common/hash.o \
940db16d 139 ublimage.o \
66eef1e7 140 zynqimage.o \
d9b58b30 141 zynqmpimage.o \
6915dcf3 142 zynqmpbif.o \
4c17e5f6 143 $(LIBCRYPTO_OBJS-y) \
940db16d 144 $(LIBFDT_OBJS) \
969cd1fa
SB
145 gpimage.o \
146 gpimage-common.o \
3b975a14 147 mtk_image.o \
ed6c9e0b 148 $(ECDSA_OBJS-y) \
7298e422
PR
149 $(RSA_OBJS-y) \
150 $(AES_OBJS-y)
940db16d 151
96b09a97
MY
152dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
153mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
154fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
155fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
ac020196 156file2include-objs := file2include.o
940db16d 157
cb9faa6f 158ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_TOOLS_LIBCRYPTO),)
940db16d
MY
159# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
160# the mxsimage support within tools/mxsimage.c .
6825a95b 161HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
940db16d
MY
162endif
163
cb9faa6f 164ifdef CONFIG_TOOLS_LIBCRYPTO
940db16d
MY
165# This affects include/image.h, but including the board config file
166# is tricky, so manually define this options here.
167HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE
cb9faa6f 168HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
7298e422
PR
169HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER
170endif
171
97cb4e54 172# MXSImage needs LibSSL
cb9faa6f 173ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO),)
9bdfe290
PB
174HOSTCFLAGS_kwbimage.o += \
175 $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
587e4a42 176HOSTLDLIBS_mkimage += \
4839836a 177 $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
c6e3e821
AB
178
179# OS X deprecate openssl in favour of CommonCrypto, supress deprecation
180# warnings on those systems
181ifeq ($(HOSTOS),darwin)
182HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
183HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
184HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
185endif
97cb4e54
MY
186endif
187
1f6049e2 188HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
47a52cd1 189
587e4a42
TR
190HOSTLDLIBS_dumpimage := $(HOSTLDLIBS_mkimage)
191HOSTLDLIBS_fit_info := $(HOSTLDLIBS_mkimage)
192HOSTLDLIBS_fit_check_sign := $(HOSTLDLIBS_mkimage)
97cb4e54 193
96b09a97
MY
194hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
195hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
196HOSTCFLAGS_mkexynosspl.o := -pedantic
940db16d 197
31eca697 198ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
cd392fe8
SG
199hostprogs-$(CONFIG_X86) += ifdtool
200
56bf4f86
SG
201ifwitool-objs := ifwitool.o
202hostprogs-$(CONFIG_X86)$(CONFIG_SANDBOX) += ifwitool
203
96b09a97
MY
204hostprogs-$(CONFIG_MX23) += mxsboot
205hostprogs-$(CONFIG_MX28) += mxsboot
206HOSTCFLAGS_mxsboot.o := -pedantic
940db16d 207
aec9a0f1 208hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
594b4cc7
MR
209hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
210sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
50827a59 211
96b09a97
MY
212hostprogs-$(CONFIG_NETCONSOLE) += ncb
213hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
940db16d 214
96b09a97 215ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
940db16d
MY
216
217HOSTCFLAGS_ubsha1.o := -pedantic
218
bb0fb4c0 219hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot
81e33f4b 220hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
96b09a97
MY
221hostprogs-y += proftool
222hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
42ac26f2 223hostprogs-$(CONFIG_RISCV) += prelink-riscv
ee3584a5 224
540a2bce
SR
225hostprogs-$(CONFIG_ARCH_OCTEON) += update_octeon_header
226update_octeon_header-objs := update_octeon_header.o lib/crc32.o
227
1043d0a0 228hostprogs-y += fdtgrep
3e69db12 229fdtgrep-objs += $(LIBFDT_OBJS) common/fdt_region.o fdtgrep.o
1043d0a0 230
2577015d
SG
231ifneq ($(TOOLS_ONLY),y)
232hostprogs-y += spl_size_limit
233endif
234
703ec9dd
PB
235hostprogs-$(CONFIG_MIPS) += mips-relocs
236
2b12196d
AT
237hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler
238HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include
239
322c813f 240mkeficapsule-objs := mkeficapsule.o $(LIBFDT_OBJS)
fab430be
AT
241hostprogs-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += mkeficapsule
242
940db16d
MY
243# We build some files with extra pedantic flags to try to minimize things
244# that won't build on some weird host compiler -- though there are lots of
245# exceptions for files that aren't complaint.
246HOSTCFLAGS_crc32.o := -pedantic
1d3c5392 247HOSTCFLAGS_crc8.o := -pedantic
940db16d
MY
248HOSTCFLAGS_md5.o := -pedantic
249HOSTCFLAGS_sha1.o := -pedantic
2842c1c2 250HOSTCFLAGS_sha256.o := -pedantic
d16b38f4 251HOSTCFLAGS_sha512.o := -pedantic -DCONFIG_SHA512 -DCONFIG_SHA384
940db16d 252
ad80c4a3 253quiet_cmd_wrap = WRAP $@
ffe29ebc 254cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
ad80c4a3 255
0649cd0d 256$(obj)/lib/%.c $(obj)/common/%.c $(obj)/env/%.c:
ad80c4a3
MY
257 $(call cmd,wrap)
258
259clean-dirs := lib common
260
940db16d 261always := $(hostprogs-y)
19c402af 262
335ffe7e 263# Generated LCD/video logo
9e414032
MY
264LOGO_H = $(objtree)/include/bmp_logo.h
265LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
335ffe7e 266LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
c270730f 267LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
335ffe7e 268LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
c270730f 269LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
ee3584a5 270
96903dae 271# Generic logo
ee3584a5 272ifeq ($(LOGO_BMP),)
9e414032 273LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
96903dae
OS
274
275# Use board logo and fallback to vendor
603f51cb 276ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
9e414032 277LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
96903dae 278else
603f51cb 279ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
9e414032 280LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
ee3584a5 281endif
348de314 282endif
ee3584a5 283
96903dae
OS
284endif # !LOGO_BMP
285
efee1709
WD
286#
287# Use native tools and options
2f8d396b 288# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
2db1c3fc 289# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
efee1709 290#
66228220 291HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \
51148790 292 $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
e0d20dc1 293 -I$(srctree)/scripts/dtc/libfdt \
01286329 294 -I$(srctree)/tools \
14d0a02a 295 -DUSE_HOSTCC \
2db1c3fc 296 -D__KERNEL_STRICT_NAMES \
d7edeba7
TP
297 -D_GNU_SOURCE \
298 -std=gnu99
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
305ifeq ($(CONFIG_DM_VIDEO),y)
306$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
307 $(obj)/bmp_logo --gen-bmp $(LOGO_BMP) > $@
308else
9e414032
MY
309$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
310 $(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
245b1029
HS
311#endif
312endif
2887c473
MY
313
314# Let clean descend into subdirs
315subdir- += env
db5b339c
MY
316
317ifneq ($(CROSS_BUILD_TOOLS),)
3b082529 318override HOSTCC = $(CC)
72c69ea8 319override HOSTCFLAGS = $(CFLAGS)
db5b339c
MY
320
321quiet_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
326always += .strip
327endif
328clean-files += .strip
This page took 0.60155 seconds and 4 git commands to generate.