xref: /rk3399_rockchip-uboot/arch/arm/mach-omap2/config_secure.mk (revision 88024dc5ac1c72c2f3977712d25315eada0ee4d9)
1983e3700STom Rini#
2983e3700STom Rini# Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/
3983e3700STom Rini#
4983e3700STom Rini# SPDX-License-Identifier:	GPL-2.0+
5983e3700STom Rini#
67410f146SAndrew F. Davisquiet_cmd_mkomapsecimg = SECURE  $@
7983e3700STom Riniifneq ($(TI_SECURE_DEV_PKG),)
8983e3700STom Riniifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),)
9983e3700STom Riniifneq ($(CONFIG_SPL_BUILD),)
10983e3700STom Rinicmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
11983e3700STom Rini	$(patsubst u-boot-spl_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
12983e3700STom Rini	$(if $(KBUILD_VERBOSE:1=), >/dev/null)
13983e3700STom Rinielse
14983e3700STom Rinicmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
15983e3700STom Rini	$(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
16983e3700STom Rini	$(if $(KBUILD_VERBOSE:1=), >/dev/null)
17983e3700STom Riniendif
18983e3700STom Rinielse
19983e3700STom Rinicmd_mkomapsecimg = echo "WARNING:" \
20983e3700STom Rini	"$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \
217410f146SAndrew F. Davis	"$@ was NOT secured!"; cp $< $@
22983e3700STom Riniendif
23983e3700STom Rinielse
24983e3700STom Rinicmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
257410f146SAndrew F. Davis	"variable must be defined for TI secure devices. \
267410f146SAndrew F. Davis	$@ was NOT secured!"; cp $< $@
27983e3700STom Riniendif
28983e3700STom Rini
29983e3700STom Riniifdef CONFIG_SPL_LOAD_FIT
30983e3700STom Riniquiet_cmd_omapsecureimg = SECURE  $@
31983e3700STom Riniifneq ($(TI_SECURE_DEV_PKG),)
32983e3700STom Riniifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),)
33983e3700STom Rinicmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \
34983e3700STom Rini	$< $@ \
35983e3700STom Rini	$(if $(KBUILD_VERBOSE:1=), >/dev/null)
36983e3700STom Rinielse
37983e3700STom Rinicmd_omapsecureimg = echo "WARNING:" \
38983e3700STom Rini	"$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \
397410f146SAndrew F. Davis	"$@ was NOT secured!"; cp $< $@
40983e3700STom Riniendif
41983e3700STom Rinielse
42983e3700STom Rinicmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
43983e3700STom Rini	"variable must be defined for TI secure devices." \
447410f146SAndrew F. Davis	"$@ was NOT secured!"; cp $< $@
45983e3700STom Riniendif
46983e3700STom Riniendif
47983e3700STom Rini
48983e3700STom Rini
49983e3700STom Rini# Standard X-LOADER target (QPSI, NOR flash)
507410f146SAndrew F. Davisu-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE
51983e3700STom Rini	$(call if_changed,mkomapsecimg)
52983e3700STom Rini
53983e3700STom Rini# For MLO targets (SD card boot) the final file name that is copied to the SD
54983e3700STom Rini# card FAT partition must be MLO, so we make a copy of the output file to a new
55983e3700STom Rini# file with that name
567410f146SAndrew F. Davisu-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE
57983e3700STom Rini	$(call if_changed,mkomapsecimg)
58983e3700STom Rini	@if [ -f $@ ]; then \
59983e3700STom Rini		cp -f $@ MLO; \
60983e3700STom Rini	fi
61983e3700STom Rini
62983e3700STom Rini# Standard 2ND target (certain peripheral boot modes)
637410f146SAndrew F. Davisu-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE
64983e3700STom Rini	$(call if_changed,mkomapsecimg)
65983e3700STom Rini
66983e3700STom Rini# Standard ULO target (certain peripheral boot modes)
677410f146SAndrew F. Davisu-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE
68983e3700STom Rini	$(call if_changed,mkomapsecimg)
69983e3700STom Rini
70*88024dc5SAndrew F. Davis# Standard ISSW target (certain devices, various boot modes), when copied to
71*88024dc5SAndrew F. Davis# an SD card FAT partition this file must be called "MLO", we make a copy with
72*88024dc5SAndrew F. Davis# this name to make this clear
737410f146SAndrew F. Davisu-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE
74983e3700STom Rini	$(call if_changed,mkomapsecimg)
75*88024dc5SAndrew F. Davis	@if [ -f $@ ]; then \
76*88024dc5SAndrew F. Davis		cp -f $@ MLO; \
77*88024dc5SAndrew F. Davis	fi
78983e3700STom Rini
79983e3700STom Rini# For SPI flash on AM335x and AM43xx, these require special byte swap handling
80983e3700STom Rini# so we use the SPI_X-LOADER target instead of X-LOADER and let the
81983e3700STom Rini# create-boot-image.sh script handle that
827410f146SAndrew F. Davisu-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE
83983e3700STom Rini	$(call if_changed,mkomapsecimg)
84983e3700STom Rini
8539dd0f6fSMadan Srinivas# For supporting single stage boot on keystone, the image is a full u-boot
8639dd0f6fSMadan Srinivas# file, not an SPL. This will work for all boot devices, other than SPI
87*88024dc5SAndrew F. Davis# flash. On Keystone devices when booting from an SD card FAT partition this
88*88024dc5SAndrew F. Davis# file must be called "MLO"
8939dd0f6fSMadan Srinivasu-boot_HS_MLO: $(obj)/u-boot.bin
9039dd0f6fSMadan Srinivas	$(call if_changed,mkomapsecimg)
91*88024dc5SAndrew F. Davis	@if [ -f $@ ]; then \
92*88024dc5SAndrew F. Davis		cp -f $@ MLO; \
93*88024dc5SAndrew F. Davis	fi
9439dd0f6fSMadan Srinivas
95983e3700STom Rini# For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot
96983e3700STom Rini# file, not an SPL. In this case the mkomapsecimg command looks for a
97983e3700STom Rini# u-boot-HS_* prefix
987410f146SAndrew F. Davisu-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE
99983e3700STom Rini	$(call if_changed,mkomapsecimg)
100983e3700STom Rini
101983e3700STom Rini# For supporting the SPL loading and interpreting of FIT images whose
102983e3700STom Rini# components are pre-processed before being integrated into the FIT image in
103983e3700STom Rini# order to secure them in some way
104983e3700STom Riniifdef CONFIG_SPL_LOAD_FIT
105983e3700STom Rini
106983e3700STom RiniMKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
107983e3700STom Rini	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
108983e3700STom Rini	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
1097410f146SAndrew F. Davis	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
110983e3700STom Rini
111983e3700STom RiniOF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
112983e3700STom Rini$(OF_LIST_TARGETS): dtbs
113983e3700STom Rini
1147410f146SAndrew F. Davis%.dtb_HS: %.dtb FORCE
115983e3700STom Rini	$(call if_changed,omapsecureimg)
116983e3700STom Rini
1177410f146SAndrew F. Davisu-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE
1187410f146SAndrew F. Davis	$(call if_changed,omapsecureimg)
1197410f146SAndrew F. Davis
1207410f146SAndrew F. Davisu-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
121983e3700STom Rini	$(call if_changed,mkimage)
122983e3700STom Rini	$(Q)if [ -f $@ ]; then \
123983e3700STom Rini		cp -f $@ u-boot.img; \
124983e3700STom Rini	fi
125983e3700STom Rini
126983e3700STom Riniendif
127