br-ext: Rename OP-TEE packages with _ext suffix

Rename OP-TEE packages in br-ext with a _ext suffix so that
they do not conflict with the OP-TEE packages from Buildroot.

This change essentially renames Buildroot configuration switches
BR2_OPTEE_* to BR2_OPTEE_*_EXT_* without changing the current build
process.

This change is needed for OP-TEE build environment to synchronize with
Buildroot GIT version [1] or later in the Buildroot integration tree.
[1] points where OP-TEE packages were introduced in Buildroot,
right after 2019.02 is released. This was tested with all Buildroot
release tags from 2018.11 to 2020.02, and recent 2020.05-rc1.

Link: [1] https://git.buildroot.net/buildroot/commit/?id=da49312af9e0c3e7f6df50e7d6f77e1fa2921b7a
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/br-ext/package/optee_test_ext/Config.in b/br-ext/package/optee_test_ext/Config.in
new file mode 100644
index 0000000..47bc8ca
--- /dev/null
+++ b/br-ext/package/optee_test_ext/Config.in
@@ -0,0 +1,27 @@
+config BR2_PACKAGE_OPTEE_TEST_EXT
+	bool "optee_test"
+	select BR2_PACKAGE_OPTEE_CLIENT_EXT
+	help
+	  http://github.org/OP-TEE/optee_test
+
+if BR2_PACKAGE_OPTEE_TEST_EXT
+
+config BR2_PACKAGE_OPTEE_TEST_EXT_SITE
+	string "OP-TEE test path"
+	default ""
+	help
+	  The path to the source directory of OP-TEE test
+
+config BR2_PACKAGE_OPTEE_TEST_EXT_SDK
+	string "OPTEE SDK path"
+	default ""
+	help
+	  some help
+
+config BR2_PACKAGE_OPTEE_TEST_EXT_CROSS_COMPILE
+	string "OPTEE cross compiler"
+	default ""
+	help
+	  some help
+
+endif
diff --git a/br-ext/package/optee_test_ext/optee_test_ext.mk b/br-ext/package/optee_test_ext/optee_test_ext.mk
new file mode 100644
index 0000000..38f5212
--- /dev/null
+++ b/br-ext/package/optee_test_ext/optee_test_ext.mk
@@ -0,0 +1,29 @@
+OPTEE_TEST_EXT_VERSION = 1.0
+OPTEE_TEST_EXT_SOURCE = local
+OPTEE_TEST_EXT_SITE = $(BR2_PACKAGE_OPTEE_TEST_EXT_SITE)
+OPTEE_TEST_EXT_SITE_METHOD = local
+OPTEE_TEST_EXT_INSTALL_STAGING = YES
+OPTEE_TEST_EXT_DEPENDENCIES = optee_client_ext openssl host-python-pycrypto
+OPTEE_TEST_EXT_SDK = $(BR2_PACKAGE_OPTEE_TEST_EXT_SDK)
+OPTEE_TEST_EXT_CONF_OPTS = -DOPTEE_TEST_SDK=$(OPTEE_TEST_EXT_SDK)
+
+define OPTEE_TEST_EXT_BUILD_TAS
+	@$(foreach f,$(wildcard $(@D)/ta/*/Makefile), \
+		echo Building $f && \
+			$(MAKE) CROSS_COMPILE="$(shell echo $(BR2_PACKAGE_OPTEE_TEST_EXT_CROSS_COMPILE))" \
+			O=out TA_DEV_KIT_DIR=$(OPTEE_TEST_EXT_SDK) \
+			$(TARGET_CONFIGURE_OPTS) -C $(dir $f) all &&) true
+endef
+
+define OPTEE_TEST_EXT_INSTALL_TAS
+	@$(foreach f,$(wildcard $(@D)/ta/*/out/*.ta), \
+		mkdir -p $(TARGET_DIR)/lib/optee_armtz && \
+		$(INSTALL) -v -p  --mode=444 \
+			--target-directory=$(TARGET_DIR)/lib/optee_armtz $f \
+			&&) true
+endef
+
+OPTEE_TEST_EXT_POST_BUILD_HOOKS += OPTEE_TEST_EXT_BUILD_TAS
+OPTEE_TEST_EXT_POST_INSTALL_TARGET_HOOKS += OPTEE_TEST_EXT_INSTALL_TAS
+
+$(eval $(cmake-package))