Use conf path instead of manifest xml path 04/192004/2
authorIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Fri, 26 Oct 2018 10:08:40 +0000 (12:08 +0200)
committerIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Fri, 26 Oct 2018 12:59:08 +0000 (14:59 +0200)
The old way required us to always provide *some* manifest file. Now we
can just provide a base directory for any backend-defined configuration
directories and extract the manifest xml by convention.

Change-Id: I27a39a3df95a5a73d9830b325413dd5f68bab657
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@partner.samsung.com>
README.md
cmake/UnifiedTADevkit.cmake.optee.in
cmake/UnifiedTADevkit.cmake.simulator.in
cmake/UnifiedTADevkit.cmake.template.in
doc/CMakeLists.txt

index 99ba8125b591718375dd5b54cafc720333c5c4c2..bacfca0948ca657133e71e1f66b329cfa4224e3f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,22 +42,23 @@ E.g.:
 OpTEE implementation of **UnifiedTADevkit.cmake.template.in** is named **UnifiedTADevkit.cmake.optee.in**.
 
 #### Implementation of UnifiedTADevkit.cmake.template.in
-Implementation of **UnifiedTADevkit.cmake.template.in** should contains all defines/includes/targets needed by TEEOS devkit. Includes UnifiedTADevkitCommon.cmake. Implementing this file is mandatory. You should also implement:
+Implementation of **UnifiedTADevkit.cmake.template.in** should contain all defines/includes/targets needed by TEEOS devkit. Includes UnifiedTADevkitCommon.cmake. Implementing this file is mandatory. You should also implement:
 
 ```cmake
 # MACRO GENERATE_TA_IMAGE unifies compiling dependencies and signing/encrypting
 # Parameters:
 # TargetName        [in]    - name of target that represent TA
 # TAElfTargetName   [in]    - TA binary target name before signing
-# TAManifestFile    [in]    - manifest file name with a path
+# TAConfDir         [in]    - backend-specific configuration directory
 # TAImageName       [in]    - final TA binary name
 
-MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAManifestFile TAImageName)
+MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAConfDir TAImageName)
     # Fill this function with Your implementation
 ENDMACRO()
 ```
 
 TAElfTargetName - should be a target from ADD_EXECUTABLE or ADD_LIBRARY
+TAConfDir - This is a base directory for backend-specific configurations. Your backend can require specific files to be put in a subdirectory matching you backend's name, in order to use them for building the TA.
 
 #### UnifiedTADevkitCommon.cmake
 Defines common variables for all backends.
@@ -133,3 +134,9 @@ TARGET_LINK_LIBRARIES(${TARGET_YOUR_TA}
     ${YOUR_TA_DEPS_STATIC_LIBRARIES}
     )
 ```
+
+Different TEE backends use different methods of configuration - for example, OpTEE requires a configuration header, while the simulator requires an xml manifest. For that purpose, you should prepare a directory with backend-specific configurations. The backends use following files:
+- OpTEE - (base directory)/optee/include/user_ta_header_defines.h
+- Simulator - (base directory)/simulator/manifest.xml
+
+Once configuration is provided, you can use the GENERATE_TA_IMAGE macro to creae the TA image.
index abe59b8bc7b618f794d8c1ecebbf6b0aa6bb4aa0..4ddc3f9dba38c0af9f989d11de4eb2056c6ebc90 100644 (file)
@@ -82,10 +82,10 @@ ADD_LIBRARY(${DEVKIT_TA_TARGET} STATIC
 # Parameters:
 # TargetName        [in]    - name of target that represent TA
 # TAElfTargetName   [in]    - TA binary target name before signing
-# TAManifestFile    [in]    - manifest file name with a path (tef-simulator)
+# TAConfDir         [in]    - backend-specific configuration directory
 # TAImageName       [in]    - final TA binary name
 
-MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAManifestFile TAImageName)
+MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAConfDir TAImageName)
     # Dependency to compiled linker script
     ADD_DEPENDENCIES(${TAElfTargetName} ta-core-ld ${DEVKIT_TA_TARGET})
 
index 317de49ba05f82ed754fbe5639f85135964dca1c..856fb8d7f085becca7d06256b24045758faef022 100644 (file)
@@ -32,14 +32,14 @@ INCLUDE(TEFSimulatorDevkit)
 # Parameters:
 # TargetName        [in]    - name of target that represent TA
 # TAElfTargetName   [in]    - TA binary target name before signing
-# TAManifestFile    [in]    - manifest file name with a path (tef-simulator)
+# TAConfDir         [in]    - backend-specific configuration directory
 # TAImageName       [in]    - final TA binary name
 
-MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAManifestFile TAImageName)
+MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAConfDir TAImageName)
     # TEEStub is built in C++, so we must force linking using C++ linker
     SET_TARGET_PROPERTIES(${TAElfTargetName} PROPERTIES
         LINKER_LANGUAGE "CXX"
     )
 
-    TEF_GENERATE_TA_IMAGE(${TargetName} ${TAElfTargetName} ${TAManifestFile} ${TAImageName})
+    TEF_GENERATE_TA_IMAGE(${TargetName} ${TAElfTargetName} ${TAConfDir}/simulator/manifest.xml ${TAImageName})
 ENDMACRO()
index 9c558134ec1525b2c31ec9a0adcfc41d49618bc7..a05401d7146290a79003652f1654dc0b01ec48be 100644 (file)
@@ -23,9 +23,9 @@ ADD_DEFINITIONS("-DTEF_BUILD_@TEF_TEE_UPPERCASE@")
 # Parameters:
 # TargetName        [in]    - name of target that represent TA
 # TAElfTargetName   [in]    - TA binary target name before signing
-# TAManifestFile    [in]    - manifest file name with a path
+# TAConfDir         [in]    - backend-specific configuration directory
 # TAImageName       [in]    - final TA binary name
 
-MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAManifestFile TAImageName)
+MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAConfDir TAImageName)
     # Fill this function with Your implementation
 ENDMACRO()
index f6939f4370a164028a20e7e9bb327d239f3d1a0d..7bf3869c61cce2d14d9e3735cb403c9464869281 100644 (file)
@@ -46,6 +46,6 @@ TARGET_LINK_LIBRARIES(${TARGET_TA}
     ${TA_DEPS_STATIC_LIBRARIES}
     )
 
-GENERATE_TA_IMAGE(SIGNED_TA ${TARGET_TA} ${TA_PATH}/example.xml ${TA_NAME})
+GENERATE_TA_IMAGE(SIGNED_TA ${TARGET_TA} ${TA_PATH} ${TA_NAME})
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TA_NAME} DESTINATION ${TASTORE_DIR})
 INSTALL(FILES ${TA_HEADERS} DESTINATION ${INCLUDE_DIR})