blob: 565017b2c340d2588c5934a6b81d58806225cb21 [file] [log] [blame]
Balint Dobszay1b631eb2021-01-15 11:09:36 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# Find Linux FF-A user space shim repo location.
9# It contains a kernel module which exposes FF-A operations to user space using DebugFS.
10
11# If a CMake variable exists, use it as is.
12# If not, try to copy the value from the environment.
13# If neither is present, try to download.
14if(NOT DEFINED LINUX_FFA_USER_SHIM_DIR)
15 if(DEFINED ENV{LINUX_FFA_USER_SHIM_DIR})
16 set(LINUX_FFA_USER_SHIM_DIR $ENV{LINUX_FFA_USER_SHIM_DIR}
17 CACHE STRING "Linux FF-A user space shim dir")
18 else()
19 set(LINUX_FFA_USER_SHIM_URL "https://git.gitlab.arm.com/linux-arm/linux-trusted-services.git"
20 CACHE STRING "Linux FF-A user space shim repository URL")
21 set(LINUX_FFA_USER_SHIM_REFSPEC "main"
22 CACHE STRING "Linux FF-A user space shim git refspec")
23
24 find_program(GIT_COMMAND "git")
25 if (NOT GIT_COMMAND)
26 message(FATAL_ERROR "Please install git")
27 endif()
28
29 include(FetchContent)
30 FetchContent_Declare(linux_ffa_user_shim
31 GIT_REPOSITORY ${LINUX_FFA_USER_SHIM_URL}
32 GIT_TAG ${LINUX_FFA_USER_SHIM_REFSPEC}
33 GIT_SHALLOW TRUE
34 )
35
36 # FetchContent_GetProperties exports <name>_SOURCE_DIR and <name>_BINARY_DIR variables
37 FetchContent_GetProperties(linux_ffa_user_shim)
38 if(NOT linux_ffa_user_shim_POPULATED)
39 message(STATUS "Fetching Linux FF-A user space shim")
40 FetchContent_Populate(linux_ffa_user_shim)
41 endif()
42
43 set(LINUX_FFA_USER_SHIM_DIR ${linux_ffa_user_shim_SOURCE_DIR}
44 CACHE STRING "Linux FF-A user space shim dir")
45 endif()
46endif()
47
48find_path(LINUX_FFA_USER_SHIM_INCLUDE_DIR
49 NAMES arm_ffa_user.h
50 PATHS ${LINUX_FFA_USER_SHIM_DIR}
51 NO_DEFAULT_PATH
52 REQUIRED
53 DOC "Linux FF-A user space shim include directory"
54)