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