aboutsummaryrefslogtreecommitdiff
path: root/cmake/install.cmake
blob: 2af1476af801cd227e8a9f666afac6b777d87e51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#-------------------------------------------------------------------------------
# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------

# Generate correct filename
string(TOUPPER ${TFM_PLATFORM} TFM_PLATFORM_UPPERCASE)
string(REGEX REPLACE "-" "_" TFM_PLATFORM_UPPERCASE_UNDERSCORE ${TFM_PLATFORM_UPPERCASE})
string(REGEX REPLACE "^(\\.\\.([\\/\\\\]))+" "EXTERNAL\\2" TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR ${TFM_PLATFORM_UPPERCASE_UNDERSCORE})

install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/
        DESTINATION ${TFM_INSTALL_PATH}/outputs/${TFM_PLATFORM_UPPERCASE_UNDERSCORE_NO_PARENT_DIR}
)

set(INTERFACE_INC_DIR ${CMAKE_SOURCE_DIR}/interface/include)
set(INTERFACE_SRC_DIR ${CMAKE_SOURCE_DIR}/interface/src)

set(INSTALL_INTERFACE_INC_DIR    ${TFM_INSTALL_PATH}/interface/include)
set(INSTALL_INTERFACE_SRC_DIR    ${TFM_INSTALL_PATH}/interface/src)
set(INSTALL_INTERFACE_LIB_DIR    ${TFM_INSTALL_PATH}/interface/lib)

# export veneer lib
if (NOT TFM_MULTI_CORE_TOPOLOGY)
    install(FILES       ${CMAKE_BINARY_DIR}/secure_fw/s_veneers.o
            DESTINATION ${INSTALL_INTERFACE_LIB_DIR})
endif()

####################### export headers #########################################

install(FILES       ${INTERFACE_INC_DIR}/psa/client.h
                    ${INTERFACE_INC_DIR}/psa/error.h
        DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)

install(FILES       ${CMAKE_BINARY_DIR}/generated/interface/include/psa_manifest/sid.h
        DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa_manifest)

install(FILES       ${INTERFACE_INC_DIR}/tfm_api.h
                    ${INTERFACE_INC_DIR}/tfm_ns_interface.h
        DESTINATION ${INSTALL_INTERFACE_INC_DIR})

install(FILES       ${INTERFACE_INC_DIR}/ext/tz_context.h
        DESTINATION ${INSTALL_INTERFACE_INC_DIR}/ext)

if (TFM_PSA_API)
    install(FILES       ${INTERFACE_INC_DIR}/tfm_psa_call_param.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
endif()

if (TFM_MULTI_CORE_TOPOLOGY)
    install(FILES       ${INTERFACE_INC_DIR}/multi_core/tfm_multi_core_api.h
                        ${INTERFACE_INC_DIR}/multi_core/tfm_ns_mailbox.h
                        ${INTERFACE_INC_DIR}/multi_core/tfm_mailbox.h
                        ${INTERFACE_INC_DIR}/multi_core/tfm_mailbox_config.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
elseif (NOT TFM_PSA_API)
    install(FILES       ${CMAKE_BINARY_DIR}/generated/interface/include/tfm_veneers.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/tfm/veneers)
endif()

if (TFM_PARTITION_PROTECTED_STORAGE OR FORWARD_PROT_MSG)
    install(FILES       ${INTERFACE_INC_DIR}/psa/protected_storage.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
endif()

if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE OR FORWARD_PROT_MSG)
    install(FILES       ${INTERFACE_INC_DIR}/psa/internal_trusted_storage.h
                        ${INTERFACE_INC_DIR}/psa/storage_common.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
endif()

if (TFM_PARTITION_CRYPTO OR FORWARD_PROT_MSG)
    install(FILES       ${INTERFACE_INC_DIR}/psa/crypto_extra.h
                        ${INTERFACE_INC_DIR}/psa/crypto_compat.h
                        ${INTERFACE_INC_DIR}/psa/crypto.h
                        ${INTERFACE_INC_DIR}/psa/crypto_client_struct.h
                        ${INTERFACE_INC_DIR}/psa/crypto_sizes.h
                        ${INTERFACE_INC_DIR}/psa/crypto_struct.h
                        ${INTERFACE_INC_DIR}/psa/crypto_types.h
                        ${INTERFACE_INC_DIR}/psa/crypto_values.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
    install(FILES       ${INTERFACE_INC_DIR}/tfm_crypto_defs.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
endif()

if (TFM_PARTITION_INITIAL_ATTESTATION OR FORWARD_PROT_MSG)
    install(FILES       ${INTERFACE_INC_DIR}/psa/initial_attestation.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
endif()

if(TFM_PARTITION_AUDIT_LOG)
    install(FILES       ${INTERFACE_INC_DIR}/psa_audit_api.h
                        ${INTERFACE_INC_DIR}/psa_audit_defs.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
endif()

if(TFM_PARTITION_PLATFORM OR FORWARD_PROT_MSG)
    install(FILES       ${INTERFACE_INC_DIR}/tfm_platform_api.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
endif()

if(TFM_PARTITION_FIRMWARE_UPDATE)
    install(FILES       ${INTERFACE_INC_DIR}/psa/update.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa)
    install(FILES       ${INTERFACE_INC_DIR}/tfm_fwu_defs.h
            DESTINATION ${INSTALL_INTERFACE_INC_DIR})
endif()

####################### export sources #########################################

if (TFM_MULTI_CORE_TOPOLOGY)
    install(FILES       ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox.c
                        ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_ns_api.c
                        ${INTERFACE_SRC_DIR}/multi_core/tfm_multi_core_psa_ns_api.c
                        ${INTERFACE_SRC_DIR}/multi_core/tfm_ns_mailbox_thread.c
            DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
else()
    if(TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_psa_ns_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()

    install(FILES       ${INTERFACE_SRC_DIR}/tfm_ns_interface.c.example
            DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
endif()

if (TFM_PARTITION_PROTECTED_STORAGE OR FORWARD_PROT_MSG)
    if (TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_ps_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_ps_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()

if (TFM_PARTITION_INTERNAL_TRUSTED_STORAGE OR FORWARD_PROT_MSG)
    if (TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_its_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_its_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()

if (TFM_PARTITION_CRYPTO OR FORWARD_PROT_MSG)
    if (TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_crypto_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_crypto_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()

if (TFM_PARTITION_INITIAL_ATTESTATION OR FORWARD_PROT_MSG)
    if (TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_initial_attestation_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_initial_attestation_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()

if(TFM_PARTITION_AUDIT_LOG)
    install(FILES       ${INTERFACE_SRC_DIR}/tfm_audit_func_api.c
            DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
endif()

if(TFM_PARTITION_PLATFORM OR FORWARD_PROT_MSG)
    if(TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_platform_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_platform_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()


##################### Export image signing information #########################

set(INSTALL_IMAGE_SIGNING_DIR ${TFM_INSTALL_PATH}/image_signing)

if(BL2)
    install(DIRECTORY bl2/ext/mcuboot/scripts
            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR})

    if (MCUBOOT_ENC_IMAGES)
        install(FILES ${MCUBOOT_KEY_ENC}
                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
    endif()

    install(FILES $<TARGET_OBJECTS:signing_layout_s>
            DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files)

    if(MCUBOOT_IMAGE_NUMBER GREATER 1)
        install(FILES $<TARGET_OBJECTS:signing_layout_ns>
                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/layout_files)

        install(FILES ${MCUBOOT_KEY_NS}
                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
    else()
        install(FILES ${MCUBOOT_KEY_S}
                DESTINATION ${INSTALL_IMAGE_SIGNING_DIR}/keys)
    endif()
endif()

if(TFM_PARTITION_FIRMWARE_UPDATE)
    if(TFM_PSA_API)
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_firmware_update_ipc_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    else()
        install(FILES       ${INTERFACE_SRC_DIR}/tfm_firmware_update_func_api.c
                DESTINATION ${INSTALL_INTERFACE_SRC_DIR})
    endif()
endif()