arm-trusted-firmware-mvebu: add cryptopp
authorJosef Schlehofer <pepe.schlehofer@gmail.com>
Tue, 14 Sep 2021 12:40:54 +0000 (14:40 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 27 Nov 2021 18:36:36 +0000 (19:36 +0100)
Based on the Build Instructions for Trusted-Firmware-A [1],
there is a required cryptopp [2].

In the past, it used 'tbb_linux' image tool binary, which seems to
be buggy, deprecated and removed from A3700-utils-marvell and it should
not be used anymore. That's why I removed 001-imagetool.patch, which is
no longer necessary.

[1] https://trustedfirmware-a.readthedocs.io/en/v2.5/plat/marvell/armada/build.html
[2] https://cryptopp.com/

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
package/boot/arm-trusted-firmware-mvebu/Makefile
package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch [deleted file]

index 32f2555d8a0673aa3dd41a7265476a10a198f561..7735895df363479cfbd493e4c750ffb6cafd92aa 100644 (file)
@@ -112,6 +112,7 @@ TFA_MAKE_FLAGS += \
                MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
                WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
                WTMI_IMG=$(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE)/wtmi_app.bin \
+               CRYPTOPP_PATH=$(STAGING_DIR_IMAGE)/$(CRYPTOPP_NAME) \
                USE_COHERENT_MEM=0 \
                FIP_ALIGN=0x100 \
                DDR_TOPOLOGY=$(DDR_TOPOLOGY) \
@@ -135,6 +136,19 @@ define Download/a3700-utils
   SUBDIR:=$(A3700_UTILS_NAME)
 endef
 
+CRYPTOPP_NAME:=cryptopp
+CRYPTOPP_RELEASE:=f210224
+CRYPTOPP_SOURCE=$(CRYPTOPP_NAME)-$(CRYPTOPP_RELEASE).tar.bz2
+
+define Download/cryptopp
+  FILE:=$(CRYPTOPP_SOURCE)
+  PROTO:=git
+  URL:=https://github.com/weidai11/cryptopp.git
+  VERSION:=f2102243e6fdd48c0b2a393a0993cca228f20573
+  MIRROR_HASH:=74ec9e48ee04b9f2d9a1d8c4f2392ed0ab52780d7af0f70405d7bbb23d1504fa
+  SUBDIR:=$(CRYPTOPP_NAME)
+endef
+
 MV_DDR_NAME:=mv-ddr-marvell
 MV_DDR_RELEASE:=02e23dbc
 MV_DDR_SOURCE:=$(MV_DDR_NAME)-$(MV_DDR_RELEASE).tar.bz2
@@ -175,6 +189,7 @@ endef
 
 define Build/Clean
        rm -rf \
+               $(STAGING_DIR_IMAGE)/$(CRYPTOPP_NAME) \
                $(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
                $(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
                $(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE) \
@@ -186,11 +201,13 @@ define Build/Prepare
        $(eval $(call Download,a3700-utils))
        $(eval $(call Download,mv-ddr-marvell))
        $(eval $(call Download,mox-boot-builder))
+       $(eval $(call Download,cryptopp))
        $(eval $(call Download,cm3-gcc))
 
        $(call Build/Prepare/Default,)
 
        mkdir -p $(STAGING_DIR_IMAGE)
+       $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(CRYPTOPP_SOURCE)
        $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE)
        echo "master" > $(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME)/branch.txt
        $(call PatchDir/Default,$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME),./patches-a3700-utils)
@@ -206,6 +223,7 @@ define Build/Compile
        +$(MAKE) \
                CROSS_CM3=$(STAGING_DIR_IMAGE)/$(CM3_GCC_NAME)-$(CM3_GCC_RELEASE)-$(CM3_GCC_VERSION)/bin/arm-none-eabi- \
                WTMI_VERSION=$(MOX_BB_RELEASE) \
+               CRYPTOPP_PATH=$PWD/cryptopp/ \
                -C $(STAGING_DIR_IMAGE)/$(MOX_BB_NAME)-$(MOX_BB_RELEASE) \
                wtmi_app.bin
        $(call Build/Compile/Default)
diff --git a/package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch b/package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch
deleted file mode 100644 (file)
index 1b4bb09..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/plat/marvell/armada/a3k/common/a3700_common.mk
-+++ b/plat/marvell/armada/a3k/common/a3700_common.mk
-@@ -76,7 +76,7 @@ $(if $(wildcard $(value WTP)/*),,$(error
- $(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"))
- DOIMAGEPATH   := $(WTP)
--DOIMAGETOOL   := $(DOIMAGEPATH)/wtptp/src/TBB_Linux/release/TBB_linux
-+DOIMAGETOOL   := $(DOIMAGEPATH)/wtptp/linux/tbb_linux
- BUILD_UART    := uart-images
- UART_IMAGE    := $(BUILD_UART).tgz.bin
-@@ -132,7 +132,7 @@ TIMBLDUARTARGS             := $(MARVELL_SECURE_BOOT
- CRYPTOPP_LIBDIR               ?= $(CRYPTOPP_PATH)
- CRYPTOPP_INCDIR               ?= $(CRYPTOPP_PATH)
--$(DOIMAGETOOL): FORCE
-+$(DOIMAGETOOL):
-       $(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"))