Balint Dobszay | 61d2d3b | 2022-02-14 14:08:53 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a82134a | 2023-02-10 15:07:29 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. |
Balint Dobszay | 61d2d3b | 2022-02-14 14:08:53 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | # If the driver is already installed, try to find that |
| 9 | find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR |
Balint Dobszay | f188329 | 2023-09-27 13:33:24 +0200 | [diff] [blame] | 10 | NAMES arm_tstee.h |
Balint Dobszay | 61d2d3b | 2022-02-14 14:08:53 +0100 | [diff] [blame] | 11 | DOC "Linux FF-A TEE driver include directory" |
| 12 | ) |
| 13 | |
| 14 | # If not found, download it |
| 15 | if(NOT LINUX_FFA_TEE_DRIVER_INCLUDE_DIR) |
| 16 | set(LINUX_FFA_TEE_DRIVER_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git" |
| 17 | CACHE STRING "Linux FF-A TEE driver repository URL") |
Gyorgy Szing | a82134a | 2023-02-10 15:07:29 +0100 | [diff] [blame] | 18 | |
| 19 | # Note: the aim of this external component is to make the header file defining the IOCTL API |
| 20 | # available. Fetching a moving reference is ok as long as API compatibility is guaranteed. |
Balint Dobszay | f188329 | 2023-09-27 13:33:24 +0200 | [diff] [blame] | 21 | set(LINUX_FFA_TEE_DRIVER_REFSPEC "origin/tee-v2" |
Balint Dobszay | 61d2d3b | 2022-02-14 14:08:53 +0100 | [diff] [blame] | 22 | CACHE STRING "Linux FF-A TEE driver git refspec") |
| 23 | |
| 24 | set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_deps/linux_ffa_tee_driver-src" |
| 25 | CACHE PATH "Location of Linux TEE driver source.") |
| 26 | |
| 27 | if (DEFINED ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR}) |
| 28 | set(LINUX_FFA_TEE_DRIVER_SOURCE_DIR $ENV{LINUX_FFA_TEE_DRIVER_SOURCE_DIR} |
| 29 | CACHE PATH "Location of Linux TEE driver source." FORCE) |
| 30 | endif() |
| 31 | |
| 32 | set(GIT_OPTIONS |
| 33 | GIT_REPOSITORY ${LINUX_FFA_TEE_DRIVER_URL} |
| 34 | GIT_TAG ${LINUX_FFA_TEE_DRIVER_REFSPEC} |
| 35 | GIT_SHALLOW TRUE |
| 36 | ) |
| 37 | include(${TS_ROOT}/tools/cmake/common/LazyFetch.cmake REQUIRED) |
| 38 | LazyFetch_MakeAvailable( |
| 39 | DEP_NAME linux_ffa_tee_driver |
| 40 | FETCH_OPTIONS "${GIT_OPTIONS}" |
| 41 | SOURCE_DIR ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR} |
| 42 | ) |
| 43 | |
| 44 | find_path(LINUX_FFA_TEE_DRIVER_INCLUDE_DIR |
Balint Dobszay | f188329 | 2023-09-27 13:33:24 +0200 | [diff] [blame] | 45 | NAMES arm_tstee.h |
Balint Dobszay | 61d2d3b | 2022-02-14 14:08:53 +0100 | [diff] [blame] | 46 | PATHS ${LINUX_FFA_TEE_DRIVER_SOURCE_DIR}/uapi |
| 47 | NO_DEFAULT_PATH |
| 48 | REQUIRED |
| 49 | DOC "Linux FF-A TEE driver include directory" |
| 50 | ) |
| 51 | endif() |
| 52 | |
| 53 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS |
Balint Dobszay | f188329 | 2023-09-27 13:33:24 +0200 | [diff] [blame] | 54 | "${LINUX_FFA_TEE_DRIVER_INCLUDE_DIR}/arm_tstee.h") |