Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2016, Texas Instruments, Incorporated - http://www.ti.com/ |
| 3 | # |
| 4 | # SPDX-License-Identifier: GPL-2.0+ |
| 5 | # |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 6 | quiet_cmd_mkomapsecimg = SECURE $@ |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 7 | ifneq ($(TI_SECURE_DEV_PKG),) |
| 8 | ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh),) |
| 9 | ifneq ($(CONFIG_SPL_BUILD),) |
| 10 | cmd_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) |
| 13 | else |
| 14 | cmd_mkomapsecimg = $(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh \ |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 15 | $(patsubst u-boot_HS_%,%,$(@F)) $< $@ $(CONFIG_ISW_ENTRY_ADDR) \ |
| 16 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 17 | endif |
| 18 | else |
| 19 | cmd_mkomapsecimg = echo "WARNING:" \ |
| 20 | "$(TI_SECURE_DEV_PKG)/scripts/create-boot-image.sh not found." \ |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 21 | "$@ was NOT secured!"; cp $< $@ |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 22 | endif |
| 23 | else |
| 24 | cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 25 | "variable must be defined for TI secure devices. \ |
| 26 | $@ was NOT secured!"; cp $< $@ |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 27 | endif |
| 28 | |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 29 | ifdef CONFIG_SPL_LOAD_FIT |
| 30 | quiet_cmd_omapsecureimg = SECURE $@ |
| 31 | ifneq ($(TI_SECURE_DEV_PKG),) |
| 32 | ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),) |
| 33 | cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \ |
| 34 | $< $@ \ |
| 35 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
| 36 | else |
| 37 | cmd_omapsecureimg = echo "WARNING:" \ |
| 38 | "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \ |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 39 | "$@ was NOT secured!"; cp $< $@ |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 40 | endif |
| 41 | else |
| 42 | cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
| 43 | "variable must be defined for TI secure devices." \ |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 44 | "$@ was NOT secured!"; cp $< $@ |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 45 | endif |
| 46 | endif |
| 47 | |
| 48 | |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 49 | # Standard X-LOADER target (QPSI, NOR flash) |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 50 | u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 51 | $(call if_changed,mkomapsecimg) |
| 52 | |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 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 |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 56 | u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 57 | $(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. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 63 | u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 64 | $(call if_changed,mkomapsecimg) |
| 65 | |
| 66 | # Standard ULO target (certain peripheral boot modes) |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 67 | u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 68 | $(call if_changed,mkomapsecimg) |
| 69 | |
| 70 | # Standard ISSW target (certain devices, various boot modes) |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 71 | u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 72 | $(call if_changed,mkomapsecimg) |
| 73 | |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 74 | # For SPI flash on AM335x and AM43xx, these require special byte swap handling |
| 75 | # so we use the SPI_X-LOADER target instead of X-LOADER and let the |
| 76 | # create-boot-image.sh script handle that |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 77 | u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 78 | $(call if_changed,mkomapsecimg) |
| 79 | |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 80 | # For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot |
| 81 | # file, not an SPL. In this case the mkomapsecimg command looks for a |
| 82 | # u-boot-HS_* prefix |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 83 | u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin FORCE |
Daniel Allred | 0a0c534 | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 84 | $(call if_changed,mkomapsecimg) |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 85 | |
| 86 | # For supporting the SPL loading and interpreting of FIT images whose |
| 87 | # components are pre-processed before being integrated into the FIT image in |
| 88 | # order to secure them in some way |
| 89 | ifdef CONFIG_SPL_LOAD_FIT |
| 90 | |
| 91 | MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ |
| 92 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
| 93 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 94 | $(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST))) |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 95 | |
| 96 | OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) |
| 97 | $(OF_LIST_TARGETS): dtbs |
| 98 | |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 99 | %.dtb_HS: %.dtb FORCE |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 100 | $(call if_changed,omapsecureimg) |
| 101 | |
Andrew F. Davis | 7410f14 | 2017-01-06 16:20:02 -0600 | [diff] [blame] | 102 | u-boot-nodtb_HS.bin: u-boot-nodtb.bin FORCE |
| 103 | $(call if_changed,omapsecureimg) |
| 104 | |
| 105 | u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE |
Andreas Dannenberg | bf9ec86 | 2016-06-27 09:19:20 -0500 | [diff] [blame] | 106 | $(call if_changed,mkimage) |
| 107 | $(Q)if [ -f $@ ]; then \ |
| 108 | cp -f $@ u-boot.img; \ |
| 109 | fi |
| 110 | |
| 111 | endif |