blob: 40db1aec1425513cfdf635ec66cc71c5c0e015dc [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
Daniel Allred635173a2016-05-19 19:10:45 -05002#
Nishanth Menoneaa39c62023-11-01 15:56:03 -05003# Copyright (C) 2016, Texas Instruments, Incorporated - https://www.ti.com/
Andrew F. Daviscc3615c2017-01-06 16:20:02 -06004quiet_cmd_mkomapsecimg = SECURE $@
Daniel Allred635173a2016-05-19 19:10:45 -05005ifneq ($(TI_SECURE_DEV_PKG),)
6ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),)
7ifneq ($(CONFIG_SPL_BUILD),)
8cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
Andrew Davis06a021b2022-07-15 12:31:48 -05009 $(patsubst u-boot-spl_HS_%,%,$(@F)) $< $@ $(CONFIG_SPL_TEXT_BASE) \
Daniel Allred635173a2016-05-19 19:10:45 -050010 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
11else
12cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \
Simon Glass72cc5382022-10-20 18:22:39 -060013 $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_TEXT_BASE) \
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050014 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
Daniel Allred635173a2016-05-19 19:10:45 -050015endif
16else
17cmd_mkomapsecimg = echo "WARNING:" \
18 "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060019 "$@ was NOT secured!"; cp $< $@
Daniel Allred635173a2016-05-19 19:10:45 -050020endif
21else
22cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060023 "variable must be defined for TI secure devices. \
24 $@ was NOT secured!"; cp $< $@
Daniel Allred635173a2016-05-19 19:10:45 -050025endif
26
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050027ifdef CONFIG_SPL_LOAD_FIT
28quiet_cmd_omapsecureimg = SECURE $@
29ifneq ($(TI_SECURE_DEV_PKG),)
30ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),)
31cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \
32 $< $@ \
33 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
34else
35cmd_omapsecureimg = echo "WARNING:" \
36 "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060037 "$@ was NOT secured!"; cp $< $@
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050038endif
39else
40cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
41 "variable must be defined for TI secure devices." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060042 "$@ was NOT secured!"; cp $< $@
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050043endif
44endif
45
46
Daniel Allred635173a2016-05-19 19:10:45 -050047# Standard X-LOADER target (QPSI, NOR flash)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060048u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050049 $(call if_changed,mkomapsecimg)
50
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050051# For MLO targets (SD card boot) the final file name that is copied to the SD
52# card FAT partition must be MLO, so we make a copy of the output file to a new
53# file with that name
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060054u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050055 $(call if_changed,mkomapsecimg)
56 @if [ -f $@ ]; then \
57 cp -f $@ MLO; \
58 fi
59
60# Standard 2ND target (certain peripheral boot modes)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060061u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050062 $(call if_changed,mkomapsecimg)
63
64# Standard ULO target (certain peripheral boot modes)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060065u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050066 $(call if_changed,mkomapsecimg)
67
Andrew F. Davis589300e2017-06-13 15:04:59 -050068# Standard ISSW target (certain devices, various boot modes), when copied to
69# an SD card FAT partition this file must be called "MLO", we make a copy with
70# this name to make this clear
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060071u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050072 $(call if_changed,mkomapsecimg)
Andrew F. Davis589300e2017-06-13 15:04:59 -050073 @if [ -f $@ ]; then \
74 cp -f $@ MLO; \
75 fi
Daniel Allred635173a2016-05-19 19:10:45 -050076
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050077# For SPI flash on AM335x and AM43xx, these require special byte swap handling
78# so we use the SPI_X-LOADER target instead of X-LOADER and let the
79# create-boot-image.sh script handle that
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060080u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050081 $(call if_changed,mkomapsecimg)
82
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050083# For supporting single stage boot on keystone, the image is a full u-boot
84# file, not an SPL. This will work for all boot devices, other than SPI
Andrew F. Davis589300e2017-06-13 15:04:59 -050085# flash. On Keystone devices when booting from an SD card FAT partition this
86# file must be called "MLO"
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050087u-boot_HS_MLO: $(obj)/u-boot.bin
88 $(call if_changed,mkomapsecimg)
Andrew F. Davis589300e2017-06-13 15:04:59 -050089 @if [ -f $@ ]; then \
90 cp -f $@ MLO; \
91 fi
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050092
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050093# For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot
94# file, not an SPL. In this case the mkomapsecimg command looks for a
95# u-boot-HS_* prefix
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060096u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050097 $(call if_changed,mkomapsecimg)
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050098
99# For supporting the SPL loading and interpreting of FIT images whose
100# components are pre-processed before being integrated into the FIT image in
101# order to secure them in some way
102ifdef CONFIG_SPL_LOAD_FIT
103
104MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
Jesse Taube93ee5c82023-08-24 21:59:48 -0400105 -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500106 -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600107 $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500108
109OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
110$(OF_LIST_TARGETS): dtbs
111
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600112%.dtb_HS: %.dtb FORCE
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500113 $(call if_changed,omapsecureimg)
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500114
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600115u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500116 $(call if_changed,omapsecureimg)
117
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600118u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500119 $(call if_changed,mkimage)
120 $(Q)if [ -f $@ ]; then \
121 cp -f $@ u-boot.img; \
122 fi
123
124endif