]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/arm/mach-omap2/config_secure.mk
arm: mach-omap2: Generate MLO file from SD boot capable targets
[people/ms/u-boot.git] / arch / arm / mach-omap2 / config_secure.mk
CommitLineData
0a0c534b
DA
1#
2# Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/
3#
4# SPDX-License-Identifier: GPL-2.0+
5#
7410f146 6quiet_cmd_mkomapsecimg = SECURE $@
0a0c534b
DA
7ifneq ($(TI_SECURE_DEV_PKG),)
8ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),)
9ifneq ($(CONFIG_SPL_BUILD),)
10cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
11 $(patsubst u-boot-spl_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
12 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
13else
14cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
bf9ec864
AD
15 $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
16 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
0a0c534b
DA
17endif
18else
19cmd_mkomapsecimg = echo "WARNING:" \
20 "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \
7410f146 21 "$@ was NOT secured!"; cp $< $@
0a0c534b
DA
22endif
23else
24cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
7410f146
AD
25 "variable must be defined for TI secure devices. \
26 $@ was NOT secured!"; cp $< $@
0a0c534b
DA
27endif
28
bf9ec864
AD
29ifdef CONFIG_SPL_LOAD_FIT
30quiet_cmd_omapsecureimg = SECURE $@
31ifneq ($(TI_SECURE_DEV_PKG),)
32ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),)
33cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \
34 $< $@ \
35 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
36else
37cmd_omapsecureimg = echo "WARNING:" \
38 "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \
7410f146 39 "$@ was NOT secured!"; cp $< $@
bf9ec864
AD
40endif
41else
42cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
43 "variable must be defined for TI secure devices." \
7410f146 44 "$@ was NOT secured!"; cp $< $@
bf9ec864
AD
45endif
46endif
47
48
0a0c534b 49# Standard X-LOADER target (QPSI, NOR flash)
7410f146 50u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE
0a0c534b
DA
51 $(call if_changed,mkomapsecimg)
52
bf9ec864
AD
53# For MLO targets (SD card boot) the final file name that is copied to the SD
54# card FAT partition must be MLO, so we make a copy of the output file to a new
55# file with that name
7410f146 56u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE
0a0c534b
DA
57 $(call if_changed,mkomapsecimg)
58 @if [ -f $@ ]; then \
59 cp -f $@ MLO; \
60 fi
61
62# Standard 2ND target (certain peripheral boot modes)
7410f146 63u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE
0a0c534b
DA
64 $(call if_changed,mkomapsecimg)
65
66# Standard ULO target (certain peripheral boot modes)
7410f146 67u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE
0a0c534b
DA
68 $(call if_changed,mkomapsecimg)
69
88024dc5
AD
70# Standard ISSW target (certain devices, various boot modes), when copied to
71# an SD card FAT partition this file must be called "MLO", we make a copy with
72# this name to make this clear
7410f146 73u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE
0a0c534b 74 $(call if_changed,mkomapsecimg)
88024dc5
AD
75 @if [ -f $@ ]; then \
76 cp -f $@ MLO; \
77 fi
0a0c534b 78
bf9ec864
AD
79# For SPI flash on AM335x and AM43xx, these require special byte swap handling
80# so we use the SPI_X-LOADER target instead of X-LOADER and let the
81# create-boot-image.sh script handle that
7410f146 82u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE
0a0c534b
DA
83 $(call if_changed,mkomapsecimg)
84
39dd0f6f
MS
85# For supporting single stage boot on keystone, the image is a full u-boot
86# file, not an SPL. This will work for all boot devices, other than SPI
88024dc5
AD
87# flash. On Keystone devices when booting from an SD card FAT partition this
88# file must be called "MLO"
39dd0f6f
MS
89u-boot_HS_MLO: $(obj)/u-boot.bin
90 $(call if_changed,mkomapsecimg)
88024dc5
AD
91 @if [ -f $@ ]; then \
92 cp -f $@ MLO; \
93 fi
39dd0f6f 94
bf9ec864
AD
95# For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot
96# file, not an SPL. In this case the mkomapsecimg command looks for a
97# u-boot-HS_* prefix
7410f146 98u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE
0a0c534b 99 $(call if_changed,mkomapsecimg)
bf9ec864
AD
100
101# For supporting the SPL loading and interpreting of FIT images whose
102# components are pre-processed before being integrated into the FIT image in
103# order to secure them in some way
104ifdef CONFIG_SPL_LOAD_FIT
105
106MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
107 -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
108 -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
7410f146 109 $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
bf9ec864
AD
110
111OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
112$(OF_LIST_TARGETS): dtbs
113
7410f146 114%.dtb_HS: %.dtb FORCE
bf9ec864 115 $(call if_changed,omapsecureimg)
bf9ec864 116
7410f146 117u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE
bf9ec864
AD
118 $(call if_changed,omapsecureimg)
119
7410f146 120u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
bf9ec864
AD
121 $(call if_changed,mkimage)
122 $(Q)if [ -f $@ ]; then \
123 cp -f $@ u-boot.img; \
124 fi
125
126endif