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 | d7c564d | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 79 | $(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] | 80 | $(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] | 81 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 82 | TBB := $(WTP)/wtptp/src/TBB_Linux/release/TBB_linux |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 83 | |
Pali Rohár | 7560d2c | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 84 | BUILD_UART := uart-images |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 85 | UART_IMAGE := $(BUILD_UART).tgz.bin |
Pali Rohár | 7560d2c | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 86 | |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 87 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 88 | TIM_CFG := $(BUILD_PLAT)/atf-tim.txt |
| 89 | TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-tim.txt |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 90 | IMAGESPATH := $(WTP)/tim/trusted |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 91 | TIMN_CFG := $(BUILD_PLAT)/atf-timN.txt |
| 92 | TIMN_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt |
| 93 | TIMN_SIG := $(IMAGESPATH)/timnsign.txt |
| 94 | TIM2IMGARGS := -i $(TIM_CFG) -n $(TIMN_CFG) |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 95 | 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] | 96 | else #MARVELL_SECURE_BOOT |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 97 | TIM_CFG := $(BUILD_PLAT)/atf-ntim.txt |
| 98 | TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 99 | IMAGESPATH := $(WTP)/tim/untrusted |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 100 | TIM2IMGARGS := -i $(TIM_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 101 | endif #MARVELL_SECURE_BOOT |
| 102 | |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 103 | TIM_UART_IMAGE := $$(grep "Image Filename:" -m 1 $(TIM_UART_CFG) | cut -c 17-) |
| 104 | |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 105 | TIMBUILD := $(WTP)/script/buildtim.sh |
| 106 | TIM2IMG := $(WTP)/script/tim2img.pl |
| 107 | TIMDDRTOOL := $(WTP)/tim/ddr/ddr_tool |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 108 | |
| 109 | $(TIMBUILD): $(TIMDDRTOOL) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 110 | |
| 111 | # WTMI_IMG is used to specify the customized RTOS image running over |
| 112 | # Service CPU (CM3 processor). By the default, it points to a |
| 113 | # baremetal binary of fuse programming in A3700_utils. |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 114 | WTMI_IMG := $(WTP)/wtmi/fuse/build/fuse.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 115 | |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 116 | # WTMI_MULTI_IMG is composed of CM3 RTOS image (WTMI_IMG) |
Pali Rohár | 8b42da0 | 2021-01-26 11:10:17 +0100 | [diff] [blame] | 117 | # and sys-init image. |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 118 | WTMI_MULTI_IMG := $(WTP)/wtmi/build/wtmi.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 119 | |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 120 | WTMI_ENC_IMG := wtmi-enc.bin |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 121 | |
| 122 | SRCPATH := $(dir $(BL33)) |
| 123 | |
| 124 | CLOCKSPRESET ?= CPU_800_DDR_800 |
| 125 | |
| 126 | DDR_TOPOLOGY ?= 0 |
| 127 | |
| 128 | BOOTDEV ?= SPINOR |
| 129 | PARTNUM ?= 0 |
| 130 | |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 131 | TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 132 | $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(TIM_CFG) $(TIMN_CFG) $(TIMN_SIG) 1 |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 133 | TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 134 | $(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] | 135 | |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 136 | UART_IMAGES := $(BUILD_UART)/$(TIM_UART_IMAGE) |
| 137 | ifeq ($(MARVELL_SECURE_BOOT),1) |
| 138 | UART_IMAGES += $(BUILD_UART)/$(TIMN_UART_IMAGE) |
| 139 | endif |
| 140 | UART_IMAGES += $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin |
| 141 | |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 142 | CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) |
| 143 | CRYPTOPP_INCDIR ?= $(CRYPTOPP_PATH) |
| 144 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 145 | $(TBB): FORCE |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 146 | $(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")) |
| 147 | $(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")) |
| 148 | $(if $(wildcard $(CRYPTOPP_LIBDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_LIB' was set to '$(CRYPTOPP_LIBDIR)', but '$(CRYPTOPP_LIBDIR)' does not exist")) |
| 149 | $(if $(wildcard $(CRYPTOPP_INCDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_INCDIR' was set to '$(CRYPTOPP_INCDIR)', but '$(CRYPTOPP_INCDIR)' does not exist")) |
| 150 | ifdef CRYPTOPP_PATH |
Pali Rohár | e3b8176 | 2020-10-29 16:44:45 +0100 | [diff] [blame] | 151 | $(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile |
Pali Rohár | a304cf5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 152 | endif |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 153 | $(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] | 154 | |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 155 | $(WTMI_MULTI_IMG): FORCE |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 156 | $(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] | 157 | |
Pali Rohár | b4831d0 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 158 | $(BUILD_PLAT)/wtmi.bin: $(WTMI_MULTI_IMG) |
| 159 | $(Q)cp -a $(WTMI_MULTI_IMG) $(BUILD_PLAT)/wtmi.bin |
| 160 | |
Pali Rohár | a6ac1fb | 2020-11-23 19:49:23 +0100 | [diff] [blame] | 161 | $(TIMDDRTOOL): FORCE |
| 162 | $(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] | 163 | $(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] | 164 | $(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] | 165 | $(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] | 166 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 167 | $(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] | 168 | @$(ECHO_BLANK_LINE) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 169 | @echo "Building uart images" |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 170 | $(Q)mkdir -p $(BUILD_PLAT)/$(BUILD_UART) |
| 171 | $(Q)cp -a $(BUILD_PLAT)/wtmi.bin $(BUILD_PLAT)/$(BUILD_UART)/wtmi.bin |
| 172 | $(Q)cp -a $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/$(BUILD_UART)/$(BOOT_IMAGE) |
| 173 | $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TIMBUILD) $(TIMBLDUARTARGS) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 174 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_UART_CFG) |
| 175 | $(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] | 176 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 177 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_UART_CFG) |
| 178 | $(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] | 179 | endif |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 180 | $(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] | 181 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 182 | $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMN_UART_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 183 | endif |
Pali Rohár | 5ac6c66 | 2021-07-11 17:33:37 +0200 | [diff] [blame] | 184 | $(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] | 185 | @$(ECHO_BLANK_LINE) |
| 186 | @echo "Built $@ successfully" |
| 187 | @$(ECHO_BLANK_LINE) |
| 188 | |
Pali Rohár | cfdcfb7 | 2021-07-10 15:04:53 +0200 | [diff] [blame] | 189 | $(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] | 190 | @$(ECHO_BLANK_LINE) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 191 | @echo "Building flash image" |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 192 | $(Q)cd $(BUILD_PLAT) && $(TIMBUILD) $(TIMBLDARGS) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 193 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_CFG) |
| 194 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIM_CFG) |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 195 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 196 | $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_CFG) |
| 197 | $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMN_CFG) |
Pali Rohár | adde087 | 2021-01-29 12:08:21 +0100 | [diff] [blame] | 198 | @$(ECHO_BLANK_LINE) |
| 199 | @echo "======================================================="; |
| 200 | @echo " Secure boot. Encrypting wtmi and boot-image"; |
| 201 | @echo "======================================================="; |
| 202 | @$(ECHO_BLANK_LINE) |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 203 | $(Q)cp $(BUILD_PLAT)/wtmi.bin $(BUILD_PLAT)/wtmi-align.bin |
| 204 | $(Q)truncate -s %16 $(BUILD_PLAT)/wtmi-align.bin |
| 205 | $(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] | 206 | -out $(BUILD_PLAT)/$(WTMI_ENC_IMG) \ |
Konstantin Porotchkin | 4eb9bc4 | 2018-11-06 18:10:33 +0200 | [diff] [blame] | 207 | -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 208 | -iv `cat $(IMAGESPATH)/iv.txt` -p |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 209 | $(Q)truncate -s %16 $(BUILD_PLAT)/$(BOOT_IMAGE); |
| 210 | $(Q)openssl enc -aes-256-cbc -e -in $(BUILD_PLAT)/$(BOOT_IMAGE) \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 211 | -out $(BUILD_PLAT)/$(BOOT_ENC_IMAGE) \ |
Konstantin Porotchkin | 4eb9bc4 | 2018-11-06 18:10:33 +0200 | [diff] [blame] | 212 | -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ |
Konstantin Porotchkin | e7be6e2 | 2018-10-08 16:53:09 +0300 | [diff] [blame] | 213 | -iv `cat $(IMAGESPATH)/iv.txt` -p |
| 214 | endif |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 215 | $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIM_CFG) -v -D |
Pali Rohár | 7c4142c | 2020-11-23 19:37:28 +0100 | [diff] [blame] | 216 | ifeq ($(MARVELL_SECURE_BOOT),1) |
Pali Rohár | fe84ac9 | 2021-07-11 14:46:49 +0200 | [diff] [blame] | 217 | $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIMN_CFG) |
| 218 | $(Q)sed -i 's|wtmi.bin|$(WTMI_ENC_IMG)|1' $(TIMN_CFG) |
| 219 | $(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] | 220 | endif |
Pali Rohár | 1dd7fa3 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 221 | $(Q)cd $(BUILD_PLAT) && $(TIM2IMG) $(TIM2IMGARGS) -o $(BUILD_PLAT)/$(FLASH_IMAGE) |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 222 | @$(ECHO_BLANK_LINE) |
| 223 | @echo "Built $@ successfully" |
| 224 | @$(ECHO_BLANK_LINE) |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 225 | |
Pali Rohár | 06a38e2 | 2020-11-23 19:45:28 +0100 | [diff] [blame] | 226 | clean realclean distclean: mrvl_clean |
| 227 | |
| 228 | .PHONY: mrvl_clean |
| 229 | mrvl_clean: |
Pali Rohár | 0512598 | 2021-07-10 14:54:44 +0200 | [diff] [blame] | 230 | -$(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) clean |
| 231 | -$(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] | 232 | ifdef CRYPTOPP_PATH |
| 233 | -$(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile clean |
| 234 | endif |
| 235 | |
Pali Rohár | 0233cd4 | 2020-12-03 12:00:47 +0100 | [diff] [blame] | 236 | else # WTP |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 237 | |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 238 | $(BUILD_PLAT)/$(UART_IMAGE) $(BUILD_PLAT)/$(FLASH_IMAGE): |
Pali Rohár | 8a93658 | 2020-10-15 13:50:28 +0200 | [diff] [blame] | 239 | $(error "Platform '${PLAT}' for target '$@' requires WTP. Please set WTP to point to the right directory") |
| 240 | |
Pali Rohár | 0233cd4 | 2020-12-03 12:00:47 +0100 | [diff] [blame] | 241 | endif # WTP |
Pali Rohár | 9e737b6 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 242 | |
| 243 | .PHONY: mrvl_uart |
| 244 | mrvl_uart: $(BUILD_PLAT)/$(UART_IMAGE) |