blob: 64ac09405677d793e80be849b5234d9e81a639bb [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 24436d459ddde697c89ff947c821cec9c5e0906e Mon Sep 17 00:00:00 2001
2From: Vishnu Banavath <vishnu.banavath@arm.com>
3Date: Wed, 16 Feb 2022 15:55:55 +0000
4Subject: [PATCH] pass sysroot_yocto
5
6Upstream-Status: Pending [Not submitted to upstream yet]
7Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
8
9
10---
11 deployments/libts/libts-import.cmake | 3 +++
12 external/MbedTLS/MbedTLS.cmake | 1 +
13 external/psa_arch_tests/psa_arch_tests.cmake | 25 +++++++++++++-------
14 3 files changed, 20 insertions(+), 9 deletions(-)
15
16diff --git a/deployments/libts/libts-import.cmake b/deployments/libts/libts-import.cmake
17index 792ba86c..b900ce3f 100644
18--- a/deployments/libts/libts-import.cmake
19+++ b/deployments/libts/libts-import.cmake
20@@ -27,9 +27,12 @@ set(LIBTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/libts-build" CACHE PATH
21
22 file(MAKE_DIRECTORY ${LIBTS_BINARY_DIR})
23
24+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${SYSROOT_YOCTO}")
25+
26 #Configure the library
27 execute_process(COMMAND
28 ${CMAKE_COMMAND}
29+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
30 -DCMAKE_INSTALL_PREFIX=${LIBTS_INSTALL_PATH}
31 -GUnix\ Makefiles
32 ${LIBTS_SOURCE_DIR}
33diff --git a/external/MbedTLS/MbedTLS.cmake b/external/MbedTLS/MbedTLS.cmake
34index 3350d8a0..33467cf0 100644
35--- a/external/MbedTLS/MbedTLS.cmake
36+++ b/external/MbedTLS/MbedTLS.cmake
37@@ -103,6 +103,7 @@ if (NOT MBEDCRYPTO_LIB_FILE)
38 execute_process(COMMAND
39 ${CMAKE_COMMAND} -E env CROSS_COMPILE=${CROSS_COMPILE}
40 ${CMAKE_COMMAND}
41+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
42 -DENABLE_PROGRAMS=OFF
43 -DENABLE_TESTING=OFF
44 -DUNSAFE_BUILD=ON
45diff --git a/external/psa_arch_tests/psa_arch_tests.cmake b/external/psa_arch_tests/psa_arch_tests.cmake
46index f6d2fb9f..42f73a37 100644
47--- a/external/psa_arch_tests/psa_arch_tests.cmake
48+++ b/external/psa_arch_tests/psa_arch_tests.cmake
49@@ -5,30 +5,33 @@
50 #
51 #-------------------------------------------------------------------------------
52
53-# Temporarily using modified tests used for tf-m verification
54+# Determine the number of processes to run while running parallel builds.
55+# Pass -DPROCESSOR_COUNT=<n> to cmake to override.
56+if(NOT DEFINED PROCESSOR_COUNT)
57+ include(ProcessorCount)
58+ ProcessorCount(PROCESSOR_COUNT)
59+ set(PROCESSOR_COUNT ${PROCESSOR_COUNT} CACHE STRING "Number of cores to use for parallel builds.")
60+endif()
61+
62 set(PSA_ARCH_TESTS_URL "https://github.com/bensze01/psa-arch-tests.git" CACHE STRING "psa-arch-tests repository URL")
63 set(PSA_ARCH_TESTS_REFSPEC "fix-multipart-aead" CACHE STRING "psa-arch-tests git refspec")
64-
65-#set(PSA_ARCH_TESTS_URL "https://github.com/ARM-software/psa-arch-tests.git" CACHE STRING "psa-arch-tests repository URL")
66-#set(PSA_ARCH_TESTS_REFSPEC "2a1852252a9b9af655cbe02d5d3c930952d0d798" CACHE STRING "psa-arch-tests v22.01_API1.4_ADAC_BETA")
67 set(PSA_ARCH_TESTS_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/psa-arch-tests_install" CACHE PATH "psa-arch-tests installation directory")
68 set(PSA_ARCH_TESTS_PACKAGE_PATH "${PSA_ARCH_TESTS_INSTALL_PATH}/libpsa-arch-tests/cmake" CACHE PATH "psa-arch-tests CMake package directory")
69-set(PSA_ARCH_TESTS_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/psa_arch_tests-src" CACHE PATH "psa-arch-tests source.")
70+
71+include(FetchContent)
72
73 # Checking git
74 find_program(GIT_COMMAND "git")
75 if (NOT GIT_COMMAND)
76 message(FATAL_ERROR "Please install git")
77 endif()
78-
79+if ("${PSA_ARCH_TESTS_PATH}" STREQUAL "DOWNLOAD")
80 # Fetching psa-arch-tests
81 FetchContent_Declare(
82 psa-arch-tests
83 GIT_REPOSITORY ${PSA_ARCH_TESTS_URL}
84 GIT_TAG ${PSA_ARCH_TESTS_REFSPEC}
85 GIT_SHALLOW TRUE
86- PATCH_COMMAND git stash
87- COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/modify_attest_config.patch
88 )
89
90 # FetchContent_GetProperties exports psa-arch-tests_SOURCE_DIR and psa-arch-tests_BINARY_DIR variables
91@@ -37,7 +40,10 @@ if(NOT psa-arch-tests_POPULATED)
92 message(STATUS "Fetching psa-arch-tests")
93 FetchContent_Populate(psa-arch-tests)
94 endif()
95-
96+else()
97+ set(psa-arch-tests_SOURCE_DIR "${TS_ROOT}/../psa-arch-tests")
98+ set(psa-arch-tests_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
99+endif()
100 # Ensure list of include paths is separated correctly
101 string(REPLACE ";" "\\;" PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS "${PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS}")
102
103@@ -47,6 +53,7 @@ string(REPLACE ";" " " PSA_ARCH_TEST_EXTERNAL_DEFS "${PSA_ARCH_TEST_EXTERNAL_DEF
104 # Configure the psa-arch-test library
105 execute_process(COMMAND
106 ${CMAKE_COMMAND}
107+ -DCMAKE_SYSROOT=${SYSROOT_YOCTO}
108 -DTOOLCHAIN=INHERIT
109 -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
110 -DPSA_INCLUDE_PATHS=${PSA_ARCH_TESTS_EXTERNAL_INCLUDE_PATHS}