From 528dafc367c4f49d4904c4335422502dacf469bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 28 Jun 2021 15:27:25 +0200 Subject: [PATCH 1/8] fix(plat/marvell/a8k): Require that MV_DDR_PATH is correctly set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Target mrvl_flash depends on external mv_ddr source code which is not part of TF-A project. Do not expect that it is pre-downloaded at some specific location and require user to specify correct path to mv_ddr source code via MV_DDR_PATH build option. TF-A code for Armada 37x0 platform also depends on mv_ddr source code and already requires passing correct MV_DDR_PATH build option. So for A8K implement same checks for validity of MV_DDR_PATH option as are already used by TF-A code for Armada 37x0 platform. Signed-off-by: Pali Rohár Change-Id: I792f2bfeab0cec89b1b64e88d7b2c456e22de43a --- docs/plat/marvell/armada/build.rst | 6 ++---- plat/marvell/armada/a8k/common/ble/ble.mk | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/plat/marvell/armada/build.rst b/docs/plat/marvell/armada/build.rst index c9f5e8224..fcc74a51e 100644 --- a/docs/plat/marvell/armada/build.rst +++ b/docs/plat/marvell/armada/build.rst @@ -129,15 +129,13 @@ There are several build options: - MV_DDR_PATH + This parameter is required for ``mrvl_flash`` and ``mrvl_uart`` targets. + For A7K/8K/CN913x, use this parameter to point to mv_ddr driver sources to allow BLE build. For A37x0, it is used for ddr_tool build. Usage example: MV_DDR_PATH=path/to/mv_ddr - The parameter is optional for A7K/8K/CN913x, when this parameter is not set, the mv_ddr - sources are expected to be located at: drivers/marvell/mv_ddr. However, the parameter - is necessary for A37x0. - For the mv_ddr source location, check the section "Tools and external components installation" If MV_DDR_PATH source code is a git snapshot then provide path to the full git diff --git a/plat/marvell/armada/a8k/common/ble/ble.mk b/plat/marvell/armada/a8k/common/ble/ble.mk index d6d72c15d..6ca18fdb8 100644 --- a/plat/marvell/armada/a8k/common/ble/ble.mk +++ b/plat/marvell/armada/a8k/common/ble/ble.mk @@ -3,8 +3,6 @@ # SPDX-License-Identifier: BSD-3-Clause # https://spdx.org/licenses -MV_DDR_PATH ?= drivers/marvell/mv_ddr - MV_DDR_LIB = $(BUILD_PLAT)/ble/mv_ddr_lib.a LIBC_LIB = $(BUILD_PLAT)/lib/libc.a BLE_LIBS = $(MV_DDR_LIB) $(LIBC_LIB) @@ -28,4 +26,7 @@ PLAT_INCLUDES += -I$(MV_DDR_PATH) \ BLE_LINKERFILE := $(BLE_PATH)/ble.ld.S $(MV_DDR_LIB): FORCE + $(if $(value MV_DDR_PATH),,$(error "Platform '$(PLAT)' for BLE requires MV_DDR_PATH. Please set MV_DDR_PATH to point to the right directory")) + $(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")) + $(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")) @+make -C $(MV_DDR_PATH) --no-print-directory PLAT_INCLUDES="$(PLAT_INCLUDES)" PLATFORM=$(PLAT) ARCH=AARCH64 OBJ_DIR=$(BUILD_PLAT)/ble From 559ab2df4a35cd82b2a67a0bebeb3028544a6766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 10 Jul 2021 17:05:53 +0200 Subject: [PATCH 2/8] fix(plat/marvell/a8k): Correctly set include directories for individual targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not set all include directories, including those for external targets in one PLAT_INCLUDES variable. Instead split them into variables: * $(PLAT_INCLUDES) for all TF-A BL images * BLE target specific $(PLAT_INCLUDES) only for Marvell BLE image * $(MV_DDR_INCLUDES) for targets in external Marvell mv-ddr-marvell tree Include directory $(CURDIR)/drivers/marvell is required by TF-A BL images, so move it from ble.mk to a8k_common.mk. Include directory $(MV_DDR_PATH) is needed only by Marvell BLE image, so move it into BLE target specific $(PLAT_INCLUDES) variable. And remaining include directories specified in ble.mk are needed only for building external dependences from Marvell mv-ddr tree, so move them into $(MV_DDR_INCLUDES) variable and correctly use it in $(MV_DDR_LIB) target. Signed-off-by: Pali Rohár Change-Id: I331f7de675dca2bc70733d56b768f00d56ae4a67 --- plat/marvell/armada/a8k/common/a8k_common.mk | 1 + plat/marvell/armada/a8k/common/ble/ble.mk | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plat/marvell/armada/a8k/common/a8k_common.mk b/plat/marvell/armada/a8k/common/a8k_common.mk index 90883f285..773b912d1 100644 --- a/plat/marvell/armada/a8k/common/a8k_common.mk +++ b/plat/marvell/armada/a8k/common/a8k_common.mk @@ -82,6 +82,7 @@ MARVELL_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ PLAT_INCLUDES := -I$(BOARD_DIR) \ -I$(BOARD_DIR)/board \ + -I$(CURDIR)/drivers/marvell \ -I$(PLAT_COMMON_BASE)/include \ -I$(PLAT_INCLUDE_BASE)/common diff --git a/plat/marvell/armada/a8k/common/ble/ble.mk b/plat/marvell/armada/a8k/common/ble/ble.mk index 6ca18fdb8..19ef5b6ac 100644 --- a/plat/marvell/armada/a8k/common/ble/ble.mk +++ b/plat/marvell/armada/a8k/common/ble/ble.mk @@ -16,17 +16,18 @@ BLE_SOURCES += $(BLE_PATH)/ble_main.c \ $(PLAT_MARVELL)/common/plat_delay_timer.c \ $(PLAT_MARVELL)/common/marvell_console.c -PLAT_INCLUDES += -I$(MV_DDR_PATH) \ - -I$(CURDIR)/include \ +MV_DDR_INCLUDES := -I$(CURDIR)/include \ -I$(CURDIR)/include/arch/aarch64 \ -I$(CURDIR)/include/lib/libc \ - -I$(CURDIR)/include/lib/libc/aarch64 \ - -I$(CURDIR)/drivers/marvell + -I$(CURDIR)/include/lib/libc/aarch64 BLE_LINKERFILE := $(BLE_PATH)/ble.ld.S +BLE_OBJS := $(addprefix $(BUILD_PLAT)/ble/,$(call SOURCES_TO_OBJS,$(BLE_SOURCES))) +$(BLE_OBJS): PLAT_INCLUDES += -I$(MV_DDR_PATH) + $(MV_DDR_LIB): FORCE $(if $(value MV_DDR_PATH),,$(error "Platform '$(PLAT)' for BLE requires MV_DDR_PATH. Please set MV_DDR_PATH to point to the right directory")) $(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")) $(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")) - @+make -C $(MV_DDR_PATH) --no-print-directory PLAT_INCLUDES="$(PLAT_INCLUDES)" PLATFORM=$(PLAT) ARCH=AARCH64 OBJ_DIR=$(BUILD_PLAT)/ble + @+make -C $(MV_DDR_PATH) --no-print-directory PLAT_INCLUDES="$(MV_DDR_INCLUDES)" PLATFORM=$(PLAT) ARCH=AARCH64 OBJ_DIR=$(BUILD_PLAT)/ble From 04738e69917f8e8790bf4cf83ceb05f85e1f45bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 10 Jul 2021 17:15:01 +0200 Subject: [PATCH 3/8] fix(plat/marvell/a8k): Add missing build dependency for BLE target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BLE source files depend on external Marvell mv-ddr-marvell tree (specified in $(MV_DDR_PATH) variable) and its header files. Add dependency on $(MV_DDR_LIB) target which checks that variable $(MV_DDR_PATH) is correctly set and ensures that make completes compilation of mv-ddr-marvell tree. Signed-off-by: Pali Rohár Change-Id: I73968b24c45d9af1e3500b8db7a24bb4eb2bfa47 --- plat/marvell/armada/a8k/common/ble/ble.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/plat/marvell/armada/a8k/common/ble/ble.mk b/plat/marvell/armada/a8k/common/ble/ble.mk index 19ef5b6ac..87e2ce020 100644 --- a/plat/marvell/armada/a8k/common/ble/ble.mk +++ b/plat/marvell/armada/a8k/common/ble/ble.mk @@ -25,6 +25,7 @@ BLE_LINKERFILE := $(BLE_PATH)/ble.ld.S BLE_OBJS := $(addprefix $(BUILD_PLAT)/ble/,$(call SOURCES_TO_OBJS,$(BLE_SOURCES))) $(BLE_OBJS): PLAT_INCLUDES += -I$(MV_DDR_PATH) +$(BLE_OBJS): $(MV_DDR_LIB) $(MV_DDR_LIB): FORCE $(if $(value MV_DDR_PATH),,$(error "Platform '$(PLAT)' for BLE requires MV_DDR_PATH. Please set MV_DDR_PATH to point to the right directory")) From 2baf50385ba2b460afef4a7919b13b3a350fd03a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 7 Jul 2021 12:14:20 +0200 Subject: [PATCH 4/8] fix(plat/marvell/a3k): Fix check for external dependences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Old Marvell a3700_utils and mv-ddr tarballs do not have to work with latest TF-A code base. Marvell do not provide these old tarballs on Extranet anymore. Public version on github repository contains all patches and is working fine, so for public TF-A builds use only public external dependencies from git. Signed-off-by: Pali Rohár Change-Id: Iee5ac6daa9a1826a5b80a8d54968bdbb8fe72f61 --- docs/plat/marvell/armada/build.rst | 30 +++++++++++-------- .../marvell/armada/a3k/common/a3700_common.mk | 4 +-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/plat/marvell/armada/build.rst b/docs/plat/marvell/armada/build.rst index fcc74a51e..09b4fa4c3 100644 --- a/docs/plat/marvell/armada/build.rst +++ b/docs/plat/marvell/armada/build.rst @@ -130,16 +130,15 @@ There are several build options: - MV_DDR_PATH This parameter is required for ``mrvl_flash`` and ``mrvl_uart`` targets. + For A7K/8K/CN913x it is used for BLE build and for Armada37x0 it used + for ddr_tool build. - For A7K/8K/CN913x, use this parameter to point to mv_ddr driver sources to allow BLE build. For A37x0, - it is used for ddr_tool build. + Specify path to the full checkout of Marvell mv-ddr-marvell git + repository. Checkout must contain also .git subdirectory because + mv-ddr build process calls git commands. - Usage example: MV_DDR_PATH=path/to/mv_ddr - - For the mv_ddr source location, check the section "Tools and external components installation" - - If MV_DDR_PATH source code is a git snapshot then provide path to the full git - repository (including .git subdir) because mv_ddr build process calls git commands. + Do not remove any parts of git checkout becuase build process and other + applications need them for correct building and version determination. - CP_NUM @@ -234,12 +233,17 @@ There are several build options: - WTP - For Armada37x0 only, use this parameter to point to wtptools source code - directory, which can be found as a3700_utils.zip in the release. Usage - example: ``WTP=/path/to/a3700_utils`` + For Armada37x0 only. - If WTP source code is a git snapshot then provide path to the full git - repository (including .git subdir) because WTP build process calls git commands. + Specify path to the full checkout of Marvell A3700-utils-marvell git + repository. Checkout must contain also .git subdirectory because WTP + build process calls git commands. + + WTP build process uses also Marvell mv-ddr-marvell git repository + specified in MV_DDR_PATH option. + + Do not remove any parts of git checkout becuase build process and other + applications need them for correct building and version determination. - CRYPTOPP_PATH diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index 7d95e4827..97f3ccbf1 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -74,7 +74,7 @@ endif ifdef WTP $(if $(wildcard $(value WTP)/*),,$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' directory does not exist")) -$(if $(shell test -s "$(value WTP)/branch.txt" || git -C $(value WTP) rev-parse --show-cdup 2>&1),$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' does not contain valid Marvell a3700_utils release tarball nor git repository")) +$(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")) DOIMAGEPATH := $(WTP) DOIMAGETOOL := $(DOIMAGEPATH)/wtptp/src/TBB_Linux/release/TBB_linux @@ -152,7 +152,7 @@ $(BUILD_PLAT)/wtmi.bin: $(WTMI_MULTI_IMG) $(TIMDDRTOOL): FORCE $(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")) $(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")) - $(if $(shell test -s "$(value MV_DDR_PATH)/branch.txt" || 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 Marvell mv_ddr release tarball nor git repository")) + $(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")) $(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH) MV_DDR_PATH=$(MV_DDR_PATH) DDR_TOPOLOGY=$(DDR_TOPOLOGY) mv_ddr $(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(DOIMAGETOOL) $(TIMBUILD) $(TIMDDRTOOL) From 7b209717d9681ea26349eb8a70308a4eb7638f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 10 Jul 2021 14:54:44 +0200 Subject: [PATCH 5/8] refactor(plat/marvell/a3k): Remove useless DOIMAGEPATH variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Armada 3700 uses WTP so use WTP variable directly. Signed-off-by: Pali Rohár Change-Id: I216b40ffee1f3f8abba4677f050ab376c2224ede --- .../marvell/armada/a3k/common/a3700_common.mk | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index 97f3ccbf1..71cf2ea2f 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -76,8 +76,7 @@ ifdef WTP $(if $(wildcard $(value WTP)/*),,$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' directory does not exist")) $(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")) -DOIMAGEPATH := $(WTP) -DOIMAGETOOL := $(DOIMAGEPATH)/wtptp/src/TBB_Linux/release/TBB_linux +DOIMAGETOOL := $(WTP)/wtptp/src/TBB_Linux/release/TBB_linux BUILD_UART := uart-images UART_IMAGE := $(BUILD_UART).tgz.bin @@ -85,7 +84,7 @@ UART_IMAGE := $(BUILD_UART).tgz.bin ifeq ($(MARVELL_SECURE_BOOT),1) DOIMAGE_CFG := $(BUILD_PLAT)/atf-tim.txt DOIMAGEUART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-tim.txt -IMAGESPATH := $(DOIMAGEPATH)/tim/trusted +IMAGESPATH := $(WTP)/tim/trusted TIMNCFG := $(BUILD_PLAT)/atf-timN.txt TIMNUARTCFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt TIMNSIG := $(IMAGESPATH)/timnsign.txt @@ -94,24 +93,24 @@ TIMN_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMNCFG) | cut -c 17-) else #MARVELL_SECURE_BOOT DOIMAGE_CFG := $(BUILD_PLAT)/atf-ntim.txt DOIMAGEUART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt -IMAGESPATH := $(DOIMAGEPATH)/tim/untrusted +IMAGESPATH := $(WTP)/tim/untrusted TIM2IMGARGS := -i $(DOIMAGE_CFG) endif #MARVELL_SECURE_BOOT -TIMBUILD := $(DOIMAGEPATH)/script/buildtim.sh -TIM2IMG := $(DOIMAGEPATH)/script/tim2img.pl -TIMDDRTOOL := $(DOIMAGEPATH)/tim/ddr/ddr_tool +TIMBUILD := $(WTP)/script/buildtim.sh +TIM2IMG := $(WTP)/script/tim2img.pl +TIMDDRTOOL := $(WTP)/tim/ddr/ddr_tool $(TIMBUILD): $(TIMDDRTOOL) # WTMI_IMG is used to specify the customized RTOS image running over # Service CPU (CM3 processor). By the default, it points to a # baremetal binary of fuse programming in A3700_utils. -WTMI_IMG := $(DOIMAGEPATH)/wtmi/fuse/build/fuse.bin +WTMI_IMG := $(WTP)/wtmi/fuse/build/fuse.bin # WTMI_MULTI_IMG is composed of CM3 RTOS image (WTMI_IMG) # and sys-init image. -WTMI_MULTI_IMG := $(DOIMAGEPATH)/wtmi/build/wtmi.bin +WTMI_MULTI_IMG := $(WTP)/wtmi/build/wtmi.bin WTMI_ENC_IMG := wtmi-enc.bin @@ -125,9 +124,9 @@ BOOTDEV ?= SPINOR PARTNUM ?= 0 TIM_IMAGE := $$(grep "Image Filename:" -m 1 $(DOIMAGE_CFG) | cut -c 17-) -TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(DOIMAGEPATH) $(CLOCKSPRESET) \ +TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(DOIMAGE_CFG) $(TIMNCFG) $(TIMNSIG) 1 -TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(DOIMAGEPATH) $(CLOCKSPRESET) \ +TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ $(DDR_TOPOLOGY) 0 0 $(DOIMAGEUART_CFG) $(TIMNUARTCFG) $(TIMNSIG) 0 CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) @@ -141,10 +140,10 @@ $(DOIMAGETOOL): FORCE ifdef CRYPTOPP_PATH $(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile endif - $(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH)/wtptp/src/TBB_Linux -f TBB_linux.mak LIBDIR=$(CRYPTOPP_LIBDIR) INCDIR=$(CRYPTOPP_INCDIR) + $(Q)$(MAKE) --no-print-directory -C $(WTP)/wtptp/src/TBB_Linux -f TBB_linux.mak LIBDIR=$(CRYPTOPP_LIBDIR) INCDIR=$(CRYPTOPP_INCDIR) $(WTMI_MULTI_IMG): FORCE - $(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH) WTMI_IMG=$(WTMI_IMG) DDR_TOPOLOGY=$(DDR_TOPOLOGY) CLOCKSPRESET=$(CLOCKSPRESET) WTMI + $(Q)$(MAKE) --no-print-directory -C $(WTP) WTMI_IMG=$(WTMI_IMG) DDR_TOPOLOGY=$(DDR_TOPOLOGY) CLOCKSPRESET=$(CLOCKSPRESET) WTMI $(BUILD_PLAT)/wtmi.bin: $(WTMI_MULTI_IMG) $(Q)cp -a $(WTMI_MULTI_IMG) $(BUILD_PLAT)/wtmi.bin @@ -153,7 +152,7 @@ $(TIMDDRTOOL): FORCE $(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")) $(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")) $(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")) - $(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH) MV_DDR_PATH=$(MV_DDR_PATH) DDR_TOPOLOGY=$(DDR_TOPOLOGY) mv_ddr + $(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) DDR_TOPOLOGY=$(DDR_TOPOLOGY) mv_ddr $(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(DOIMAGETOOL) $(TIMBUILD) $(TIMDDRTOOL) @$(ECHO_BLANK_LINE) @@ -218,8 +217,8 @@ clean realclean distclean: mrvl_clean .PHONY: mrvl_clean mrvl_clean: - -$(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH) MV_DDR_PATH=$(MV_DDR_PATH) clean - -$(Q)$(MAKE) --no-print-directory -C $(DOIMAGEPATH)/wtptp/src/TBB_Linux -f TBB_linux.mak clean + -$(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) clean + -$(Q)$(MAKE) --no-print-directory -C $(WTP)/wtptp/src/TBB_Linux -f TBB_linux.mak clean ifdef CRYPTOPP_PATH -$(Q)$(MAKE) --no-print-directory -C $(CRYPTOPP_PATH) -f GNUmakefile clean endif From 7937b3c70ca1aff26be822677c1072a7f0500766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sat, 10 Jul 2021 15:04:53 +0200 Subject: [PATCH 6/8] refactor(plat/marvell/a3k): Rename DOIMAGETOOL to TBB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Armada 3700 uses external TBB tool for creating images and does not use internal TF-A doimage tool from tools/marvell/doimage/ Therefore set correct name of variable. Signed-off-by: Pali Rohár Change-Id: I38a94dca78d483de4c79da597c032e1e5d06d92d --- plat/marvell/armada/a3k/common/a3700_common.mk | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index 71cf2ea2f..78c131dc3 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -76,7 +76,7 @@ ifdef WTP $(if $(wildcard $(value WTP)/*),,$(error "'WTP=$(value WTP)' was specified, but '$(value WTP)' directory does not exist")) $(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")) -DOIMAGETOOL := $(WTP)/wtptp/src/TBB_Linux/release/TBB_linux +TBB := $(WTP)/wtptp/src/TBB_Linux/release/TBB_linux BUILD_UART := uart-images UART_IMAGE := $(BUILD_UART).tgz.bin @@ -132,7 +132,7 @@ TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRES CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) CRYPTOPP_INCDIR ?= $(CRYPTOPP_PATH) -$(DOIMAGETOOL): FORCE +$(TBB): FORCE $(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")) $(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")) $(if $(wildcard $(CRYPTOPP_LIBDIR)/*),,$(error "Either 'CRYPTOPP_PATH' or 'CRYPTOPP_LIB' was set to '$(CRYPTOPP_LIBDIR)', but '$(CRYPTOPP_LIBDIR)' does not exist")) @@ -154,7 +154,7 @@ $(TIMDDRTOOL): FORCE $(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")) $(Q)$(MAKE) --no-print-directory -C $(WTP) MV_DDR_PATH=$(MV_DDR_PATH) DDR_TOPOLOGY=$(DDR_TOPOLOGY) mv_ddr -$(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(DOIMAGETOOL) $(TIMBUILD) $(TIMDDRTOOL) +$(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(TBB) $(TIMBUILD) $(TIMDDRTOOL) @$(ECHO_BLANK_LINE) @echo "Building uart images" $(Q)mkdir -p $(BUILD_PLAT)/$(BUILD_UART) @@ -167,16 +167,16 @@ ifeq ($(MARVELL_SECURE_BOOT),1) $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMNUARTCFG) $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMNUARTCFG) endif - $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(DOIMAGETOOL) -r $(DOIMAGEUART_CFG) -v -D + $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(DOIMAGEUART_CFG) -v -D ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(DOIMAGETOOL) -r $(TIMNUARTCFG) + $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMNUARTCFG) endif $(Q)tar czf $(BUILD_PLAT)/$(UART_IMAGE) -C $(BUILD_PLAT) $(BUILD_UART)/$(TIM_IMAGE) $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin @$(ECHO_BLANK_LINE) @echo "Built $@ successfully" @$(ECHO_BLANK_LINE) -$(BUILD_PLAT)/$(FLASH_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(DOIMAGETOOL) $(TIMBUILD) $(TIMDDRTOOL) $(TIM2IMG) +$(BUILD_PLAT)/$(FLASH_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(TBB) $(TIMBUILD) $(TIMDDRTOOL) $(TIM2IMG) @$(ECHO_BLANK_LINE) @echo "Building flash image" $(Q)cd $(BUILD_PLAT) && $(TIMBUILD) $(TIMBLDARGS) @@ -202,9 +202,9 @@ ifeq ($(MARVELL_SECURE_BOOT),1) -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ -iv `cat $(IMAGESPATH)/iv.txt` -p endif - $(Q)cd $(BUILD_PLAT) && $(DOIMAGETOOL) -r $(DOIMAGE_CFG) -v -D + $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(DOIMAGE_CFG) -v -D ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)cd $(BUILD_PLAT) && $(DOIMAGETOOL) -r $(TIMNCFG) + $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIMNCFG) $(Q)sed -i 's|wtmi.bin|$(WTMI_ENC_IMG)|1' $(TIMNCFG) $(Q)sed -i 's|$(BOOT_IMAGE)|$(BOOT_ENC_IMAGE)|1' $(TIMNCFG) endif From 618287dac61f083e6bc896f9362adb2ad207c74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 11 Jul 2021 14:46:49 +0200 Subject: [PATCH 7/8] refactor(plat/marvell/a3k): Rename *_CFG and *_SIG variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For TIM config file use TIM name instead of DOIMAGE and use underscores to make variable names more readable. Signed-off-by: Pali Rohár Change-Id: I1282ce11f1431c15458a143ae7bfcee85eed2432 --- .../marvell/armada/a3k/common/a3700_common.mk | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index 78c131dc3..a89b3a50e 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -82,19 +82,19 @@ BUILD_UART := uart-images UART_IMAGE := $(BUILD_UART).tgz.bin ifeq ($(MARVELL_SECURE_BOOT),1) -DOIMAGE_CFG := $(BUILD_PLAT)/atf-tim.txt -DOIMAGEUART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-tim.txt +TIM_CFG := $(BUILD_PLAT)/atf-tim.txt +TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-tim.txt IMAGESPATH := $(WTP)/tim/trusted -TIMNCFG := $(BUILD_PLAT)/atf-timN.txt -TIMNUARTCFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt -TIMNSIG := $(IMAGESPATH)/timnsign.txt -TIM2IMGARGS := -i $(DOIMAGE_CFG) -n $(TIMNCFG) -TIMN_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMNCFG) | cut -c 17-) +TIMN_CFG := $(BUILD_PLAT)/atf-timN.txt +TIMN_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt +TIMN_SIG := $(IMAGESPATH)/timnsign.txt +TIM2IMGARGS := -i $(TIM_CFG) -n $(TIMN_CFG) +TIMN_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMN_CFG) | cut -c 17-) else #MARVELL_SECURE_BOOT -DOIMAGE_CFG := $(BUILD_PLAT)/atf-ntim.txt -DOIMAGEUART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt +TIM_CFG := $(BUILD_PLAT)/atf-ntim.txt +TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt IMAGESPATH := $(WTP)/tim/untrusted -TIM2IMGARGS := -i $(DOIMAGE_CFG) +TIM2IMGARGS := -i $(TIM_CFG) endif #MARVELL_SECURE_BOOT TIMBUILD := $(WTP)/script/buildtim.sh @@ -123,11 +123,11 @@ DDR_TOPOLOGY ?= 0 BOOTDEV ?= SPINOR PARTNUM ?= 0 -TIM_IMAGE := $$(grep "Image Filename:" -m 1 $(DOIMAGE_CFG) | cut -c 17-) +TIM_IMAGE := $$(grep "Image Filename:" -m 1 $(TIM_CFG) | cut -c 17-) TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ - $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(DOIMAGE_CFG) $(TIMNCFG) $(TIMNSIG) 1 + $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(TIM_CFG) $(TIMN_CFG) $(TIMN_SIG) 1 TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ - $(DDR_TOPOLOGY) 0 0 $(DOIMAGEUART_CFG) $(TIMNUARTCFG) $(TIMNSIG) 0 + $(DDR_TOPOLOGY) 0 0 $(TIM_UART_CFG) $(TIMN_UART_CFG) $(TIMN_SIG) 0 CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) CRYPTOPP_INCDIR ?= $(CRYPTOPP_PATH) @@ -161,15 +161,15 @@ $(BUILD_PLAT)/$(UART_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin $(Q)cp -a $(BUILD_PLAT)/wtmi.bin $(BUILD_PLAT)/$(BUILD_UART)/wtmi.bin $(Q)cp -a $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/$(BUILD_UART)/$(BOOT_IMAGE) $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TIMBUILD) $(TIMBLDUARTARGS) - $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(DOIMAGEUART_CFG) - $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(DOIMAGEUART_CFG) + $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_UART_CFG) + $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIM_UART_CFG) ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMNUARTCFG) - $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMNUARTCFG) + $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_UART_CFG) + $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMN_UART_CFG) endif - $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(DOIMAGEUART_CFG) -v -D + $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIM_UART_CFG) -v -D ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMNUARTCFG) + $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMN_UART_CFG) endif $(Q)tar czf $(BUILD_PLAT)/$(UART_IMAGE) -C $(BUILD_PLAT) $(BUILD_UART)/$(TIM_IMAGE) $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin @$(ECHO_BLANK_LINE) @@ -180,11 +180,11 @@ $(BUILD_PLAT)/$(FLASH_IMAGE): $(BUILD_PLAT)/$(BOOT_IMAGE) $(BUILD_PLAT)/wtmi.bin @$(ECHO_BLANK_LINE) @echo "Building flash image" $(Q)cd $(BUILD_PLAT) && $(TIMBUILD) $(TIMBLDARGS) - $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(DOIMAGE_CFG) - $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(DOIMAGE_CFG) + $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIM_CFG) + $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIM_CFG) ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMNCFG) - $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMNCFG) + $(Q)sed -i 's|WTMI_IMG|wtmi.bin|1' $(TIMN_CFG) + $(Q)sed -i 's|BOOT_IMAGE|$(BOOT_IMAGE)|1' $(TIMN_CFG) @$(ECHO_BLANK_LINE) @echo "======================================================="; @echo " Secure boot. Encrypting wtmi and boot-image"; @@ -202,11 +202,11 @@ ifeq ($(MARVELL_SECURE_BOOT),1) -K `cat $(IMAGESPATH)/aes-256.txt` -nosalt \ -iv `cat $(IMAGESPATH)/iv.txt` -p endif - $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(DOIMAGE_CFG) -v -D + $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIM_CFG) -v -D ifeq ($(MARVELL_SECURE_BOOT),1) - $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIMNCFG) - $(Q)sed -i 's|wtmi.bin|$(WTMI_ENC_IMG)|1' $(TIMNCFG) - $(Q)sed -i 's|$(BOOT_IMAGE)|$(BOOT_ENC_IMAGE)|1' $(TIMNCFG) + $(Q)cd $(BUILD_PLAT) && $(TBB) -r $(TIMN_CFG) + $(Q)sed -i 's|wtmi.bin|$(WTMI_ENC_IMG)|1' $(TIMN_CFG) + $(Q)sed -i 's|$(BOOT_IMAGE)|$(BOOT_ENC_IMAGE)|1' $(TIMN_CFG) endif $(Q)cd $(BUILD_PLAT) && $(TIM2IMG) $(TIM2IMGARGS) -o $(BUILD_PLAT)/$(FLASH_IMAGE) @$(ECHO_BLANK_LINE) From d3f8db07b618e79c05805a1598e5e834e42fea98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Sun, 11 Jul 2021 17:33:37 +0200 Subject: [PATCH 8/8] fix(plat/marvell/a3k): Fix building uart-images.tgz.bin archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For UART secure boot it is required also TIMN image, so pack it into uart-images.tgz.bin archive which is created by mrvl_uart target. $(TIMN_IMAGE) and $(TIM_IMAGE) variables are used only for UART images so their content needs to be initialized from $(TIMN_UART_CFG) and $(TIM_UART_CFG) config files. And not from $(TIMN_CFG) and $(TIM_CFG) as it is now because they are not generated during mrvl_uart target. Fix it to allow building mrvl_uart target before mrvl_flash target. To match usage of these variables, rename them to $(TIMN_UART_IMAGE) and $(TIM_UART_IMAGE). To not complicate rule for building uart-images.tgz.bin archive, set list of image files into a new $(UART_IMAGES) variable. Signed-off-by: Pali Rohár Change-Id: I83b980abb4047a3afb3ce3026842e1d873c490bf --- plat/marvell/armada/a3k/common/a3700_common.mk | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index a89b3a50e..0a8974293 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -89,7 +89,7 @@ TIMN_CFG := $(BUILD_PLAT)/atf-timN.txt TIMN_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-timN.txt TIMN_SIG := $(IMAGESPATH)/timnsign.txt TIM2IMGARGS := -i $(TIM_CFG) -n $(TIMN_CFG) -TIMN_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMN_CFG) | cut -c 17-) +TIMN_UART_IMAGE := $$(grep "Image Filename:" -m 1 $(TIMN_UART_CFG) | cut -c 17-) else #MARVELL_SECURE_BOOT TIM_CFG := $(BUILD_PLAT)/atf-ntim.txt TIM_UART_CFG := $(BUILD_PLAT)/$(BUILD_UART)/atf-ntim.txt @@ -97,6 +97,8 @@ IMAGESPATH := $(WTP)/tim/untrusted TIM2IMGARGS := -i $(TIM_CFG) endif #MARVELL_SECURE_BOOT +TIM_UART_IMAGE := $$(grep "Image Filename:" -m 1 $(TIM_UART_CFG) | cut -c 17-) + TIMBUILD := $(WTP)/script/buildtim.sh TIM2IMG := $(WTP)/script/tim2img.pl TIMDDRTOOL := $(WTP)/tim/ddr/ddr_tool @@ -123,12 +125,17 @@ DDR_TOPOLOGY ?= 0 BOOTDEV ?= SPINOR PARTNUM ?= 0 -TIM_IMAGE := $$(grep "Image Filename:" -m 1 $(TIM_CFG) | cut -c 17-) TIMBLDARGS := $(MARVELL_SECURE_BOOT) $(BOOTDEV) $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ $(DDR_TOPOLOGY) $(PARTNUM) $(DEBUG) $(TIM_CFG) $(TIMN_CFG) $(TIMN_SIG) 1 TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(WTP) $(CLOCKSPRESET) \ $(DDR_TOPOLOGY) 0 0 $(TIM_UART_CFG) $(TIMN_UART_CFG) $(TIMN_SIG) 0 +UART_IMAGES := $(BUILD_UART)/$(TIM_UART_IMAGE) +ifeq ($(MARVELL_SECURE_BOOT),1) +UART_IMAGES += $(BUILD_UART)/$(TIMN_UART_IMAGE) +endif +UART_IMAGES += $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin + CRYPTOPP_LIBDIR ?= $(CRYPTOPP_PATH) CRYPTOPP_INCDIR ?= $(CRYPTOPP_PATH) @@ -171,7 +178,7 @@ endif ifeq ($(MARVELL_SECURE_BOOT),1) $(Q)cd $(BUILD_PLAT)/$(BUILD_UART) && $(TBB) -r $(TIMN_UART_CFG) endif - $(Q)tar czf $(BUILD_PLAT)/$(UART_IMAGE) -C $(BUILD_PLAT) $(BUILD_UART)/$(TIM_IMAGE) $(BUILD_UART)/wtmi_h.bin $(BUILD_UART)/boot-image_h.bin + $(Q)tar czf $(BUILD_PLAT)/$(UART_IMAGE) -C $(BUILD_PLAT) $(UART_IMAGES) @$(ECHO_BLANK_LINE) @echo "Built $@ successfully" @$(ECHO_BLANK_LINE)