]> Git Repo - J-u-boot.git/blame - tools/Makefile
tools: kwbimage: Set BOOT_FROM by default to SPI
[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 \
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
153dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
154mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
155fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
156fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
ac020196 157file2include-objs := file2include.o
940db16d 158
cb9faa6f 159ifneq ($(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 162HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
940db16d
MY
163endif
164
cb9faa6f 165ifdef 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.
168HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE
cb9faa6f 169HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
7298e422
PR
170HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER
171endif
172
97cb4e54 173# MXSImage needs LibSSL
cb9faa6f 174ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO),)
9bdfe290
PB
175HOSTCFLAGS_kwbimage.o += \
176 $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
587e4a42 177HOSTLDLIBS_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
182ifeq ($(HOSTOS),darwin)
183HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
184HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
185HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
186endif
97cb4e54
MY
187endif
188
1f6049e2 189HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
47a52cd1 190
587e4a42
TR
191HOSTLDLIBS_dumpimage := $(HOSTLDLIBS_mkimage)
192HOSTLDLIBS_fit_info := $(HOSTLDLIBS_mkimage)
193HOSTLDLIBS_fit_check_sign := $(HOSTLDLIBS_mkimage)
97cb4e54 194
96b09a97
MY
195hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
196hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
197HOSTCFLAGS_mkexynosspl.o := -pedantic
940db16d 198
31eca697 199ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
cd392fe8
SG
200hostprogs-$(CONFIG_X86) += ifdtool
201
56bf4f86
SG
202ifwitool-objs := ifwitool.o
203hostprogs-$(CONFIG_X86)$(CONFIG_SANDBOX) += ifwitool
204
96b09a97
MY
205hostprogs-$(CONFIG_MX23) += mxsboot
206hostprogs-$(CONFIG_MX28) += mxsboot
207HOSTCFLAGS_mxsboot.o := -pedantic
940db16d 208
aec9a0f1 209hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
594b4cc7
MR
210hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
211sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
50827a59 212
96b09a97
MY
213hostprogs-$(CONFIG_NETCONSOLE) += ncb
214hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
940db16d 215
96b09a97 216ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
940db16d
MY
217
218HOSTCFLAGS_ubsha1.o := -pedantic
219
bb0fb4c0 220hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot
81e33f4b 221hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
96b09a97
MY
222hostprogs-y += proftool
223hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
42ac26f2 224hostprogs-$(CONFIG_RISCV) += prelink-riscv
ee3584a5 225
540a2bce
SR
226hostprogs-$(CONFIG_ARCH_OCTEON) += update_octeon_header
227update_octeon_header-objs := update_octeon_header.o lib/crc32.o
228
1043d0a0 229hostprogs-y += fdtgrep
3e69db12 230fdtgrep-objs += $(LIBFDT_OBJS) common/fdt_region.o fdtgrep.o
1043d0a0 231
2577015d
SG
232ifneq ($(TOOLS_ONLY),y)
233hostprogs-y += spl_size_limit
234endif
235
703ec9dd
PB
236hostprogs-$(CONFIG_MIPS) += mips-relocs
237
2b12196d
AT
238hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler
239HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include
240
322c813f 241mkeficapsule-objs := mkeficapsule.o $(LIBFDT_OBJS)
fab430be
AT
242hostprogs-$(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.
247HOSTCFLAGS_crc32.o := -pedantic
1d3c5392 248HOSTCFLAGS_crc8.o := -pedantic
940db16d
MY
249HOSTCFLAGS_md5.o := -pedantic
250HOSTCFLAGS_sha1.o := -pedantic
2842c1c2 251HOSTCFLAGS_sha256.o := -pedantic
d16b38f4 252HOSTCFLAGS_sha512.o := -pedantic -DCONFIG_SHA512 -DCONFIG_SHA384
940db16d 253
ad80c4a3 254quiet_cmd_wrap = WRAP $@
ffe29ebc 255cmd_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
260clean-dirs := lib common
261
940db16d 262always := $(hostprogs-y)
19c402af 263
335ffe7e 264# Generated LCD/video logo
9e414032
MY
265LOGO_H = $(objtree)/include/bmp_logo.h
266LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
335ffe7e 267LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
c270730f 268LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
335ffe7e 269LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
c270730f 270LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
ee3584a5 271
96903dae 272# Generic logo
ee3584a5 273ifeq ($(LOGO_BMP),)
9e414032 274LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
96903dae
OS
275
276# Use board logo and fallback to vendor
603f51cb 277ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
9e414032 278LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
96903dae 279else
603f51cb 280ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
9e414032 281LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
ee3584a5 282endif
348de314 283endif
ee3584a5 284
96903dae
OS
285endif # !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 292HOST_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
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.604141 seconds and 4 git commands to generate.