Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 2 | # Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.16) |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 8 | |
| 9 | # Set default platform. |
| 10 | set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.") |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 11 | include(../../deployment.cmake REQUIRED) |
| 12 | |
| 13 | #------------------------------------------------------------------------------- |
| 14 | # The CMakeLists.txt for building the attestation deployment for opteesp |
| 15 | # |
| 16 | # Builds the attestation service provider for running in an SEL0 secure partition |
| 17 | # hosted by OPTEE in the role of SPM. |
| 18 | #------------------------------------------------------------------------------- |
| 19 | include(${TS_ROOT}/environments/opteesp/env.cmake) |
| 20 | project(trusted-services LANGUAGES C ASM) |
| 21 | add_executable(attestation) |
| 22 | target_include_directories(attestation PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 23 | set(SP_UUID "a1baf155-8876-4695-8f7c-54955e8db974") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 24 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes") |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 25 | set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix") |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 26 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 27 | #------------------------------------------------------------------------------- |
| 28 | # Default deployment specific configuration |
| 29 | # |
| 30 | #------------------------------------------------------------------------------- |
| 31 | set(TS_NO_FLOAT_HW ON) |
| 32 | |
| 33 | #------------------------------------------------------------------------------- |
| 34 | # Components that are specific to deployment in the opteesp environment. |
| 35 | # |
| 36 | #------------------------------------------------------------------------------- |
| 37 | add_components(TARGET "attestation" |
| 38 | BASE_DIR ${TS_ROOT} |
| 39 | COMPONENTS |
Balint Dobszay | 286ff75 | 2022-03-04 15:57:19 +0100 | [diff] [blame] | 40 | "components/common/fdt" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 41 | "components/common/tlv" |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 42 | "components/common/trace" |
| 43 | "components/common/utils" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 44 | "components/common/endian" |
Julian Hall | c52807c | 2021-08-13 15:15:18 +0100 | [diff] [blame] | 45 | "components/common/uuid" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 46 | "components/config/ramstore" |
| 47 | "components/config/loader/sp" |
| 48 | "components/messaging/ffa/libsp" |
| 49 | "components/rpc/ffarpc/endpoint" |
| 50 | "components/rpc/ffarpc/caller/sp" |
| 51 | "components/rpc/common/caller" |
| 52 | "components/rpc/common/interface" |
| 53 | "components/service/common/include" |
Julian Hall | c52807c | 2021-08-13 15:15:18 +0100 | [diff] [blame] | 54 | "components/service/common/client" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 55 | "components/service/common/provider" |
Julian Hall | c52807c | 2021-08-13 15:15:18 +0100 | [diff] [blame] | 56 | "components/service/locator" |
| 57 | "components/service/locator/interface" |
| 58 | "components/service/locator/sp" |
| 59 | "components/service/locator/sp/ffa" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 60 | "components/service/attestation/include" |
| 61 | "components/service/attestation/claims" |
| 62 | "components/service/attestation/claims/sources/boot_seed_generator" |
| 63 | "components/service/attestation/claims/sources/null_lifecycle" |
| 64 | "components/service/attestation/claims/sources/instance_id" |
Julian Hall | b7db580 | 2021-07-26 16:20:40 +0100 | [diff] [blame] | 65 | "components/service/attestation/claims/sources/implementation_id" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 66 | "components/service/attestation/claims/sources/event_log" |
| 67 | "components/service/attestation/claims/sources/event_log/mock" |
Julian Hall | 644b57a | 2021-06-30 08:45:19 +0100 | [diff] [blame] | 68 | "components/service/attestation/reporter/local" |
| 69 | "components/service/attestation/reporter/eat" |
| 70 | "components/service/attestation/key_mngr/local" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 71 | "components/service/attestation/provider" |
| 72 | "components/service/attestation/provider/serializer/packed-c" |
Julian Hall | c52807c | 2021-08-13 15:15:18 +0100 | [diff] [blame] | 73 | "components/service/crypto/include" |
| 74 | "components/service/crypto/client/psa" |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 75 | "protocols/rpc/common/packed-c" |
| 76 | "environments/opteesp" |
| 77 | ) |
| 78 | |
| 79 | target_sources(attestation PRIVATE |
| 80 | attestation_sp.c |
| 81 | ) |
| 82 | |
| 83 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 84 | # Set target platform to provide drivers needed by the deployment |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 85 | # |
| 86 | #------------------------------------------------------------------------------- |
| 87 | add_platform(TARGET "attestation") |
| 88 | |
| 89 | #------------------------------------------------------------------------------- |
| 90 | # Components used from external projects |
| 91 | # |
| 92 | #------------------------------------------------------------------------------- |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 93 | |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 94 | # Get libc include dir |
| 95 | get_property(LIBC_INCLUDE_PATH TARGET c PROPERTY INTERFACE_INCLUDE_DIRECTORIES) |
| 96 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 97 | # Qcbor |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 98 | set (QCBOR_EXTERNAL_INCLUDE_PATHS ${LIBC_INCLUDE_PATH}) |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 99 | include(${TS_ROOT}/external/qcbor/qcbor.cmake) |
| 100 | target_link_libraries(attestation PRIVATE qcbor) |
| 101 | |
| 102 | # t_cose |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 103 | set (TCOSE_EXTERNAL_INCLUDE_PATHS ${LIBC_INCLUDE_PATH}) |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 104 | include(${TS_ROOT}/external/t_cose/t_cose.cmake) |
| 105 | target_link_libraries(attestation PRIVATE t_cose) |
| 106 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 107 | ################################################################# |
| 108 | |
| 109 | target_compile_definitions(attestation PRIVATE |
| 110 | ARM64=1 |
| 111 | ) |
| 112 | |
| 113 | target_include_directories(attestation PRIVATE |
| 114 | ${TS_ROOT} |
| 115 | ${TS_ROOT}/components |
| 116 | ${TS_ROOT}/deployments/attestation/opteesp |
| 117 | ) |
| 118 | |
| 119 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 120 | target_compile_options(attestation PRIVATE |
| 121 | -fdiagnostics-show-option |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 122 | -gdwarf-2 |
| 123 | -mstrict-align |
| 124 | -O0 |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 125 | -std=c99 |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 126 | ) |
| 127 | |
| 128 | # Options for GCC that control linking |
| 129 | target_link_options(attestation PRIVATE |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 130 | -zmax-page-size=4096 |
| 131 | ) |
| 132 | # Options directly for LD, these are not understood by GCC |
| 133 | target_link_options(attestation PRIVATE |
| 134 | -Wl,--as-needed |
| 135 | -Wl,--sort-section=alignment |
| 136 | # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list |
| 137 | ) |
| 138 | endif() |
| 139 | |
| 140 | compiler_generate_stripped_elf(TARGET attestation NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF) |
| 141 | |
| 142 | ######################################## install |
| 143 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 144 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 145 | endif() |
| 146 | #TODO: api headers |
| 147 | |
| 148 | install(TARGETS attestation |
| 149 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 150 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 151 | ) |
| 152 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 153 | |
| 154 | get_property(_PROTO_FILES TARGET attestation PROPERTY PROTOBUF_FILES) |
| 155 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
| 156 | |
| 157 | |
| 158 | set(EXPORT_SP_NAME "attestation") |
| 159 | set(EXPORT_SP_UUID ${SP_UUID}) |
| 160 | include(${TS_ROOT}/environments/opteesp/ExportSp.cmake) |