Daniel Allred | 635173a | 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 | # |
| 6 | quiet_cmd_mkomapsecimg = MKIMAGE $@ |
| 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 | f4dd761 | 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 | 635173a | 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." \ |
| 21 | "$@ was NOT created!" |
| 22 | endif |
| 23 | else |
| 24 | cmd_mkomapsecimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
| 25 | "variable must be defined for TI secure devices. $@ was NOT created!" |
| 26 | endif |
| 27 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame^] | 28 | ifdef CONFIG_SPL_LOAD_FIT |
| 29 | quiet_cmd_omapsecureimg = SECURE $@ |
| 30 | ifneq ($(TI_SECURE_DEV_PKG),) |
| 31 | ifneq ($(wildcard $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh),) |
| 32 | cmd_omapsecureimg = $(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh \ |
| 33 | $< $@ \ |
| 34 | $(if $(KBUILD_VERBOSE:1=), >/dev/null) |
| 35 | else |
| 36 | cmd_omapsecureimg = echo "WARNING:" \ |
| 37 | "$(TI_SECURE_DEV_PKG)/scripts/secure-binary-image.sh not found." \ |
| 38 | "$@ was NOT created!"; cp $< $@ |
| 39 | endif |
| 40 | else |
| 41 | cmd_omapsecureimg = echo "WARNING: TI_SECURE_DEV_PKG environment" \ |
| 42 | "variable must be defined for TI secure devices." \ |
| 43 | "$@ was NOT created!"; cp $< $@ |
| 44 | endif |
| 45 | endif |
| 46 | |
| 47 | |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 48 | # Standard X-LOADER target (QPSI, NOR flash) |
| 49 | u-boot-spl_HS_X-LOADER: $(obj)/u-boot-spl.bin |
| 50 | $(call if_changed,mkomapsecimg) |
| 51 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame^] | 52 | # For MLO targets (SD card boot) the final file name that is copied to the SD |
| 53 | # card FAT partition must be MLO, so we make a copy of the output file to a new |
| 54 | # file with that name |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 55 | u-boot-spl_HS_MLO: $(obj)/u-boot-spl.bin |
| 56 | $(call if_changed,mkomapsecimg) |
| 57 | @if [ -f $@ ]; then \ |
| 58 | cp -f $@ MLO; \ |
| 59 | fi |
| 60 | |
| 61 | # Standard 2ND target (certain peripheral boot modes) |
| 62 | u-boot-spl_HS_2ND: $(obj)/u-boot-spl.bin |
| 63 | $(call if_changed,mkomapsecimg) |
| 64 | |
| 65 | # Standard ULO target (certain peripheral boot modes) |
| 66 | u-boot-spl_HS_ULO: $(obj)/u-boot-spl.bin |
| 67 | $(call if_changed,mkomapsecimg) |
| 68 | |
| 69 | # Standard ISSW target (certain devices, various boot modes) |
| 70 | u-boot-spl_HS_ISSW: $(obj)/u-boot-spl.bin |
| 71 | $(call if_changed,mkomapsecimg) |
| 72 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame^] | 73 | # For SPI flash on AM335x and AM43xx, these require special byte swap handling |
| 74 | # so we use the SPI_X-LOADER target instead of X-LOADER and let the |
| 75 | # create-boot-image.sh script handle that |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 76 | u-boot-spl_HS_SPI_X-LOADER: $(obj)/u-boot-spl.bin |
| 77 | $(call if_changed,mkomapsecimg) |
| 78 | |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame^] | 79 | # For supporting single stage XiP QSPI on AM43xx, the image is a full u-boot |
| 80 | # file, not an SPL. In this case the mkomapsecimg command looks for a |
| 81 | # u-boot-HS_* prefix |
Daniel Allred | 635173a | 2016-05-19 19:10:45 -0500 | [diff] [blame] | 82 | u-boot_HS_XIP_X-LOADER: $(obj)/u-boot.bin |
| 83 | $(call if_changed,mkomapsecimg) |
Andreas Dannenberg | f4dd761 | 2016-06-27 09:19:20 -0500 | [diff] [blame^] | 84 | |
| 85 | # For supporting the SPL loading and interpreting of FIT images whose |
| 86 | # components are pre-processed before being integrated into the FIT image in |
| 87 | # order to secure them in some way |
| 88 | ifdef CONFIG_SPL_LOAD_FIT |
| 89 | |
| 90 | MKIMAGEFLAGS_u-boot_HS.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ |
| 91 | -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ |
| 92 | -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ |
| 93 | $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) |
| 94 | |
| 95 | OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) |
| 96 | $(OF_LIST_TARGETS): dtbs |
| 97 | |
| 98 | %_HS.dtb: %.dtb |
| 99 | $(call if_changed,omapsecureimg) |
| 100 | $(Q)if [ -f $@ ]; then \ |
| 101 | cp -f $@ $<; \ |
| 102 | fi |
| 103 | |
| 104 | u-boot-nodtb_HS.bin: u-boot-nodtb.bin |
| 105 | $(call if_changed,omapsecureimg) |
| 106 | |
| 107 | u-boot_HS.img: u-boot-nodtb_HS.bin u-boot.img $(patsubst %.dtb,%_HS.dtb,$(OF_LIST_TARGETS)) |
| 108 | $(call if_changed,mkimage) |
| 109 | $(Q)if [ -f $@ ]; then \ |
| 110 | cp -f $@ u-boot.img; \ |
| 111 | fi |
| 112 | |
| 113 | endif |