Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 4 | quiet_cmd_mkomapsecimg = SECURE $@ |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 5 | ifneq ($(TI_SECURE_DEV_PKG),) |
| 6 | ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),) |
| 7 | ifneq ($(CONFIG_SPL_BUILD),) |
| 8 | cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \ |
Andrew Davis | 06a021b | 2022-07-15 12:31:48 -0500 | [diff] [blame] | 9 | $(patsubst u-boot-spl_HS_%,%,$(@F)) $< $@ $(CONFIG_SPL_TEXT_BASE) \ |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 10 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
| 11 | else |
| 12 | cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \ |
Simon Glass | 72cc538 | 2022-10-20 18:22:39 -0600 | [diff] [blame] | 13 | $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_TEXT_BASE) \ |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 14 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 15 | endif |
| 16 | else |
| 17 | cmd_mkomapsecimg = echo "WARNING:" \ |
| 18 | "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 19 | "$@ was NOT secured!"; cp $< $@ |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 20 | endif |
| 21 | else |
| 22 | cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 23 | "variable must be defined for TI secure devices. \ |
| 24 | $@ was NOT secured!"; cp $< $@ |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 25 | endif |
| 26 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 27 | ifdef CONFIG_SPL_LOAD_FIT |
| 28 | quiet_cmd_omapsecureimg = SECURE $@ |
| 29 | ifneq ($(TI_SECURE_DEV_PKG),) |
| 30 | ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),) |
| 31 | cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \ |
| 32 | $< $@ \ |
| 33 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
| 34 | else |
| 35 | cmd_omapsecureimg = echo "WARNING:" \ |
| 36 | "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 37 | "$@ was NOT secured!"; cp $< $@ |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 38 | endif |
| 39 | else |
| 40 | cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
| 41 | "variable must be defined for TI secure devices." \ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 42 | "$@ was NOT secured!"; cp $< $@ |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 43 | endif |
| 44 | endif |
| 45 | |
| 46 | |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 47 | # Standard X-LOADER target (QPSI, NOR flash) |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 48 | u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 49 | $(call if_changed,mkomapsecimg) |
| 50 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 51 | # 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. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 54 | u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 55 | $(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. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 61 | u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 62 | $(call if_changed,mkomapsecimg) |
| 63 | |
| 64 | # Standard ULO target (certain peripheral boot modes) |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 65 | u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 66 | $(call if_changed,mkomapsecimg) |
| 67 | |
Andrew F. Davis | 589300e | 2017-06-13 15:04:59 -0500 | [diff] [blame] | 68 | # 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. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 71 | u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 72 | $(call if_changed,mkomapsecimg) |
Andrew F. Davis | 589300e | 2017-06-13 15:04:59 -0500 | [diff] [blame] | 73 | @if [ -f $@ ]; then \ |
| 74 | cp -f $@ MLO; \ |
| 75 | fi |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 76 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 77 | # 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. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 80 | u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 81 | $(call if_changed,mkomapsecimg) |
| 82 | |
Madan Srinivas | 5b3b7d1 | 2017-04-07 10:00:05 -0500 | [diff] [blame] | 83 | # 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. Davis | 589300e | 2017-06-13 15:04:59 -0500 | [diff] [blame] | 85 | # flash. On Keystone devices when booting from an SD card FAT partition this |
| 86 | # file must be called "MLO" |
Madan Srinivas | 5b3b7d1 | 2017-04-07 10:00:05 -0500 | [diff] [blame] | 87 | u-boot_HS_MLO: $(obj)/u-boot.bin |
| 88 | $(call if_changed,mkomapsecimg) |
Andrew F. Davis | 589300e | 2017-06-13 15:04:59 -0500 | [diff] [blame] | 89 | @if [ -f $@ ]; then \ |
| 90 | cp -f $@ MLO; \ |
| 91 | fi |
Madan Srinivas | 5b3b7d1 | 2017-04-07 10:00:05 -0500 | [diff] [blame] | 92 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 93 | # 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. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 96 | u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 97 | $(call if_changed,mkomapsecimg) |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 98 | |
| 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 |
| 102 | ifdef CONFIG_SPL_LOAD_FIT |
| 103 | |
| 104 | MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 105 | -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \ |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 106 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 107 | $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST))) |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 108 | |
| 109 | OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) |
| 110 | $(OF_LIST_TARGETS): dtbs |
| 111 | |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 112 | %.dtb_HS: %.dtb FORCE |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 113 | $(call if_changed,omapsecureimg) |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 114 | |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 115 | u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 116 | $(call if_changed,omapsecureimg) |
| 117 | |
Andrew F. Davis | cc3615c | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 118 | u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 119 | $(call if_changed,mkimage) |
| 120 | $(Q)if [ -f $@ ]; then \ |
| 121 | cp -f $@ u-boot.img; \ |
| 122 | fi |
| 123 | |
| 124 | endif |