Makefile 7.8 KB
Newer Older
W
wdenk 已提交
1
#
2
# (C) Copyright 2000-2006
W
wdenk 已提交
3 4
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
5
# SPDX-License-Identifier:	GPL-2.0+
W
wdenk 已提交
6 7
#

8 9 10
# Enable all the config-independent tools
ifneq ($(HOST_TOOLS_ALL),)
CONFIG_LCD_LOGO = y
11
CONFIG_CMD_LOADS = y
12
CONFIG_CMD_NET = y
13
CONFIG_XWAY_SWAP_BYTES = y
14 15
CONFIG_NETCONSOLE = y
CONFIG_SHA1_CHECK_UB_IMG = y
16
CONFIG_ARCH_SUNXI = y
17 18
endif

19 20 21
subdir-$(HOST_TOOLS_ALL) += easylogo
subdir-$(HOST_TOOLS_ALL) += gdb

22 23 24 25 26 27 28 29 30 31
# Merge all the different vars for envcrc into one
ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)

32
hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
33

34 35 36
hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo
hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
HOSTCFLAGS_bmp_logo.o := -pedantic
37

38
hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc
39
envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
40

41 42
hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
HOSTCFLAGS_gen_eth_addr.o := -pedantic
43

44 45 46 47
hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic

48 49
hostprogs-$(CONFIG_CMD_LOADS) += img2srec
HOSTCFLAGS_img2srec.o := -pedantic
50

51 52
hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes
HOSTCFLAGS_xway-swap-bytes.o := -pedantic
53

54 55
hostprogs-y += mkenvimage
mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
56

57 58
hostprogs-y += dumpimage mkimage
hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
59

60 61
hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include

62
FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
63

64 65
# The following files are synced with upstream DTC.
# Use synced versions from scripts/dtc/libfdt/.
66
LIBFDT_SRCS_SYNCED := fdt.c fdt_wip.c fdt_sw.c fdt_strerror.c fdt_empty_tree.c \
67 68 69
		      fdt_addresses.c fdt_overlay.c
# The following files are locally modified for U-Boot (unfotunately).
# Use U-Boot own versions from lib/libfdt/.
70
LIBFDT_SRCS_UNSYNCED := fdt_ro.c fdt_rw.c fdt_region.c
71 72 73

LIBFDT_OBJS := $(addprefix libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_SYNCED))) \
	       $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_SRCS_UNSYNCED)))
74

75
RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
76 77
					rsa-sign.o rsa-verify.o rsa-checksum.o \
					rsa-mod-exp.o)
78

79
ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
80

81 82
# common objs for dumpimage and mkimage
dumpimage-mkimage-objs := aisimage.o \
A
Andreas Bießmann 已提交
83
			atmelimage.o \
84
			$(FIT_SIG_OBJS-y) \
85
			common/bootm.o \
86
			lib/crc32.o \
87
			default_image.o \
88
			lib/fdtdec_common.o \
89
			lib/fdtdec.o \
90
			fit_common.o \
91
			fit_image.o \
92
			common/image-fit.o \
93
			image-host.o \
94
			common/image.o \
95 96 97
			imagetool.o \
			imximage.o \
			kwbimage.o \
98
			lib/md5.o \
99
			lpc32xximage.o \
100 101 102 103
			mxsimage.o \
			omapimage.o \
			os_support.o \
			pblimage.o \
104
			pbl_crc32.o \
105
			vybridimage.o \
106
			$(ROCKCHIP_OBS) \
107
			socfpgaimage.o \
108 109
			lib/sha1.o \
			lib/sha256.o \
R
Ruchika Gupta 已提交
110
			common/hash.o \
111
			ublimage.o \
112
			zynqimage.o \
113
			zynqmpimage.o \
114
			$(LIBFDT_OBJS) \
115 116
			gpimage.o \
			gpimage-common.o \
117 118
			$(RSA_OBJS-y)

119 120 121 122
dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
123
file2include-objs := file2include.o
124 125 126 127

ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
# the mxsimage support within tools/mxsimage.c .
128
HOSTCFLAGS_mxsimage.o += -DCONFIG_MXS
129 130 131 132 133 134 135 136
endif

ifdef CONFIG_FIT_SIGNATURE
# This affects include/image.h, but including the board config file
# is tricky, so manually define this options here.
HOST_EXTRACFLAGS	+= -DCONFIG_FIT_SIGNATURE
endif

137 138
ifdef CONFIG_SYS_U_BOOT_OFFS
HOSTCFLAGS_kwbimage.o += -DCONFIG_SYS_U_BOOT_OFFS=$(CONFIG_SYS_U_BOOT_OFFS)
139 140
endif

M
Mario Six 已提交
141 142 143 144
ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
endif

145
# MXSImage needs LibSSL
M
Mario Six 已提交
146
ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
147 148
HOSTLOADLIBES_mkimage += \
	$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
149 150 151 152 153 154 155 156

# OS X deprecate openssl in favour of CommonCrypto, supress deprecation
# warnings on those systems
ifeq ($(HOSTOS),darwin)
HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
endif
157 158
endif

159
HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
160

161 162 163
HOSTLOADLIBES_dumpimage := $(HOSTLOADLIBES_mkimage)
HOSTLOADLIBES_fit_info := $(HOSTLOADLIBES_mkimage)
HOSTLOADLIBES_fit_check_sign := $(HOSTLOADLIBES_mkimage)
164

165 166 167
hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
HOSTCFLAGS_mkexynosspl.o := -pedantic
168

169
ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
170 171
hostprogs-$(CONFIG_X86) += ifdtool

172 173 174
hostprogs-$(CONFIG_MX23) += mxsboot
hostprogs-$(CONFIG_MX28) += mxsboot
HOSTCFLAGS_mxsboot.o := -pedantic
175

176
hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
177 178
hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
179

180 181
hostprogs-$(CONFIG_NETCONSOLE) += ncb
hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1
182

183
ubsha1-objs := os_support.o ubsha1.o lib/sha1.o
184 185 186

HOSTCFLAGS_ubsha1.o := -pedantic

187
hostprogs-$(CONFIG_KIRKWOOD) += kwboot
188
hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
189 190
hostprogs-y += proftool
hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
R
Rick Chen 已提交
191
hostprogs-$(CONFIG_RISCV) += prelink-riscv
192

S
Simon Glass 已提交
193 194 195
hostprogs-y += fdtgrep
fdtgrep-objs += $(LIBFDT_OBJS) fdtgrep.o

196 197
hostprogs-$(CONFIG_MIPS) += mips-relocs

198 199 200 201
# We build some files with extra pedantic flags to try to minimize things
# that won't build on some weird host compiler -- though there are lots of
# exceptions for files that aren't complaint.
HOSTCFLAGS_crc32.o := -pedantic
202
HOSTCFLAGS_crc8.o := -pedantic
203 204
HOSTCFLAGS_md5.o := -pedantic
HOSTCFLAGS_sha1.o := -pedantic
H
Heiko Schocher 已提交
205
HOSTCFLAGS_sha256.o := -pedantic
206

207
quiet_cmd_wrap = WRAP    $@
208
cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
209

210
$(obj)/lib/%.c $(obj)/common/%.c $(obj)/env/%.c:
211 212 213 214
	$(call cmd,wrap)

clean-dirs := lib common

215
always := $(hostprogs-y)
216

217
# Generated LCD/video logo
218 219
LOGO_H = $(objtree)/include/bmp_logo.h
LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
220
LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
221
LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H)
222
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
223
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
224

225
# Generic logo
226
ifeq ($(LOGO_BMP),)
227
LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
228 229

# Use board logo and fallback to vendor
230
ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
231
LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
232
else
233
ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
234
LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
235
endif
236
endif
237

238 239
endif # !LOGO_BMP

W
wdenk 已提交
240 241
#
# Use native tools and options
242
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
243
# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
W
wdenk 已提交
244
#
245
HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \
M
Masahiro Yamada 已提交
246
		$(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
247 248
		-I$(srctree)/lib/libfdt \
		-I$(srctree)/tools \
249
		-DUSE_HOSTCC \
250 251
		-D__KERNEL_STRICT_NAMES \
		-D_GNU_SOURCE
252

M
Masahiro Yamada 已提交
253
__build:	$(LOGO-y)
W
wdenk 已提交
254

255 256
$(LOGO_H):	$(obj)/bmp_logo $(LOGO_BMP)
	$(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
257

258 259
$(LOGO_DATA_H):	$(obj)/bmp_logo $(LOGO_BMP)
	$(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
260 261 262

# Let clean descend into subdirs
subdir- += env
263 264

ifneq ($(CROSS_BUILD_TOOLS),)
265
override HOSTCC = $(CC)
266 267 268 269 270 271 272 273 274

quiet_cmd_crosstools_strip = STRIP   $^
      cmd_crosstools_strip = $(STRIP) $^; touch $@
$(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y)))
	$(call cmd,crosstools_strip)

always += .strip
endif
clean-files += .strip