[openwrt/openwrt] arm-trusted-firmware-mvebu: add cryptopp

LEDE Commits lede-commits at lists.infradead.org
Sat Nov 27 12:23:21 PST 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/8d9f462731c887c65355d8a771a2adcb6453e28f

commit 8d9f462731c887c65355d8a771a2adcb6453e28f
Author: Josef Schlehofer <pepe.schlehofer at gmail.com>
AuthorDate: Tue Sep 14 14:40:54 2021 +0200

    arm-trusted-firmware-mvebu: add cryptopp
    
    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 at gmail.com>
---
 package/boot/arm-trusted-firmware-mvebu/Makefile     | 18 ++++++++++++++++++
 .../patches/001-imagetool.patch                      | 20 --------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/package/boot/arm-trusted-firmware-mvebu/Makefile b/package/boot/arm-trusted-firmware-mvebu/Makefile
index 32f2555d8a..7735895df3 100644
--- a/package/boot/arm-trusted-firmware-mvebu/Makefile
+++ b/package/boot/arm-trusted-firmware-mvebu/Makefile
@@ -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
index 1b4bb09c8c..0000000000
--- a/package/boot/arm-trusted-firmware-mvebu/patches/001-imagetool.patch
+++ /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"))



More information about the lede-commits mailing list