1# SPDX-License-Identifier: GPL-2.0
2#
3# Copyright (C) 2018 Texas Instruments, Incorporated - http://www.ti.com/
4#	Andrew F. Davis <afd@ti.com>
5
6quiet_cmd_k3secureimg = SECURE  $@
7ifneq ($(TI_SECURE_DEV_PKG),)
8ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),)
9cmd_k3secureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \
10	$< $@ \
11	$(if $(KBUILD_VERBOSE:1=), >/dev/null)
12else
13cmd_k3secureimg = echo "WARNING:" \
14	"$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \
15	"$@ was NOT secured!"; cp $< $@
16endif
17else
18cmd_k3secureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
19	"variable must be defined for TI secure devices." \
20	"$@ was NOT secured!"; cp $< $@
21endif
22
23%.dtb_HS: %.dtb FORCE
24	$(call if_changed,k3secureimg)
25
26$(obj)/u-boot-spl-nodtb.bin_HS: $(obj)/u-boot-spl-nodtb.bin FORCE
27	$(call if_changed,k3secureimg)
28
29tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST))) $(SPL_ITS) FORCE
30	$(call if_changed,mkfitimage)
31
32MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
33	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
34	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
35	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
36
37OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
38$(OF_LIST_TARGETS): dtbs
39
40u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE
41	$(call if_changed,k3secureimg)
42
43u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
44	$(call if_changed,mkimage)
45