blob: c12fbc6ad6019d24a7d6ab5bf59800411ba2fba0 [file] [log] [blame]
Daniel Allred635173a2016-05-19 19:10:45 -05001#
2# Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/
3#
4# SPDX-License-Identifier: GPL-2.0+
5#
Andrew F. Daviscc3615c2017-01-06 16:20:02 -06006quiet_cmd_mkomapsecimg = SECURE $@
Daniel Allred635173a2016-05-19 19:10:45 -05007ifneq ($(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 \
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050015 $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \
16 $(if $(KBUILD_VERBOSE:1=), >/dev/null)
Daniel Allred635173a2016-05-19 19:10:45 -050017endif
18else
19cmd_mkomapsecimg = echo "WARNING:" \
20 "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060021 "$@ was NOT secured!"; cp $< $@
Daniel Allred635173a2016-05-19 19:10:45 -050022endif
23else
24cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060025 "variable must be defined for TI secure devices. \
26 $@ was NOT secured!"; cp $< $@
Daniel Allred635173a2016-05-19 19:10:45 -050027endif
28
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050029ifdef 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." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060039 "$@ was NOT secured!"; cp $< $@
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050040endif
41else
42cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \
43 "variable must be defined for TI secure devices." \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060044 "$@ was NOT secured!"; cp $< $@
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050045endif
46endif
47
48
Daniel Allred635173a2016-05-19 19:10:45 -050049# Standard X-LOADER target (QPSI, NOR flash)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060050u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050051 $(call if_changed,mkomapsecimg)
52
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050053# 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
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060056u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050057 $(call if_changed,mkomapsecimg)
58 @if [ -f $@ ]; then \
59 cp -f $@ MLO; \
60 fi
61
62# Standard 2ND target (certain peripheral boot modes)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060063u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050064 $(call if_changed,mkomapsecimg)
65
66# Standard ULO target (certain peripheral boot modes)
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060067u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050068 $(call if_changed,mkomapsecimg)
69
Andrew F. Davis589300e2017-06-13 15:04:59 -050070# 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
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060073u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050074 $(call if_changed,mkomapsecimg)
Andrew F. Davis589300e2017-06-13 15:04:59 -050075 @if [ -f $@ ]; then \
76 cp -f $@ MLO; \
77 fi
Daniel Allred635173a2016-05-19 19:10:45 -050078
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050079# 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
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060082u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050083 $(call if_changed,mkomapsecimg)
84
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050085# 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
Andrew F. Davis589300e2017-06-13 15:04:59 -050087# flash. On Keystone devices when booting from an SD card FAT partition this
88# file must be called "MLO"
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050089u-boot_HS_MLO: $(obj)/u-boot.bin
90 $(call if_changed,mkomapsecimg)
Andrew F. Davis589300e2017-06-13 15:04:59 -050091 @if [ -f $@ ]; then \
92 cp -f $@ MLO; \
93 fi
Madan Srinivas5b3b7d12017-04-07 10:00:05 -050094
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -050095# 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
Andrew F. Daviscc3615c2017-01-06 16:20:02 -060098u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE
Daniel Allred635173a2016-05-19 19:10:45 -050099 $(call if_changed,mkomapsecimg)
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500100
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 \
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600109 $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500110
111OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
112$(OF_LIST_TARGETS): dtbs
113
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600114%.dtb_HS: %.dtb FORCE
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500115 $(call if_changed,omapsecureimg)
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500116
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600117u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE
Andreas Dannenbergf4dd7612016-06-27 09:19:20 -0500118 $(call if_changed,omapsecureimg)
119
Andrew F. Daviscc3615c2017-01-06 16:20:02 -0600120u-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 -0500121 $(call if_changed,mkimage)
122 $(Q)if [ -f $@ ]; then \
123 cp -f $@ u-boot.img; \
124 fi
125
126endif