xref: /optee_os/mk/config.mk (revision e2f03e0736a6774eb8fb07ce8dc55d8ed186b67b)
1120c43adSJerome Forissier# Default configuration values for OP-TEE core (all platforms).
2120c43adSJerome Forissier#
3120c43adSJerome Forissier# Platform-specific overrides are in core/arch/arm32/plat-*/conf.mk.
4120c43adSJerome Forissier# Some subsystem-specific defaults are not here but rather in */sub.mk.
5120c43adSJerome Forissier#
6120c43adSJerome Forissier# Configuration values may be assigned from multiple sources.
7120c43adSJerome Forissier# From higher to lower priority:
8120c43adSJerome Forissier#
9120c43adSJerome Forissier#   1. Make arguments ('make CFG_FOO=bar...')
10120c43adSJerome Forissier#   2. The file specified by $(CFG_OPTEE_CONFIG) (if defined)
11120c43adSJerome Forissier#   3. The environment ('CFG_FOO=bar make...')
12120c43adSJerome Forissier#   4. The platform-specific configuration file: core/arch/arm32/plat-*/conf.mk
13120c43adSJerome Forissier#   5. This file
14120c43adSJerome Forissier#   6. Subsystem-specific makefiles (*/sub.mk)
15120c43adSJerome Forissier#
16b5569a68SPascal Brand# Actual values used during the build are output to $(out-dir)/conf.mk
17120c43adSJerome Forissier# (CFG_* variables only).
18120c43adSJerome Forissier
19a75f2e14SJerome Forissier# Cross-compiler prefix and suffix
20a75f2e14SJerome ForissierCROSS_COMPILE ?= arm-linux-gnueabihf-
21c042fbefSJerome ForissierCROSS_COMPILE32 ?= $(CROSS_COMPILE)
22c042fbefSJerome ForissierCROSS_COMPILE64 ?= aarch64-linux-gnu-
23a75f2e14SJerome ForissierCOMPILER ?= gcc
24a75f2e14SJerome Forissier
25b09cddcaSJerome Forissier# For convenience
26b09cddcaSJerome Forissierifdef CFLAGS
27b09cddcaSJerome ForissierCFLAGS32 ?= $(CFLAGS)
28b09cddcaSJerome ForissierCFLAGS64 ?= $(CFLAGS)
29b09cddcaSJerome Forissierendif
30b09cddcaSJerome Forissier
31120c43adSJerome Forissier# Compiler warning level.
32120c43adSJerome Forissier# Supported values: undefined, 1, 2 and 3. 3 gives more warnings.
33b0104773SPascal BrandWARNS ?= 3
34b0104773SPascal Brand
35b4faf480SDick Olsson# Path to the Python interpreter used by the build system.
36b4faf480SDick Olsson# This variable is set to the default python3 interpreter in the user's
37b4faf480SDick Olsson# path. But build environments that require more explicit control can
38b4faf480SDick Olsson# set the path to a specific interpreter through this variable.
39b4faf480SDick OlssonPYTHON3 ?= python3
40b4faf480SDick Olsson
413f17b838SEtienne Carriere# Define DEBUG=1 to compile without optimization (forces -O0)
42b0104773SPascal Brand# DEBUG=1
43b0104773SPascal Brand
444ec2358eSJerome Forissier# If y, enable debug features of the TEE core (assertions and lock checks
454ec2358eSJerome Forissier# are enabled, panic and assert messages are more verbose, data and prefetch
464ec2358eSJerome Forissier# aborts show a stack dump). When disabled, the NDEBUG directive is defined
474ec2358eSJerome Forissier# so assertions are disabled.
484ec2358eSJerome ForissierCFG_TEE_CORE_DEBUG ?= y
49b0104773SPascal Brand
503f58e4ecSOvidiu Mihalachi# Log levels for the TEE core. Defines which core messages are displayed
513f58e4ecSOvidiu Mihalachi# on the secure console. Disabling core log (level set to 0) also disables
523f58e4ecSOvidiu Mihalachi# logs from the TAs.
5309ca9f8bSJerome Forissier# 0: none
5409ca9f8bSJerome Forissier# 1: error
5509ca9f8bSJerome Forissier# 2: error + warning
5609ca9f8bSJerome Forissier# 3: error + warning + debug
5709ca9f8bSJerome Forissier# 4: error + warning + debug + flow
58e0042c88SPascal BrandCFG_TEE_CORE_LOG_LEVEL ?= 1
593f58e4ecSOvidiu Mihalachi
603f58e4ecSOvidiu Mihalachi# TA log level
613f58e4ecSOvidiu Mihalachi# If user-mode library libutils.a is built with CFG_TEE_TA_LOG_LEVEL=0,
623f58e4ecSOvidiu Mihalachi# TA tracing is disabled regardless of the value of CFG_TEE_TA_LOG_LEVEL
633f58e4ecSOvidiu Mihalachi# when the TA is built.
64e0042c88SPascal BrandCFG_TEE_TA_LOG_LEVEL ?= 1
65b0104773SPascal Brand
667c876f12SPascal Brand# TA enablement
677c876f12SPascal Brand# When defined to "y", TA traces are output according to
687c876f12SPascal Brand# CFG_TEE_TA_LOG_LEVEL. Otherwise, they are not output at all
697c876f12SPascal BrandCFG_TEE_CORE_TA_TRACE ?= y
70b0104773SPascal Brand
718c8e1441SJerome Forissier# If y, enable the memory leak detection feature in the bget memory allocator.
728c8e1441SJerome Forissier# When this feature is enabled, calling mdbg_check(1) will print a list of all
738c8e1441SJerome Forissier# the currently allocated buffers and the location of the allocation (file and
748c8e1441SJerome Forissier# line number).
758c8e1441SJerome Forissier# Note: make sure the log level is high enough for the messages to show up on
768c8e1441SJerome Forissier# the secure console! For instance:
778c8e1441SJerome Forissier# - To debug user-mode (TA) allocations: build OP-TEE *and* the TA with:
788c8e1441SJerome Forissier#   $ make CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=3
798c8e1441SJerome Forissier# - To debug TEE core allocations: build OP-TEE with:
808c8e1441SJerome Forissier#   $ make CFG_TEE_CORE_MALLOC_DEBUG=y CFG_TEE_CORE_LOG_LEVEL=3
810fcbddd4SSY ChiuCFG_TEE_CORE_MALLOC_DEBUG ?= n
820fcbddd4SSY ChiuCFG_TEE_TA_MALLOC_DEBUG ?= n
83c2ce4186SJens Wiklander# Prints an error message and dumps the stack on failed memory allocations
84c2ce4186SJens Wiklander# using malloc() and friends.
85c2ce4186SJens WiklanderCFG_CORE_DUMP_OOM ?= $(CFG_TEE_CORE_MALLOC_DEBUG)
860fcbddd4SSY Chiu
872bfab756SJerome Forissier# Mask to select which messages are prefixed with long debugging information
8864fad262SVolodymyr Babchuk# (severity, core ID, thread ID, component name, function name, line number)
8964fad262SVolodymyr Babchuk# based on the message level. If BIT(level) is set, the long prefix is shown.
902bfab756SJerome Forissier# Otherwise a short prefix is used (severity and component name only).
91f4aa5b11SJerome Forissier# Levels: 0=none 1=error 2=info 3=debug 4=flow
922bfab756SJerome ForissierCFG_MSG_LONG_PREFIX_MASK ?= 0x1a
93f4aa5b11SJerome Forissier
94120c43adSJerome Forissier# PRNG configuration
957018ae01SSY Chiu# If CFG_WITH_SOFTWARE_PRNG is enabled, crypto provider provided
967018ae01SSY Chiu# software PRNG implementation is used.
977018ae01SSY Chiu# Otherwise, you need to implement hw_get_random_byte() for your platform
987018ae01SSY ChiuCFG_WITH_SOFTWARE_PRNG ?= y
99120c43adSJerome Forissier
100120c43adSJerome Forissier# Number of threads
101120c43adSJerome ForissierCFG_NUM_THREADS ?= 2
102ab35d7adSCedric Chaumont
103ab35d7adSCedric Chaumont# API implementation version
104ab35d7adSCedric ChaumontCFG_TEE_API_VERSION ?= GPD-1.1-dev
105ab35d7adSCedric Chaumont
106ab35d7adSCedric Chaumont# Implementation description (implementation-dependent)
107ab35d7adSCedric ChaumontCFG_TEE_IMPL_DESCR ?= OPTEE
108ab35d7adSCedric Chaumont
10929cff5cfSJerome Forissier# Should OPTEE_SMC_CALL_GET_OS_REVISION return a build identifier to Normal
11029cff5cfSJerome Forissier# World?
11129cff5cfSJerome ForissierCFG_OS_REV_REPORTS_GIT_SHA1 ?= y
11229cff5cfSJerome Forissier
113ab35d7adSCedric Chaumont# Trusted OS implementation version
1144bf425c1SJens WiklanderTEE_IMPL_VERSION ?= $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
11529cff5cfSJerome Forissierifeq ($(CFG_OS_REV_REPORTS_GIT_SHA1),y)
11629cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo 0)
11729cff5cfSJerome Forissierelse
11829cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x0
11929cff5cfSJerome Forissierendif
12035c507f2SJerome Forissier# The following values are not extracted from the "git describe" output because
12135c507f2SJerome Forissier# we might be outside of a Git environment, or the tree may have been cloned
12235c507f2SJerome Forissier# with limited depth not including any tag, so there is really no guarantee
12335c507f2SJerome Forissier# that TEE_IMPL_VERSION contains the major and minor revision numbers.
124a83aec29SJerome ForissierCFG_OPTEE_REVISION_MAJOR ?= 3
125978f50bfSJens WiklanderCFG_OPTEE_REVISION_MINOR ?= 9
126ab35d7adSCedric Chaumont
127ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
128ab35d7adSCedric ChaumontCFG_TEE_MANUFACTURER ?= LINARO
129ab35d7adSCedric Chaumont
130ab35d7adSCedric Chaumont# Trusted firmware version
131ab35d7adSCedric ChaumontCFG_TEE_FW_IMPL_VERSION ?= FW_IMPL_UNDEF
132ab35d7adSCedric Chaumont
133ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
134ab35d7adSCedric ChaumontCFG_TEE_FW_MANUFACTURER ?= FW_MAN_UNDEF
135ab35d7adSCedric Chaumont
136b44708c1SJerome Forissier# Rich Execution Environment (REE) file system support: normal world OS
137b44708c1SJerome Forissier# provides the actual storage.
138b44708c1SJerome Forissier# This is the default FS when enabled (i.e., the one used when
139b44708c1SJerome Forissier# TEE_STORAGE_PRIVATE is passed to the trusted storage API)
140b44708c1SJerome ForissierCFG_REE_FS ?= y
141bc420748SJens Wiklander
14288e6e089SJerome Forissier# RPMB file system support
14388e6e089SJerome ForissierCFG_RPMB_FS ?= n
14488e6e089SJerome Forissier
14588e6e089SJerome Forissier# Device identifier used when CFG_RPMB_FS = y.
14688e6e089SJerome Forissier# The exact meaning of this value is platform-dependent. On Linux, the
14788e6e089SJerome Forissier# tee-supplicant process will open /dev/mmcblk<id>rpmb
14888e6e089SJerome ForissierCFG_RPMB_FS_DEV_ID ?= 0
14988e6e089SJerome Forissier
1507d97159bSManuel Huber# This config variable determines the number of entries read in from RPMB at
1517d97159bSManuel Huber# once whenever a function traverses the RPMB FS. Increasing the default value
1527d97159bSManuel Huber# has the following consequences:
1537d97159bSManuel Huber# - More memory required on heap. A single FAT entry currently has a size of
1547d97159bSManuel Huber#   256 bytes.
1557d97159bSManuel Huber# - Potentially significant speed-ups for RPMB I/O. Depending on how many
1567d97159bSManuel Huber#   entries a function needs to traverse, the number of time-consuming RPMB
1577d97159bSManuel Huber#   read-in operations can be reduced.
1587d97159bSManuel Huber# Chosing a proper value is both platform- (available memory) and use-case-
1597d97159bSManuel Huber# dependent (potential number of FAT fs entries), so overwrite in platform
1607d97159bSManuel Huber# config files
1617d97159bSManuel HuberCFG_RPMB_FS_RD_ENTRIES ?= 8
1627d97159bSManuel Huber
1635f68d784SManuel Huber# Enables caching of FAT FS entries when set to a value greater than zero.
1645f68d784SManuel Huber# When enabled, the cache stores the first 'CFG_RPMB_FS_CACHE_ENTRIES' FAT FS
1655f68d784SManuel Huber# entries. The cache is populated when FAT FS entries are initially read in.
1665f68d784SManuel Huber# When traversing the FAT FS entries, we read from the cache instead of reading
1675f68d784SManuel Huber# in the entries from RPMB storage. Consequently, when a FAT FS entry is
1685f68d784SManuel Huber# written, the cache is updated. In scenarios where an estimate of the number
1695f68d784SManuel Huber# of FAT FS entries can be made, the cache may be specifically tailored to
1705f68d784SManuel Huber# store all entries. The caching can improve RPMB I/O at the cost
1715f68d784SManuel Huber# of additional memory.
1725f68d784SManuel Huber# Without caching, we temporarily require
1735f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1745f68d784SManuel Huber# while traversing the FAT FS (e.g. in read_fat).
1755f68d784SManuel Huber# For example 8*256 bytes = 2kB while in read_fat.
1765f68d784SManuel Huber# With caching, we constantly require up to
1775f68d784SManuel Huber# CFG_RPMB_FS_CACHE_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1785f68d784SManuel Huber# depending on how many elements are in the cache, and additional temporary
1795f68d784SManuel Huber# CFG_RPMB_FS_RD_ENTRIES*sizeof(struct rpmb_fat_entry) bytes of heap memory
1805f68d784SManuel Huber# in case the cache is too small to hold all elements when traversing.
1815f68d784SManuel HuberCFG_RPMB_FS_CACHE_ENTRIES ?= 0
1825f68d784SManuel Huber
183ed1993b7SJerome Forissier# Enables RPMB key programming by the TEE, in case the RPMB partition has not
184ed1993b7SJerome Forissier# been configured yet.
185ed1993b7SJerome Forissier# !!! Security warning !!!
186ed1993b7SJerome Forissier# Do *NOT* enable this in product builds, as doing so would allow the TEE to
187ed1993b7SJerome Forissier# leak the RPMB key.
188ed1993b7SJerome Forissier# This option is useful in the following situations:
189ed1993b7SJerome Forissier# - Testing
190ed1993b7SJerome Forissier# - RPMB key provisioning in a controlled environment (factory setup)
191ed1993b7SJerome ForissierCFG_RPMB_WRITE_KEY ?= n
192ed1993b7SJerome Forissier
193bc420748SJens Wiklander# Embed public part of this key in OP-TEE OS
194bc420748SJens WiklanderTA_SIGN_KEY ?= keys/default_ta.pem
195c4553de7SJerome Forissier
196c4553de7SJerome Forissier# Include lib/libutils/isoc in the build? Most platforms need this, but some
197c4553de7SJerome Forissier# may not because they obtain the isoc functions from elsewhere
198c4553de7SJerome ForissierCFG_LIBUTILS_WITH_ISOC ?= y
199fce4cfa1SJens Wiklander
2000de9a5fbSJens Wiklander# Enables floating point support for user TAs
2010de9a5fbSJens Wiklander# ARM32: EABI defines both a soft-float ABI and a hard-float ABI,
2020de9a5fbSJens Wiklander#	 hard-float is basically a super set of soft-float. Hard-float
2030de9a5fbSJens Wiklander#	 requires all the support routines provided for soft-float, but the
2040de9a5fbSJens Wiklander#	 compiler may choose to optimize to not use some of them and use
2050de9a5fbSJens Wiklander#	 the floating-point registers instead.
2060de9a5fbSJens Wiklander# ARM64: EABI doesn't define a soft-float ABI, everything is hard-float (or
2070de9a5fbSJens Wiklander#	 nothing with ` -mgeneral-regs-only`)
2080de9a5fbSJens Wiklander# With CFG_TA_FLOAT_SUPPORT enabled TA code is free use floating point types
2090de9a5fbSJens WiklanderCFG_TA_FLOAT_SUPPORT ?= y
210923c1f34SJens Wiklander
2117411e0e1SJerome Forissier# Stack unwinding: print a stack dump to the console on core or TA abort, or
2127411e0e1SJerome Forissier# when a TA panics.
21331a29642SJerome Forissier# If CFG_UNWIND is enabled, both the kernel and user mode call stacks can be
21431a29642SJerome Forissier# unwound (not paged TAs, however).
21531a29642SJerome Forissier# Note that 32-bit ARM code needs unwind tables for this to work, so enabling
21631a29642SJerome Forissier# this option will increase the size of the 32-bit TEE binary by a few KB.
21731a29642SJerome Forissier# Similarly, TAs have to be compiled with -funwind-tables (default when the
21831a29642SJerome Forissier# option is set) otherwise they can't be unwound.
2197411e0e1SJerome Forissier# Warning: since the unwind sequence for user-mode (TA) code is implemented in
2207411e0e1SJerome Forissier# the privileged layer of OP-TEE, enabling this feature will weaken the
2217411e0e1SJerome Forissier# user/kernel isolation. Therefore it should be disabled in release builds.
2223f17b838SEtienne Carriereifeq ($(CFG_TEE_CORE_DEBUG),y)
22331a29642SJerome ForissierCFG_UNWIND ?= y
224923c1f34SJens Wiklanderendif
2256fbac37eSJens Wiklander
2266fbac37eSJens Wiklander# Enable support for dynamically loaded user TAs
2276fbac37eSJens WiklanderCFG_WITH_USER_TA ?= y
2282a142248SJens Wiklander
22924d49094SJerome Forissier# Choosing the architecture(s) of user-mode libraries (used by TAs)
23024d49094SJerome Forissier#
23124d49094SJerome Forissier# Platforms may define a list of supported architectures for user-mode code
23224d49094SJerome Forissier# by setting $(supported-ta-targets). Valid values are "ta_arm32", "ta_arm64",
23324d49094SJerome Forissier# "ta_arm32 ta_arm64" and "ta_arm64 ta_arm32".
23424d49094SJerome Forissier# $(supported-ta-targets) defaults to "ta_arm32" when the TEE core is 32-bits,
23524d49094SJerome Forissier# and "ta_arm32 ta_arm64" when it is 64-bits (that is, when CFG_ARM64_core=y).
23624d49094SJerome Forissier# The first entry in $(supported-ta-targets) has a special role, see
23724d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> below.
23824d49094SJerome Forissier#
23924d49094SJerome Forissier# CFG_USER_TA_TARGETS may be defined to restrict $(supported-ta-targets) or
24024d49094SJerome Forissier# change the order of the values.
24124d49094SJerome Forissier#
24224d49094SJerome Forissier# The list of TA architectures is ultimately stored in $(ta-targets).
24324d49094SJerome Forissier
24424d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> (for example, CFG_USER_TA_TARGET_avb), if
24524d49094SJerome Forissier# defined, selects the unique TA architecture mode for building the in-tree TA
24624d49094SJerome Forissier# <ta-name>. Can be either ta_arm32 or ta_arm64.
24724d49094SJerome Forissier# By default, in-tree TAs are built using the first architecture specified in
24824d49094SJerome Forissier# $(ta-targets).
24924d49094SJerome Forissier
2507dfff131SJerome Forissier# Address Space Layout Randomization for user-mode Trusted Applications
2517dfff131SJerome Forissier#
2527dfff131SJerome Forissier# When this flag is enabled, the ELF loader will introduce a random offset
2537dfff131SJerome Forissier# when mapping the application in user space. ASLR makes the exploitation of
2547dfff131SJerome Forissier# memory corruption vulnerabilities more difficult.
25587372da4SJens WiklanderCFG_TA_ASLR ?= y
2567dfff131SJerome Forissier
2577dfff131SJerome Forissier# How much ASLR may shift the base address (in pages). The base address is
2587dfff131SJerome Forissier# randomly shifted by an integer number of pages comprised between these two
2597dfff131SJerome Forissier# values. Bigger ranges are more secure because they make the addresses harder
2607dfff131SJerome Forissier# to guess at the expense of using more memory for the page tables.
2617dfff131SJerome ForissierCFG_TA_ASLR_MIN_OFFSET_PAGES ?= 0
2627dfff131SJerome ForissierCFG_TA_ASLR_MAX_OFFSET_PAGES ?= 128
2637dfff131SJerome Forissier
264170e9084SJens Wiklander# Address Space Layout Randomization for TEE Core
265170e9084SJens Wiklander#
266170e9084SJens Wiklander# When this flag is enabled, the early init code will introduce a random
267170e9084SJens Wiklander# offset when mapping TEE Core. ASLR makes the exploitation of memory
268170e9084SJens Wiklander# corruption vulnerabilities more difficult.
26987372da4SJens WiklanderCFG_CORE_ASLR ?= y
270170e9084SJens Wiklander
271ee664c19SJerome Forissier# Load user TAs from the REE filesystem via tee-supplicant
272ee664c19SJerome ForissierCFG_REE_FS_TA ?= y
273ee664c19SJerome Forissier
2747db24ad6SJerome Forissier# Pre-authentication of TA binaries loaded from the REE filesystem
2757db24ad6SJerome Forissier#
2767db24ad6SJerome Forissier# - If CFG_REE_FS_TA_BUFFERED=y: load TA binary into a temporary buffer in the
2777db24ad6SJerome Forissier#   "Secure DDR" pool, check the signature, then process the file only if it is
2787db24ad6SJerome Forissier#   valid.
2797db24ad6SJerome Forissier# - If disabled: hash the binaries as they are being processed and verify the
2807db24ad6SJerome Forissier#   signature as a last step.
281e6e68745SJerome ForissierCFG_REE_FS_TA_BUFFERED ?= n
2827db24ad6SJerome Forissier$(eval $(call cfg-depends-all,CFG_REE_FS_TA_BUFFERED,CFG_REE_FS_TA))
2837db24ad6SJerome Forissier
284d0c63614SJerome Forissier# Support for loading user TAs from a special section in the TEE binary.
285d0c63614SJerome Forissier# Such TAs are available even before tee-supplicant is available (hence their
286d0c63614SJerome Forissier# name), but note that many services exported to TAs may need tee-supplicant,
287d0c63614SJerome Forissier# so early use is limited to a subset of the TEE Internal Core API (crypto...)
288d0c63614SJerome Forissier# To use this feature, set EARLY_TA_PATHS to the paths to one or more TA ELF
289d0c63614SJerome Forissier# file(s). For example:
290d0c63614SJerome Forissier#   $ make ... \
291d0c63614SJerome Forissier#     EARLY_TA_PATHS="path/to/8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf \
292d0c63614SJerome Forissier#                     path/to/cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.stripped.elf"
293d0c63614SJerome Forissier# Typical build steps:
294d0c63614SJerome Forissier#   $ make ta_dev_kit CFG_EARLY_TA=y # Create the dev kit (user mode libraries,
295d0c63614SJerome Forissier#                                    # headers, makefiles), ready to build TAs.
296d0c63614SJerome Forissier#                                    # CFG_EARLY_TA=y is optional, it prevents
297d0c63614SJerome Forissier#                                    # later library recompilations.
298d0c63614SJerome Forissier#   <build some TAs>
299d0c63614SJerome Forissier#   $ make EARLY_TA_PATHS=<paths>    # Build OP-TEE and embbed the TA(s)
3003638ea32SJens Wiklander#
3013638ea32SJens Wiklander# Another option is CFG_IN_TREE_EARLY_TAS which is used to point at
3023638ea32SJens Wiklander# in-tree TAs. CFG_IN_TREE_EARLY_TAS is formatted as:
3033638ea32SJens Wiklander# <name-of-ta>/<uuid>
3043638ea32SJens Wiklander# for instance avb/023f8f1a-292a-432b-8fc4-de8471358067
3053638ea32SJens Wiklanderifneq ($(EARLY_TA_PATHS)$(CFG_IN_TREE_EARLY_TAS),)
306d0c63614SJerome Forissier$(call force,CFG_EARLY_TA,y)
307d0c63614SJerome Forissierelse
308d0c63614SJerome ForissierCFG_EARLY_TA ?= n
309d0c63614SJerome Forissierendif
310509a9802SJerome Forissierifeq ($(CFG_EARLY_TA),y)
311509a9802SJerome Forissier$(call force,CFG_ZLIB,y)
312509a9802SJerome Forissierendif
313d0c63614SJerome Forissier
314a884c935SJens Wiklander# Enable paging, requires SRAM, can't be enabled by default
315a884c935SJens WiklanderCFG_WITH_PAGER ?= n
316a884c935SJens Wiklander
317ab0df69eSJerome Forissier# Runtime lock dependency checker: ensures that a proper locking hierarchy is
318ab0df69eSJerome Forissier# used in the TEE core when acquiring and releasing mutexes. Any violation will
319ab0df69eSJerome Forissier# cause a panic as soon as the invalid locking condition is detected. If
3202288b071SJerome Forissier# CFG_UNWIND and CFG_LOCKDEP_RECORD_STACK are both enabled, the algorithm
3212288b071SJerome Forissier# records the call stacks when locks are taken, and prints them when a
3222288b071SJerome Forissier# potential deadlock is found.
323ab0df69eSJerome Forissier# Expect a significant performance impact when enabling this.
324ab0df69eSJerome ForissierCFG_LOCKDEP ?= n
3252288b071SJerome ForissierCFG_LOCKDEP_RECORD_STACK ?= y
326ab0df69eSJerome Forissier
327bde8a250SJoakim Bech# BestFit algorithm in bget reduces the fragmentation of the heap when running
328ab0df69eSJerome Forissier# with the pager enabled or lockdep
329ab0df69eSJerome ForissierCFG_CORE_BGET_BESTFIT ?= $(call cfg-one-enabled, CFG_WITH_PAGER CFG_LOCKDEP)
330bde8a250SJoakim Bech
331a884c935SJens Wiklander# Use the pager for user TAs
332a884c935SJens WiklanderCFG_PAGED_USER_TA ?= $(CFG_WITH_PAGER)
333a884c935SJens Wiklander
334be715239SJens Wiklander# Enable support for detected undefined behavior in C
3351d171f95SJens Wiklander# Uses a lot of memory, can't be enabled by default
336be715239SJens WiklanderCFG_CORE_SANITIZE_UNDEFINED ?= n
337b908c675SJens Wiklander
3381d171f95SJens Wiklander# Enable Kernel Address sanitizer, has a huge performance impact, uses a
3391d171f95SJens Wiklander# lot of memory and need platform specific adaptations, can't be enabled by
3401d171f95SJens Wiklander# default
3411d171f95SJens WiklanderCFG_CORE_SANITIZE_KADDRESS ?= n
3421d171f95SJens Wiklander
34335e770dfSJerome Forissier# Add stack guards before/after stacks and periodically check them
34435e770dfSJerome ForissierCFG_WITH_STACK_CANARIES ?= y
34535e770dfSJerome Forissier
346*e2f03e07SJerome Forissier# Use compiler instrumentation to troubleshoot stack overflows.
347*e2f03e07SJerome Forissier# When enabled, most C functions check the stack pointer against the current
348*e2f03e07SJerome Forissier# stack limits on entry and panic immediately if it is out of range.
349*e2f03e07SJerome ForissierCFG_CORE_DEBUG_CHECK_STACKS ?= n
350*e2f03e07SJerome Forissier
351b908c675SJens Wiklander# Device Tree support
352c95b9511SEtienne Carriere#
353c95b9511SEtienne Carriere# When CFG_DT is enabled core embeds the FDT library (libfdt) allowing
354c95b9511SEtienne Carriere# device tree blob (DTB) parsing from the core.
355c95b9511SEtienne Carriere#
356c95b9511SEtienne Carriere# When CFG_DT is enabled, the TEE _start function expects to find
357c95b9511SEtienne Carriere# the address of a DTB in register X2/R2 provided by the early boot stage
358c95b9511SEtienne Carriere# or value 0 if boot stage provides no DTB.
359c95b9511SEtienne Carriere#
360c95b9511SEtienne Carriere# When CFG_EMBED_DTB is enabled, CFG_EMBED_DTB_SOURCE_FILE shall define the
361c95b9511SEtienne Carriere# relative path of a DTS file located in core/arch/$(ARCH)/dts.
362c95b9511SEtienne Carriere# The DTS file is compiled into a DTB file which content is embedded in a
363c95b9511SEtienne Carriere# read-only section of the core.
364c95b9511SEtienne Carriereifneq ($(strip $(CFG_EMBED_DTB_SOURCE_FILE)),)
365c95b9511SEtienne CarriereCFG_EMBED_DTB ?= y
366c95b9511SEtienne Carriereendif
367c95b9511SEtienne Carriereifeq ($(CFG_EMBED_DTB),y)
368c95b9511SEtienne Carriere$(call force,CFG_DT,y)
369c95b9511SEtienne Carriereendif
370c95b9511SEtienne CarriereCFG_EMBED_DTB ?= n
371b908c675SJens WiklanderCFG_DT ?= n
37276358becSJens Wiklander
37376358becSJens Wiklander# Maximum size of the Device Tree Blob, has to be large enough to allow
37476358becSJens Wiklander# editing of the supplied DTB.
37576358becSJens WiklanderCFG_DTB_MAX_SIZE ?= 0x10000
3764d62e91aSVictor Chong
3770a3ad9b6SBryan O'Donoghue# Device Tree Overlay support.
3780a3ad9b6SBryan O'Donoghue# This define enables support for an OP-TEE provided DTB overlay.
3790a3ad9b6SBryan O'Donoghue# One of two modes is supported in this case:
3800a3ad9b6SBryan O'Donoghue# 1. Append OP-TEE nodes to an existing DTB overlay located at CFG_DT_ADDR or
3810a3ad9b6SBryan O'Donoghue#    passed in arg2
3820a3ad9b6SBryan O'Donoghue# 2. Generate a new DTB overlay at CFG_DT_ADDR
3830a3ad9b6SBryan O'Donoghue# A subsequent boot stage must then merge the generated overlay DTB into a main
3840a3ad9b6SBryan O'Donoghue# DTB using the standard fdt_overlay_apply() method.
3850a3ad9b6SBryan O'DonoghueCFG_EXTERNAL_DTB_OVERLAY ?= n
3860a3ad9b6SBryan O'Donoghue
38735964dc9SEtienne Carriere# Enable core self tests and related pseudo TAs
3884d62e91aSVictor ChongCFG_TEE_CORE_EMBED_INTERNAL_TESTS ?= y
3896d96f208Syanyan-wrs
3906d96f208Syanyan-wrs# This option enables OP-TEE to respond to SMP boot request: the Rich OS
3916d96f208Syanyan-wrs# issues this to request OP-TEE to release secondaries cores out of reset,
3926d96f208Syanyan-wrs# with specific core number and non-secure entry address.
3936d96f208Syanyan-wrsCFG_BOOT_SECONDARY_REQUEST ?= n
3946d96f208Syanyan-wrs
395f5f914aaSJens Wiklander# Default heap size for Core, 64 kB
396f5f914aaSJens WiklanderCFG_CORE_HEAP_SIZE ?= 65536
397f3bb2312SJerome Forissier
398386fc264SVolodymyr Babchuk# Default size of nexus heap. 16 kB. Used only if CFG_VIRTUALIZATION
399386fc264SVolodymyr Babchuk# is enabled
400386fc264SVolodymyr BabchukCFG_CORE_NEX_HEAP_SIZE ?= 16384
401386fc264SVolodymyr Babchuk
402883c4be3SJerome Forissier# TA profiling.
403883c4be3SJerome Forissier# When this option is enabled, OP-TEE can execute Trusted Applications
404883c4be3SJerome Forissier# instrumented with GCC's -pg flag and will output profiling information
405883c4be3SJerome Forissier# in gmon.out format to /tmp/gmon-<ta_uuid>.out (path is defined in
406883c4be3SJerome Forissier# tee-supplicant)
4078800b01dSJerome Forissier# Note: this does not work well with shared libraries at the moment for a
4088800b01dSJerome Forissier# couple of reasons:
4098800b01dSJerome Forissier# 1. The profiling code assumes a unique executable section in the TA VA space.
4108800b01dSJerome Forissier# 2. The code used to detect at run time if the TA is intrumented assumes that
4118800b01dSJerome Forissier# the TA is linked statically.
412883c4be3SJerome ForissierCFG_TA_GPROF_SUPPORT ?= n
413f3bb2312SJerome Forissier
414b02ae382SSumit Garg# TA function tracing.
415b02ae382SSumit Garg# When this option is enabled, OP-TEE can execute Trusted Applications
416b02ae382SSumit Garg# instrumented with GCC's -pg flag and will output function tracing
417b02ae382SSumit Garg# information in ftrace.out format to /tmp/ftrace-<ta_uuid>.out (path is
418b02ae382SSumit Garg# defined in tee-supplicant)
419099918f6SSumit GargCFG_FTRACE_SUPPORT ?= n
420b02ae382SSumit Garg
421d408db99SJerome Forissier# How to make room when the function tracing buffer is full?
422d408db99SJerome Forissier# 'shift': shift the previously stored data by the amount needed in order
423d408db99SJerome Forissier#    to always keep the latest logs (slower, especially with big buffer sizes)
424d408db99SJerome Forissier# 'wrap': discard the previous data and start at the beginning of the buffer
425d408db99SJerome Forissier#    again (fast, but can result in a mostly empty buffer)
426d408db99SJerome Forissier# 'stop': stop logging new data
427d408db99SJerome ForissierCFG_FTRACE_BUF_WHEN_FULL ?= shift
428d408db99SJerome Forissier$(call cfg-check-value,FTRACE_BUF_WHEN_FULL,shift stop wrap)
429d408db99SJerome Forissier$(call force,_CFG_FTRACE_BUF_WHEN_FULL_$(CFG_FTRACE_BUF_WHEN_FULL),y)
430d408db99SJerome Forissier
431d1492098SJerome Forissier# Function tracing: unit to be used when displaying durations
432d1492098SJerome Forissier#  0: always display durations in microseconds
433d1492098SJerome Forissier# >0: if duration is greater or equal to the specified value (in microseconds),
434d1492098SJerome Forissier#     display it in milliseconds
435d1492098SJerome ForissierCFG_FTRACE_US_MS ?= 10000
436d1492098SJerome Forissier
437099918f6SSumit Garg# Core syscall function tracing.
438099918f6SSumit Garg# When this option is enabled, OP-TEE core is instrumented with GCC's
439099918f6SSumit Garg# -pg flag and will output syscall function graph in user TA ftrace
440099918f6SSumit Garg# buffer
441099918f6SSumit GargCFG_SYSCALL_FTRACE ?= n
442099918f6SSumit Garg$(call cfg-depends-all,CFG_SYSCALL_FTRACE,CFG_FTRACE_SUPPORT)
443099918f6SSumit Garg
444883c4be3SJerome Forissier# Enable to compile user TA libraries with profiling (-pg).
445099918f6SSumit Garg# Depends on CFG_TA_GPROF_SUPPORT or CFG_FTRACE_SUPPORT.
446735565dbSSumit GargCFG_ULIBS_MCOUNT ?= n
4470f8adafeSJerome Forissier# Profiling/tracing of syscall wrapper (utee_*)
4480f8adafeSJerome ForissierCFG_SYSCALL_WRAPPERS_MCOUNT ?= $(CFG_ULIBS_MCOUNT)
449883c4be3SJerome Forissier
4500f8adafeSJerome Forissierifeq (y,$(filter y,$(CFG_ULIBS_MCOUNT) $(CFG_SYSCALL_WRAPPERS_MCOUNT)))
451099918f6SSumit Gargifeq (,$(filter y,$(CFG_TA_GPROF_SUPPORT) $(CFG_FTRACE_SUPPORT)))
452883c4be3SJerome Forissier$(error Cannot instrument user libraries if user mode profiling is disabled)
453f3bb2312SJerome Forissierendif
454f3bb2312SJerome Forissierendif
455cb0b5954SJens Wiklander
4567fb525f1SJerome Forissier# Build libutee, libutils, libmbedtls as shared libraries.
45764718c93SJerome Forissier# - Static libraries are still generated when this is enabled, but TAs will use
45864718c93SJerome Forissier# the shared libraries unless explicitly linked with the -static flag.
45964718c93SJerome Forissier# - Shared libraries are made of two files: for example, libutee is
46064718c93SJerome Forissier#   libutee.so and 527f1a47-b92c-4a74-95bd-72f19f4a6f74.ta. The '.so' file
46164718c93SJerome Forissier#   is a totally standard shared object, and should be used to link against.
46264718c93SJerome Forissier#   The '.ta' file is a signed version of the '.so' and should be installed
46364718c93SJerome Forissier#   in the same way as TAs so that they can be found at runtime.
46464718c93SJerome ForissierCFG_ULIBS_SHARED ?= n
46564718c93SJerome Forissier
46670aa7511SJerome Forissierifeq (yy,$(CFG_TA_GPROF_SUPPORT)$(CFG_ULIBS_SHARED))
46770aa7511SJerome Forissier$(error CFG_TA_GPROF_SUPPORT and CFG_ULIBS_SHARED are currently incompatible)
46870aa7511SJerome Forissierendif
46970aa7511SJerome Forissier
470cb0b5954SJens Wiklander# CFG_GP_SOCKETS
471cb0b5954SJens Wiklander# Enable Global Platform Sockets support
472cb0b5954SJens WiklanderCFG_GP_SOCKETS ?= y
47380a4e51dSEtienne Carriere
47480a4e51dSEtienne Carriere# Enable Secure Data Path support in OP-TEE core (TA may be invoked with
47580a4e51dSEtienne Carriere# invocation parameters referring to specific secure memories).
47680a4e51dSEtienne CarriereCFG_SECURE_DATA_PATH ?= n
47700da26ecSAndrew F. Davis
478c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
479c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
480c9720143SJens Wiklander# metadata in secure storage.
481c9720143SJens WiklanderCFG_SECSTOR_TA ?= $(call cfg-all-enabled,CFG_REE_FS CFG_WITH_USER_TA)
482c9720143SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA,CFG_REE_FS CFG_WITH_USER_TA))
483c9720143SJens Wiklander
48430668b28SJens Wiklander# Enable the pseudo TA that managages TA storage in secure storage
48530668b28SJens WiklanderCFG_SECSTOR_TA_MGMT_PTA ?= $(call cfg-all-enabled,CFG_SECSTOR_TA)
48630668b28SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA_MGMT_PTA,CFG_SECSTOR_TA))
487c9720143SJens Wiklander
4884bca302aSIgor Opaniuk# Enable the pseudo TA for misc. auxilary services, extending existing
4894bca302aSIgor Opaniuk# GlobalPlatform Core API (for example, re-seeding RNG entropy pool etc.)
4904bca302aSIgor OpaniukCFG_SYSTEM_PTA ?= y
4914bca302aSIgor Opaniuk
4920b611081SSumit Garg# Enable the pseudo TA for enumeration of TEE based devices for the normal
4930b611081SSumit Garg# world OS.
4940b611081SSumit GargCFG_DEVICE_ENUM_PTA ?= y
4950b611081SSumit Garg
49600da26ecSAndrew F. Davis# Define the number of cores per cluster used in calculating core position.
49700da26ecSAndrew F. Davis# The cluster number is shifted by this value and added to the core ID,
49800da26ecSAndrew F. Davis# so its value represents log2(cores/cluster).
49900da26ecSAndrew F. Davis# Default is 2**(2) = 4 cores per cluster.
50000da26ecSAndrew F. DavisCFG_CORE_CLUSTER_SHIFT ?= 2
501d81f93a7SVolodymyr Babchuk
5028be2de1aSImre Kis# Define the number of threads per core used in calculating processing
5038be2de1aSImre Kis# element's position. The core number is shifted by this value and added to
5048be2de1aSImre Kis# the thread ID, so its value represents log2(threads/core).
5058be2de1aSImre Kis# Default is 2**(0) = 1 threads per core.
5068be2de1aSImre KisCFG_CORE_THREAD_SHIFT ?= 0
5078be2de1aSImre Kis
50837a6b717SJens Wiklander# Enable support for dynamic shared memory (shared memory anywhere in
50937a6b717SJens Wiklander# non-secure memory).
51037a6b717SJens WiklanderCFG_CORE_DYN_SHM ?= y
51137a6b717SJens Wiklander
5128aeb6c94SJens Wiklander# Enable support for reserved shared memory (shared memory in a carved out
5138aeb6c94SJens Wiklander# memory area).
5148aeb6c94SJens WiklanderCFG_CORE_RESERVED_SHM ?= y
5158aeb6c94SJens Wiklander
516dd3afbacSJens Wiklander# Enables support for larger physical addresses, that is, it will define
517dd3afbacSJens Wiklander# paddr_t as a 64-bit type.
518dd3afbacSJens WiklanderCFG_CORE_LARGE_PHYS_ADDR ?= n
519e3458e03SJerome Forissier
520e3458e03SJerome Forissier# Define the maximum size, in bits, for big numbers in the Internal Core API
521e3458e03SJerome Forissier# Arithmetical functions. This does *not* influence the key size that may be
522e3458e03SJerome Forissier# manipulated through the Cryptographic API.
523e3458e03SJerome Forissier# Set this to a lower value to reduce the TA memory footprint.
524e3458e03SJerome ForissierCFG_TA_BIGNUM_MAX_BITS ?= 2048
525409d2ff0SJerome Forissier
526409d2ff0SJerome Forissier# Define the maximum size, in bits, for big numbers in the TEE core (privileged
527409d2ff0SJerome Forissier# layer).
528409d2ff0SJerome Forissier# This value is an upper limit for the key size in any cryptographic algorithm
529409d2ff0SJerome Forissier# implemented by the TEE core.
530409d2ff0SJerome Forissier# Set this to a lower value to reduce the memory footprint.
531409d2ff0SJerome ForissierCFG_CORE_BIGNUM_MAX_BITS ?= 4096
532a97bc4a0SJens Wiklander
5337fb525f1SJerome Forissier# Not used since libmpa was removed. Force the values to catch build scripts
5347fb525f1SJerome Forissier# that would set = n.
5357fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS_MPI,y)
5367fb525f1SJerome Forissier$(call force,CFG_TA_MBEDTLS,y)
537a97bc4a0SJens Wiklander
538a97bc4a0SJens Wiklander# Compile the TA library mbedTLS with self test functions, the functions
539a97bc4a0SJens Wiklander# need to be called to test anything
540a97bc4a0SJens WiklanderCFG_TA_MBEDTLS_SELF_TEST ?= y
541017dfaf8SGabor Szekely
54268689d86SJens Wiklander# By default use tomcrypt as the main crypto lib providing an implementation
54368689d86SJens Wiklander# for the API in <crypto/crypto.h>
54468689d86SJens Wiklander# CFG_CRYPTOLIB_NAME is used as libname and
54568689d86SJens Wiklander# CFG_CRYPTOLIB_DIR is used as libdir when compiling the library
54677327d7aSEdison Ai#
54777327d7aSEdison Ai# It's also possible to configure to use mbedtls instead of tomcrypt.
54877327d7aSEdison Ai# Then the variables should be assigned as "CFG_CRYPTOLIB_NAME=mbedtls" and
54977327d7aSEdison Ai# "CFG_CRYPTOLIB_DIR=lib/libmbedtls" respectively.
55068689d86SJens WiklanderCFG_CRYPTOLIB_NAME ?= tomcrypt
55168689d86SJens WiklanderCFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt
55268689d86SJens Wiklander
553017dfaf8SGabor Szekely# Enable TEE_ALG_RSASSA_PKCS1_V1_5 algorithm for signing with PKCS#1 v1.5 EMSA
55468689d86SJens Wiklander# without ASN.1 around the hash.
55568689d86SJens Wiklanderifeq ($(CFG_CRYPTOLIB_NAME),tomcrypt)
556017dfaf8SGabor SzekelyCFG_CRYPTO_RSASSA_NA1 ?= y
55768689d86SJens Wiklanderendif
55815216d4dSVolodymyr Babchuk
5597fb525f1SJerome Forissier# Not used since libmpa was removed. Force the value to catch build scripts
5607fb525f1SJerome Forissier# that would set = n.
5617fb525f1SJerome Forissier$(call force,CFG_CORE_MBEDTLS_MPI,y)
5627fb525f1SJerome Forissier
56315216d4dSVolodymyr Babchuk# Enable virtualization support. OP-TEE will not work without compatible
56415216d4dSVolodymyr Babchuk# hypervisor if this option is enabled.
56515216d4dSVolodymyr BabchukCFG_VIRTUALIZATION ?= n
56615216d4dSVolodymyr Babchuk
56715216d4dSVolodymyr Babchukifeq ($(CFG_VIRTUALIZATION),y)
56815216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RODATA_NOEXEC,y)
56915216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RWDATA_NOEXEC,y)
570c4e8be26SVolodymyr Babchuk
571c4e8be26SVolodymyr Babchuk# Default number of virtual guests
572c4e8be26SVolodymyr BabchukCFG_VIRT_GUEST_COUNT ?= 2
57315216d4dSVolodymyr Babchukendif
57415216d4dSVolodymyr Babchuk
57517888736SJens Wiklander# Enables backwards compatible derivation of RPMB and SSK keys
57617888736SJens WiklanderCFG_CORE_HUK_SUBKEY_COMPAT ?= y
577a2087649SJerome Forissier
578a2087649SJerome Forissier# Compress and encode conf.mk into the TEE core, and show the encoded string on
579a2087649SJerome Forissier# boot (with severity TRACE_INFO).
580a2087649SJerome ForissierCFG_SHOW_CONF_ON_BOOT ?= n
581dd333f03SJavier Almansa Sobrino
582dd333f03SJavier Almansa Sobrino# Enables support for passing a TPM Event Log stored in secure memory
583dd333f03SJavier Almansa Sobrino# to a TA, so a TPM Service could use it to extend any measurement
584dd333f03SJavier Almansa Sobrino# taken before the service was up and running.
585dd333f03SJavier Almansa SobrinoCFG_CORE_TPM_EVENT_LOG ?= n
586ae8c8068SEtienne Carriere
587ae8c8068SEtienne Carriere# When enabled, CFG_SCMI_MSG_DRIVERS embeds SCMI message drivers in the core.
588ae8c8068SEtienne Carriere# Refer to the supported SCMI features embedded upon CFG_SCMI_MSG_*
589a7a9e3baSEtienne Carriere# CFG_SCMI_MSG_CLOCK embeds SCMI clock protocol support.
59056a1f10eSEtienne Carriere# CFG_SCMI_MSG_RESET_DOMAIN embeds SCMI reset domain protocol support.
591a58c4d70SEtienne Carriere# CFG_SCMI_MSG_SMT embeds SMT based message buffer of communication channel
592ae8c8068SEtienne CarriereCFG_SCMI_MSG_DRIVERS ?= n
593a7a9e3baSEtienne CarriereCFG_SCMI_MSG_CLOCK ?= n
59456a1f10eSEtienne CarriereCFG_SCMI_MSG_RESET_DOMAIN ?= n
595a58c4d70SEtienne CarriereCFG_SCMI_MSG_SMT ?= n
596