Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 1 | # |
Marek Behún | 5fd234e | 2021-01-07 21:52:44 +0100 | [diff] [blame] | 2 | # Copyright (C) 2018-2021 Marvell International Ltd. |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # https://spdx.org/licenses |
| 6 | # |
| 7 | |
Grzegorz Jaszczyk | 3039bce | 2019-11-05 13:14:59 +0100 | [diff] [blame] | 8 | MARVELL_PLAT_BASE := plat/marvell/armada |
| 9 | MARVELL_PLAT_INCLUDE_BASE := include/plat/marvell/armada |
Marcin Wojtas | 45f1655 | 2020-06-18 19:50:47 +0200 | [diff] [blame] | 10 | PLAT_FAMILY := a3k |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 11 | PLAT_FAMILY_BASE := $(MARVELL_PLAT_BASE)/$(PLAT_FAMILY) |
| 12 | PLAT_INCLUDE_BASE := $(MARVELL_PLAT_INCLUDE_BASE)/$(PLAT_FAMILY) |
| 13 | PLAT_COMMON_BASE := $(PLAT_FAMILY_BASE)/common |
| 14 | MARVELL_DRV_BASE := drivers/marvell |
| 15 | MARVELL_COMMON_BASE := $(MARVELL_PLAT_BASE)/common |
Marek Behún | 011f889 | 2021-08-26 17:29:45 +0200 | [diff] [blame] | 16 | ERRATA_A53_1530924 := 1 |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 17 | |
Pali Rohár | 3666d48 | 2020-10-29 16:50:19 +0100 | [diff] [blame] | 18 | include plat/marvell/marvell.mk |
| 19 | |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 20 | #*********** A3700 ************* |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 21 | |
| 22 | # GICV3 |
| 23 | $(eval $(call add_define,CONFIG_GICV3)) |
| 24 | |
| 25 | # CCI-400 |
| 26 | $(eval $(call add_define,USE_CCI)) |
| 27 | |
| 28 | # Include GICv3 driver files |
| 29 | include drivers/arm/gic/v3/gicv3.mk |
| 30 | |
| 31 | MARVELL_GIC_SOURCES := ${GICV3_SOURCES} \ |
| 32 | plat/common/plat_gicv3.c |
| 33 | |
| 34 | PLAT_INCLUDES := -I$(PLAT_FAMILY_BASE)/$(PLAT) \ |
| 35 | -I$(PLAT_COMMON_BASE)/include \ |
| 36 | -I$(PLAT_INCLUDE_BASE)/common \ |
| 37 | -I$(MARVELL_DRV_BASE) \ |
| 38 | -I$/drivers/arm/gic/common/ |
| 39 | |
| 40 | PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a3700_common.c \ |
Pali Rohár | 52c1de5 | 2021-05-14 15:52:11 +0200 | [diff] [blame] | 41 | $(PLAT_COMMON_BASE)/aarch64/a3700_clock.S \ |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 42 | $(MARVELL_DRV_BASE)/uart/a3700_console.S |
| 43 | |
| 44 | BL1_SOURCES += $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ |
| 45 | lib/cpus/aarch64/cortex_a53.S |
| 46 | |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 47 | MARVELL_DRV := $(MARVELL_DRV_BASE)/comphy/phy-comphy-3700.c |
| 48 | |
| 49 | BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ |
| 50 | $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ |
Marek Behún | 5fd234e | 2021-01-07 21:52:44 +0100 | [diff] [blame] | 51 | $(PLAT_COMMON_BASE)/plat_cci.c \ |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 52 | $(PLAT_COMMON_BASE)/plat_pm.c \ |
| 53 | $(PLAT_COMMON_BASE)/dram_win.c \ |
| 54 | $(PLAT_COMMON_BASE)/io_addr_dec.c \ |
| 55 | $(PLAT_COMMON_BASE)/marvell_plat_config.c \ |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 56 | $(PLAT_FAMILY_BASE)/$(PLAT)/plat_bl31_setup.c \ |
Marek Behún | 5fd234e | 2021-01-07 21:52:44 +0100 | [diff] [blame] | 57 | $(MARVELL_COMMON_BASE)/marvell_cci.c \ |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 58 | $(MARVELL_COMMON_BASE)/marvell_ddr_info.c \ |
| 59 | $(MARVELL_COMMON_BASE)/marvell_gicv3.c \ |
| 60 | $(MARVELL_GIC_SOURCES) \ |
| 61 | drivers/arm/cci/cci.c \ |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 62 | $(PLAT_COMMON_BASE)/a3700_sip_svc.c \ |
| 63 | $(MARVELL_DRV) |
| 64 | |
Pali Rohár | 76f3849 | 2021-07-09 15:10:27 +0200 | [diff] [blame] | 65 | ifeq ($(HANDLE_EA_EL3_FIRST),1) |
| 66 | BL31_SOURCES += $(PLAT_COMMON_BASE)/a3700_ea.c |
| 67 | endif |
| 68 | |
Marek Behún | 19d8578 | 2021-01-05 14:01:05 +0100 | [diff] [blame] | 69 | ifeq ($(CM3_SYSTEM_RESET),1) |
| 70 | BL31_SOURCES += $(PLAT_COMMON_BASE)/cm3_system_reset.c |
| 71 | endif |
| 72 | |
Pali Rohár | e7704b0 | 2021-04-06 19:18:30 +0200 | [diff] [blame] | 73 | ifeq ($(A3720_DB_PM_WAKEUP_SRC),1) |
| 74 | BL31_SOURCES += $(PLAT_FAMILY_BASE)/$(PLAT)/board/pm_src.c |
| 75 | endif |
| 76 | |
Pali Rohár | 0233cd4 | 2020-12-03 12:00:47 +0100 | [diff] [blame] | 77 | ifdef WTP |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 78 | |
Pali Rohár | c883600 | 2021-10-13 11:37:12 +0200 | [diff] [blame] | 79 | # Do not remove! Following checks are required to ensure correct TF-A builds, removing these checks leads to broken TF-A builds |
Pali Rohár | d7c564d | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 80 | $(if $(wildcard $(value WTP)/*),,$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' directory does not exist")) |
Pali Rohár | 111a012 | 2021-07-07 12:14:20 +0200 | [diff] [blame] | 81 | $(if $(shell git -C $(value WTP) rev-parse --show-cdup 2>&1),$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' does not contain valid A3700-utils-marvell git repository")) |
Pali Rohár | d7c564d | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 82 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 83 | TBB := $(WTP)/wtptp/src/TBB_Linux/release/TBB_linux |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 84 | |
Pali Rohár | 7560d2c | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 85 | BUILD_UART := uart-images |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 86 | UART_IMAGE := $(BUILD_UART).tgz.bin |
Pali Rohár | 7560d2c | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 87 | |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 88 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 89 | TIM_CFG := $(BUILD_PLAT)/atf-tim.txt |
| 90 | TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-tim.txt |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 91 | IMAGESPATH := $(WTP)/tim/trusted |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 92 | TIMN_CFG := $(BUILD_PLAT)/atf-timN.txt |
| 93 | TIMN_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt |
| 94 | TIMN_SIG := $(IMAGESPATH)/timnsign.txt |
| 95 | TIM2IMGARGS := -i $(TIM_CFG) -n $(TIMN_CFG) |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 96 | TIMN_UART_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMN_UART_CFG) | cut -c 17-) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 97 | else #MARVELL_SECURE_BOOT |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 98 | TIM_CFG := $(BUILD_PLAT)/atf-ntim.txt |
| 99 | TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 100 | IMAGESPATH := $(WTP)/tim/untrusted |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 101 | TIM2IMGARGS := -i $(TIM_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 102 | endif #MARVELL_SECURE_BOOT |
| 103 | |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 104 | TIM_UART_IMAGE := $$(grep "Image Filename:" -m 1 $(TIM_UART_CFG) | cut -c 17-) |
| 105 | |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 106 | TIMBUILD := $(WTP)/script/buildtim.sh |
| 107 | TIM2IMG := $(WTP)/script/tim2img.pl |
| 108 | TIMDDRTOOL := $(WTP)/tim/ddr/ddr_tool |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 109 | |
| 110 | $(TIMBUILD): $(TIMDDRTOOL) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 111 | |
| 112 | # WTMI_IMG is used to specify the customized RTOS image running over |
| 113 | # Service CPU (CM3 processor). By the default, it points to a |
| 114 | # baremetal binary of fuse programming in A3700_utils. |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 115 | WTMI_IMG := $(WTP)/wtmi/fuse/build/fuse.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 116 | |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 117 | # WTMI_MULTI_IMG is composed of CM3 RTOS image (WTMI_IMG) |
Pali Rohár | 8b42da0 | 2021-01-26 11:10:17 +0100 | [diff] [blame] | 118 | # and sys-init image. |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 119 | WTMI_MULTI_IMG := $(WTP)/wtmi/build/wtmi.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 120 | |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 121 | WTMI_ENC_IMG := wtmi-enc.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 122 | |
| 123 | SRCPATH := $(dir $(BL33)) |
| 124 | |
| 125 | CLOCKSPRESET ?= CPU_800_DDR_800 |
| 126 | |
| 127 | DDR_TOPOLOGY ?= 0 |
| 128 | |
| 129 | BOOTDEV ?= SPINOR |
| 130 | PARTNUM ?= 0 |
| 131 | |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 132 | TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 133 | $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(TIM_CFG) $(TIMN_CFG) $(TIMN_SIG) 1 |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 134 | TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 135 | $(DDR_TOPOLOGY) 0 0 $(TIM_UART_CFG) $(TIMN_UART_CFG) $(TIMN_SIG) 0 |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 136 | |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 137 | UART_IMAGES := $(BUILD_UART)/$(TIM_UART_IMAGE) |
| 138 | ifeq ($(MARVELL_SECURE_BOOT),1) |
| 139 | UART_IMAGES += $(BUILD_UART)/$(TIMN_UART_IMAGE) |
| 140 | endif |
| 141 | UART_IMAGES += $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin |
| 142 | |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 143 | CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) |
| 144 | CRYPTOPP_INCDIR ?= $(CRYPTOPP_PATH) |
| 145 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 146 | $(TBB): FORCE |
Pali Rohár | c883600 | 2021-10-13 11:37:12 +0200 | [diff] [blame] | 147 | # Do not remove! Following checks are required to ensure correct TF-A builds, removing these checks leads to broken TF-A builds |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 148 | $(if $(CRYPTOPP_LIBDIR),,$(error "Platform '$(PLAT)' for WTP image tool requires CRYPTOPP_PATH or CRYPTOPP_LIBDIR. Please set CRYPTOPP_PATH or CRYPTOPP_LIBDIR to point to the right directory")) |
| 149 | $(if $(CRYPTOPP_INCDIR),,$(error "Platform '$(PLAT)' for WTP image tool requires CRYPTOPP_PATH or CRYPTOPP_INCDIR. Please set CRYPTOPP_PATH or CRYPTOPP_INCDIR to point to the right directory")) |
| 150 | $(if $(wildcard $(CRYPTOPP_LIBDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_LIB' was set to '$(CRYPTOPP_LIBDIR)', but '$(CRYPTOPP_LIBDIR)' does not exist")) |
| 151 | $(if $(wildcard $(CRYPTOPP_INCDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_INCDIR' was set to '$(CRYPTOPP_INCDIR)', but '$(CRYPTOPP_INCDIR)' does not exist")) |
| 152 | ifdef CRYPTOPP_PATH |
Pali Rohár | e3b8176 | 2020-10-29 16:44:45 +0100 | [diff] [blame] | 153 | $(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 154 | endif |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 155 | $(Q)$(MAKE) --no-print-directory -C $(WTP)/wtptp/src/TBB_Linux -f TBB_linux.mak LIBDIR=$(CRYPTOPP_LIBDIR) INCDIR=$(CRYPTOPP_INCDIR) |
Pali Rohár | e3b8176 | 2020-10-29 16:44:45 +0100 | [diff] [blame] | 156 | |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 157 | $(WTMI_MULTI_IMG): FORCE |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 158 | $(Q)$(MAKE) --no-print-directory -C $(WTP) WTMI_IMG=$(WTMI_IMG) DDR_TOPOLOGY=$(DDR_TOPOLOGY) CLOCKSPRESET=$(CLOCKSPRESET) WTMI |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 159 | |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 160 | $(BUILD_PLAT)/wtmi.bin: $(WTMI_MULTI_IMG) |
| 161 | $(Q)cp -a $(WTMI_MULTI_IMG) $(BUILD_PLAT)/wtmi.bin |
| 162 | |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 163 | $(TIMDDRTOOL): FORCE |
Pali Rohár | c883600 | 2021-10-13 11:37:12 +0200 | [diff] [blame] | 164 | # Do not remove! Following checks are required to ensure correct TF-A builds, removing these checks leads to broken TF-A builds |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 165 | $(if $(value MV_DDR_PATH),,$(error "Platform '${PLAT}' for ddr tool requires MV_DDR_PATH. Please set MV_DDR_PATH to point to the right directory")) |
Pali Rohár | d7c564d | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 166 | $(if $(wildcard $(value MV_DDR_PATH)/*),,$(error "'MV_DDR_PATH=$(value MV_DDR_PATH)' was specified, but '$(value MV_DDR_PATH)' directory does not exist")) |
Pali Rohár | 111a012 | 2021-07-07 12:14:20 +0200 | [diff] [blame] | 167 | $(if $(shell git -C $(value MV_DDR_PATH) rev-parse --show-cdup 2>&1),$(error "'MV_DDR_PATH=$(value MV_DDR_PATH)' was specified, but '$(value MV_DDR_PATH)' does not contain valid mv-ddr-marvell git repository")) |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 168 | $(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) DDR_TOPOLOGY=$(DDR_TOPOLOGY) mv_ddr |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 169 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 170 | $(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(TBB) $(TIMBUILD) $(TIMDDRTOOL) |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 171 | @$(ECHO_BLANK_LINE) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 172 | @echo "Building uart images" |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 173 | $(Q)mkdir -p $(BUILD_PLAT)/$(BUILD_UART) |
| 174 | $(Q)cp -a $(BUILD_PLAT)/wtmi.bin $(BUILD_PLAT)/$(BUILD_UART)/wtmi.bin |
| 175 | $(Q)cp -a $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/$(BUILD_UART)/$(BOOT_IMAGE) |
| 176 | $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TIMBUILD) $(TIMBLDUARTARGS) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 177 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_UART_CFG) |
| 178 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIM_UART_CFG) |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 179 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 180 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_UART_CFG) |
| 181 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMN_UART_CFG) |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 182 | endif |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 183 | $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIM_UART_CFG) -v -D |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 184 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 185 | $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMN_UART_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 186 | endif |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 187 | $(Q)tar czf $(BUILD_PLAT)/$(UART_IMAGE) -C $(BUILD_PLAT) $(UART_IMAGES) |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 188 | @$(ECHO_BLANK_LINE) |
| 189 | @echo "Built $@ successfully" |
| 190 | @$(ECHO_BLANK_LINE) |
| 191 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 192 | $(BUILD_PLAT)/$(FLASH_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(TBB) $(TIMBUILD) $(TIMDDRTOOL) $(TIM2IMG) |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 193 | @$(ECHO_BLANK_LINE) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 194 | @echo "Building flash image" |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 195 | $(Q)cd $(BUILD_PLAT) && $(TIMBUILD) $(TIMBLDARGS) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 196 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_CFG) |
| 197 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIM_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 198 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 199 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_CFG) |
| 200 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMN_CFG) |
Pali Rohár | adde087 | 2021-01-29 12:08:21 +0100 | [diff] [blame] | 201 | @$(ECHO_BLANK_LINE) |
| 202 | @echo "======================================================="; |
| 203 | @echo " Secure boot. Encrypting wtmi and boot-image"; |
| 204 | @echo "======================================================="; |
| 205 | @$(ECHO_BLANK_LINE) |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 206 | $(Q)cp $(BUILD_PLAT)/wtmi.bin $(BUILD_PLAT)/wtmi-align.bin |
| 207 | $(Q)truncate -s %16 $(BUILD_PLAT)/wtmi-align.bin |
| 208 | $(Q)openssl enc -aes-256-cbc -e -in $(BUILD_PLAT)/wtmi-align.bin \ |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 209 | -out $(BUILD_PLAT)/$(WTMI_ENC_IMG) \ |
Konstantin Porotchkin | 4eb9bc4 | 2018-11-06 18:10:33 +0200 | [diff] [blame] | 210 | -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 211 | -iv `cat $(IMAGESPATH)/iv.txt` -p |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 212 | $(Q)truncate -s %16 $(BUILD_PLAT)/$(BOOT_IMAGE); |
| 213 | $(Q)openssl enc -aes-256-cbc -e -in $(BUILD_PLAT)/$(BOOT_IMAGE) \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 214 | -out $(BUILD_PLAT)/$(BOOT_ENC_IMAGE) \ |
Konstantin Porotchkin | 4eb9bc4 | 2018-11-06 18:10:33 +0200 | [diff] [blame] | 215 | -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 216 | -iv `cat $(IMAGESPATH)/iv.txt` -p |
| 217 | endif |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 218 | $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIM_CFG) -v -D |
Pali Rohár | 7c4142c | 2020-11-23 19:37:28 +0100 | [diff] [blame] | 219 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 220 | $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIMN_CFG) |
| 221 | $(Q)sed -i 's|wtmi.bin|$(WTMI_ENC_IMG)|1' $(TIMN_CFG) |
| 222 | $(Q)sed -i 's|$(BOOT_IMAGE)|$(BOOT_ENC_IMAGE)|1' $(TIMN_CFG) |
Pali Rohár | 7c4142c | 2020-11-23 19:37:28 +0100 | [diff] [blame] | 223 | endif |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 224 | $(Q)cd $(BUILD_PLAT) && $(TIM2IMG) $(TIM2IMGARGS) -o $(BUILD_PLAT)/$(FLASH_IMAGE) |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 225 | @$(ECHO_BLANK_LINE) |
| 226 | @echo "Built $@ successfully" |
| 227 | @$(ECHO_BLANK_LINE) |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 228 | |
Pali Rohár | 06a38e2 | 2020-11-23 19:45:28 +0100 | [diff] [blame] | 229 | clean realclean distclean: mrvl_clean |
| 230 | |
| 231 | .PHONY: mrvl_clean |
| 232 | mrvl_clean: |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 233 | -$(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) clean |
| 234 | -$(Q)$(MAKE) --no-print-directory -C $(WTP)/wtptp/src/TBB_Linux -f TBB_linux.mak clean |
Pali Rohár | 06a38e2 | 2020-11-23 19:45:28 +0100 | [diff] [blame] | 235 | ifdef CRYPTOPP_PATH |
| 236 | -$(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile clean |
| 237 | endif |
| 238 | |
Pali Rohár | 0233cd4 | 2020-12-03 12:00:47 +0100 | [diff] [blame] | 239 | else # WTP |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 240 | |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 241 | $(BUILD_PLAT)/$(UART_IMAGE) $(BUILD_PLAT)/$(FLASH_IMAGE): |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 242 | $(error "Platform '${PLAT}' for target '$@' requires WTP. Please set WTP to point to the right directory") |
| 243 | |
Pali Rohár | 0233cd4 | 2020-12-03 12:00:47 +0100 | [diff] [blame] | 244 | endif # WTP |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 245 | |
| 246 | .PHONY: mrvl_uart |
| 247 | mrvl_uart: $(BUILD_PLAT)/$(UART_IMAGE) |