xref: /optee_os/mk/config.mk (revision c2ce4186edb0412c8a0069ff4ee2eb2ec66d09fe)
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
353f17b838SEtienne Carriere# Define DEBUG=1 to compile without optimization (forces -O0)
36b0104773SPascal Brand# DEBUG=1
37b0104773SPascal Brand
384ec2358eSJerome Forissier# If y, enable debug features of the TEE core (assertions and lock checks
394ec2358eSJerome Forissier# are enabled, panic and assert messages are more verbose, data and prefetch
404ec2358eSJerome Forissier# aborts show a stack dump). When disabled, the NDEBUG directive is defined
414ec2358eSJerome Forissier# so assertions are disabled.
424ec2358eSJerome ForissierCFG_TEE_CORE_DEBUG ?= y
43b0104773SPascal Brand
443f58e4ecSOvidiu Mihalachi# Log levels for the TEE core. Defines which core messages are displayed
453f58e4ecSOvidiu Mihalachi# on the secure console. Disabling core log (level set to 0) also disables
463f58e4ecSOvidiu Mihalachi# logs from the TAs.
4709ca9f8bSJerome Forissier# 0: none
4809ca9f8bSJerome Forissier# 1: error
4909ca9f8bSJerome Forissier# 2: error + warning
5009ca9f8bSJerome Forissier# 3: error + warning + debug
5109ca9f8bSJerome Forissier# 4: error + warning + debug + flow
52e0042c88SPascal BrandCFG_TEE_CORE_LOG_LEVEL ?= 1
533f58e4ecSOvidiu Mihalachi
543f58e4ecSOvidiu Mihalachi# TA log level
553f58e4ecSOvidiu Mihalachi# If user-mode library libutils.a is built with CFG_TEE_TA_LOG_LEVEL=0,
563f58e4ecSOvidiu Mihalachi# TA tracing is disabled regardless of the value of CFG_TEE_TA_LOG_LEVEL
573f58e4ecSOvidiu Mihalachi# when the TA is built.
58e0042c88SPascal BrandCFG_TEE_TA_LOG_LEVEL ?= 1
59b0104773SPascal Brand
607c876f12SPascal Brand# TA enablement
617c876f12SPascal Brand# When defined to "y", TA traces are output according to
627c876f12SPascal Brand# CFG_TEE_TA_LOG_LEVEL. Otherwise, they are not output at all
637c876f12SPascal BrandCFG_TEE_CORE_TA_TRACE ?= y
64b0104773SPascal Brand
658c8e1441SJerome Forissier# If y, enable the memory leak detection feature in the bget memory allocator.
668c8e1441SJerome Forissier# When this feature is enabled, calling mdbg_check(1) will print a list of all
678c8e1441SJerome Forissier# the currently allocated buffers and the location of the allocation (file and
688c8e1441SJerome Forissier# line number).
698c8e1441SJerome Forissier# Note: make sure the log level is high enough for the messages to show up on
708c8e1441SJerome Forissier# the secure console! For instance:
718c8e1441SJerome Forissier# - To debug user-mode (TA) allocations: build OP-TEE *and* the TA with:
728c8e1441SJerome Forissier#   $ make CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=3
738c8e1441SJerome Forissier# - To debug TEE core allocations: build OP-TEE with:
748c8e1441SJerome Forissier#   $ make CFG_TEE_CORE_MALLOC_DEBUG=y CFG_TEE_CORE_LOG_LEVEL=3
750fcbddd4SSY ChiuCFG_TEE_CORE_MALLOC_DEBUG ?= n
760fcbddd4SSY ChiuCFG_TEE_TA_MALLOC_DEBUG ?= n
77*c2ce4186SJens Wiklander# Prints an error message and dumps the stack on failed memory allocations
78*c2ce4186SJens Wiklander# using malloc() and friends.
79*c2ce4186SJens WiklanderCFG_CORE_DUMP_OOM ?= $(CFG_TEE_CORE_MALLOC_DEBUG)
800fcbddd4SSY Chiu
812bfab756SJerome Forissier# Mask to select which messages are prefixed with long debugging information
8264fad262SVolodymyr Babchuk# (severity, core ID, thread ID, component name, function name, line number)
8364fad262SVolodymyr Babchuk# based on the message level. If BIT(level) is set, the long prefix is shown.
842bfab756SJerome Forissier# Otherwise a short prefix is used (severity and component name only).
85f4aa5b11SJerome Forissier# Levels: 0=none 1=error 2=info 3=debug 4=flow
862bfab756SJerome ForissierCFG_MSG_LONG_PREFIX_MASK ?= 0x1a
87f4aa5b11SJerome Forissier
88120c43adSJerome Forissier# PRNG configuration
897018ae01SSY Chiu# If CFG_WITH_SOFTWARE_PRNG is enabled, crypto provider provided
907018ae01SSY Chiu# software PRNG implementation is used.
917018ae01SSY Chiu# Otherwise, you need to implement hw_get_random_byte() for your platform
927018ae01SSY ChiuCFG_WITH_SOFTWARE_PRNG ?= y
93120c43adSJerome Forissier
94120c43adSJerome Forissier# Number of threads
95120c43adSJerome ForissierCFG_NUM_THREADS ?= 2
96ab35d7adSCedric Chaumont
97ab35d7adSCedric Chaumont# API implementation version
98ab35d7adSCedric ChaumontCFG_TEE_API_VERSION ?= GPD-1.1-dev
99ab35d7adSCedric Chaumont
100ab35d7adSCedric Chaumont# Implementation description (implementation-dependent)
101ab35d7adSCedric ChaumontCFG_TEE_IMPL_DESCR ?= OPTEE
102ab35d7adSCedric Chaumont
10329cff5cfSJerome Forissier# Should OPTEE_SMC_CALL_GET_OS_REVISION return a build identifier to Normal
10429cff5cfSJerome Forissier# World?
10529cff5cfSJerome ForissierCFG_OS_REV_REPORTS_GIT_SHA1 ?= y
10629cff5cfSJerome Forissier
107ab35d7adSCedric Chaumont# Trusted OS implementation version
1084bf425c1SJens WiklanderTEE_IMPL_VERSION ?= $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
10929cff5cfSJerome Forissierifeq ($(CFG_OS_REV_REPORTS_GIT_SHA1),y)
11029cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo 0)
11129cff5cfSJerome Forissierelse
11229cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x0
11329cff5cfSJerome Forissierendif
11435c507f2SJerome Forissier# The following values are not extracted from the "git describe" output because
11535c507f2SJerome Forissier# we might be outside of a Git environment, or the tree may have been cloned
11635c507f2SJerome Forissier# with limited depth not including any tag, so there is really no guarantee
11735c507f2SJerome Forissier# that TEE_IMPL_VERSION contains the major and minor revision numbers.
118a83aec29SJerome ForissierCFG_OPTEE_REVISION_MAJOR ?= 3
1198bd53f40SJerome ForissierCFG_OPTEE_REVISION_MINOR ?= 4
120ab35d7adSCedric Chaumont
121ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
122ab35d7adSCedric ChaumontCFG_TEE_MANUFACTURER ?= LINARO
123ab35d7adSCedric Chaumont
124ab35d7adSCedric Chaumont# Trusted firmware version
125ab35d7adSCedric ChaumontCFG_TEE_FW_IMPL_VERSION ?= FW_IMPL_UNDEF
126ab35d7adSCedric Chaumont
127ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
128ab35d7adSCedric ChaumontCFG_TEE_FW_MANUFACTURER ?= FW_MAN_UNDEF
129ab35d7adSCedric Chaumont
130b44708c1SJerome Forissier# Rich Execution Environment (REE) file system support: normal world OS
131b44708c1SJerome Forissier# provides the actual storage.
132b44708c1SJerome Forissier# This is the default FS when enabled (i.e., the one used when
133b44708c1SJerome Forissier# TEE_STORAGE_PRIVATE is passed to the trusted storage API)
134b44708c1SJerome ForissierCFG_REE_FS ?= y
135bc420748SJens Wiklander
13688e6e089SJerome Forissier# RPMB file system support
13788e6e089SJerome ForissierCFG_RPMB_FS ?= n
13888e6e089SJerome Forissier
13988e6e089SJerome Forissier# Device identifier used when CFG_RPMB_FS = y.
14088e6e089SJerome Forissier# The exact meaning of this value is platform-dependent. On Linux, the
14188e6e089SJerome Forissier# tee-supplicant process will open /dev/mmcblk<id>rpmb
14288e6e089SJerome ForissierCFG_RPMB_FS_DEV_ID ?= 0
14388e6e089SJerome Forissier
144ed1993b7SJerome Forissier# Enables RPMB key programming by the TEE, in case the RPMB partition has not
145ed1993b7SJerome Forissier# been configured yet.
146ed1993b7SJerome Forissier# !!! Security warning !!!
147ed1993b7SJerome Forissier# Do *NOT* enable this in product builds, as doing so would allow the TEE to
148ed1993b7SJerome Forissier# leak the RPMB key.
149ed1993b7SJerome Forissier# This option is useful in the following situations:
150ed1993b7SJerome Forissier# - Testing
151ed1993b7SJerome Forissier# - RPMB key provisioning in a controlled environment (factory setup)
152ed1993b7SJerome ForissierCFG_RPMB_WRITE_KEY ?= n
153ed1993b7SJerome Forissier
154bc420748SJens Wiklander# Embed public part of this key in OP-TEE OS
155bc420748SJens WiklanderTA_SIGN_KEY ?= keys/default_ta.pem
156c4553de7SJerome Forissier
157c4553de7SJerome Forissier# Include lib/libutils/isoc in the build? Most platforms need this, but some
158c4553de7SJerome Forissier# may not because they obtain the isoc functions from elsewhere
159c4553de7SJerome ForissierCFG_LIBUTILS_WITH_ISOC ?= y
160fce4cfa1SJens Wiklander
1610de9a5fbSJens Wiklander# Enables floating point support for user TAs
1620de9a5fbSJens Wiklander# ARM32: EABI defines both a soft-float ABI and a hard-float ABI,
1630de9a5fbSJens Wiklander#	 hard-float is basically a super set of soft-float. Hard-float
1640de9a5fbSJens Wiklander#	 requires all the support routines provided for soft-float, but the
1650de9a5fbSJens Wiklander#	 compiler may choose to optimize to not use some of them and use
1660de9a5fbSJens Wiklander#	 the floating-point registers instead.
1670de9a5fbSJens Wiklander# ARM64: EABI doesn't define a soft-float ABI, everything is hard-float (or
1680de9a5fbSJens Wiklander#	 nothing with ` -mgeneral-regs-only`)
1690de9a5fbSJens Wiklander# With CFG_TA_FLOAT_SUPPORT enabled TA code is free use floating point types
1700de9a5fbSJens WiklanderCFG_TA_FLOAT_SUPPORT ?= y
171923c1f34SJens Wiklander
1727411e0e1SJerome Forissier# Stack unwinding: print a stack dump to the console on core or TA abort, or
1737411e0e1SJerome Forissier# when a TA panics.
17431a29642SJerome Forissier# If CFG_UNWIND is enabled, both the kernel and user mode call stacks can be
17531a29642SJerome Forissier# unwound (not paged TAs, however).
17631a29642SJerome Forissier# Note that 32-bit ARM code needs unwind tables for this to work, so enabling
17731a29642SJerome Forissier# this option will increase the size of the 32-bit TEE binary by a few KB.
17831a29642SJerome Forissier# Similarly, TAs have to be compiled with -funwind-tables (default when the
17931a29642SJerome Forissier# option is set) otherwise they can't be unwound.
1807411e0e1SJerome Forissier# Warning: since the unwind sequence for user-mode (TA) code is implemented in
1817411e0e1SJerome Forissier# the privileged layer of OP-TEE, enabling this feature will weaken the
1827411e0e1SJerome Forissier# user/kernel isolation. Therefore it should be disabled in release builds.
1833f17b838SEtienne Carriereifeq ($(CFG_TEE_CORE_DEBUG),y)
18431a29642SJerome ForissierCFG_UNWIND ?= y
185923c1f34SJens Wiklanderendif
1866fbac37eSJens Wiklander
1876fbac37eSJens Wiklander# Enable support for dynamically loaded user TAs
1886fbac37eSJens WiklanderCFG_WITH_USER_TA ?= y
1892a142248SJens Wiklander
19024d49094SJerome Forissier# Choosing the architecture(s) of user-mode libraries (used by TAs)
19124d49094SJerome Forissier#
19224d49094SJerome Forissier# Platforms may define a list of supported architectures for user-mode code
19324d49094SJerome Forissier# by setting $(supported-ta-targets). Valid values are "ta_arm32", "ta_arm64",
19424d49094SJerome Forissier# "ta_arm32 ta_arm64" and "ta_arm64 ta_arm32".
19524d49094SJerome Forissier# $(supported-ta-targets) defaults to "ta_arm32" when the TEE core is 32-bits,
19624d49094SJerome Forissier# and "ta_arm32 ta_arm64" when it is 64-bits (that is, when CFG_ARM64_core=y).
19724d49094SJerome Forissier# The first entry in $(supported-ta-targets) has a special role, see
19824d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> below.
19924d49094SJerome Forissier#
20024d49094SJerome Forissier# CFG_USER_TA_TARGETS may be defined to restrict $(supported-ta-targets) or
20124d49094SJerome Forissier# change the order of the values.
20224d49094SJerome Forissier#
20324d49094SJerome Forissier# The list of TA architectures is ultimately stored in $(ta-targets).
20424d49094SJerome Forissier
20524d49094SJerome Forissier# CFG_USER_TA_TARGET_<ta-name> (for example, CFG_USER_TA_TARGET_avb), if
20624d49094SJerome Forissier# defined, selects the unique TA architecture mode for building the in-tree TA
20724d49094SJerome Forissier# <ta-name>. Can be either ta_arm32 or ta_arm64.
20824d49094SJerome Forissier# By default, in-tree TAs are built using the first architecture specified in
20924d49094SJerome Forissier# $(ta-targets).
21024d49094SJerome Forissier
2117dfff131SJerome Forissier# Address Space Layout Randomization for user-mode Trusted Applications
2127dfff131SJerome Forissier#
2137dfff131SJerome Forissier# When this flag is enabled, the ELF loader will introduce a random offset
2147dfff131SJerome Forissier# when mapping the application in user space. ASLR makes the exploitation of
2157dfff131SJerome Forissier# memory corruption vulnerabilities more difficult.
2167dfff131SJerome ForissierCFG_TA_ASLR ?= n
2177dfff131SJerome Forissier
2187dfff131SJerome Forissier# How much ASLR may shift the base address (in pages). The base address is
2197dfff131SJerome Forissier# randomly shifted by an integer number of pages comprised between these two
2207dfff131SJerome Forissier# values. Bigger ranges are more secure because they make the addresses harder
2217dfff131SJerome Forissier# to guess at the expense of using more memory for the page tables.
2227dfff131SJerome ForissierCFG_TA_ASLR_MIN_OFFSET_PAGES ?= 0
2237dfff131SJerome ForissierCFG_TA_ASLR_MAX_OFFSET_PAGES ?= 128
2247dfff131SJerome Forissier
225ee664c19SJerome Forissier# Load user TAs from the REE filesystem via tee-supplicant
226ee664c19SJerome ForissierCFG_REE_FS_TA ?= y
227ee664c19SJerome Forissier
2287db24ad6SJerome Forissier# Pre-authentication of TA binaries loaded from the REE filesystem
2297db24ad6SJerome Forissier#
2307db24ad6SJerome Forissier# - If CFG_REE_FS_TA_BUFFERED=y: load TA binary into a temporary buffer in the
2317db24ad6SJerome Forissier#   "Secure DDR" pool, check the signature, then process the file only if it is
2327db24ad6SJerome Forissier#   valid.
2337db24ad6SJerome Forissier# - If disabled: hash the binaries as they are being processed and verify the
2347db24ad6SJerome Forissier#   signature as a last step.
2357db24ad6SJerome ForissierCFG_REE_FS_TA_BUFFERED ?= $(CFG_REE_FS_TA)
2367db24ad6SJerome Forissier$(eval $(call cfg-depends-all,CFG_REE_FS_TA_BUFFERED,CFG_REE_FS_TA))
2377db24ad6SJerome Forissier
238d0c63614SJerome Forissier# Support for loading user TAs from a special section in the TEE binary.
239d0c63614SJerome Forissier# Such TAs are available even before tee-supplicant is available (hence their
240d0c63614SJerome Forissier# name), but note that many services exported to TAs may need tee-supplicant,
241d0c63614SJerome Forissier# so early use is limited to a subset of the TEE Internal Core API (crypto...)
242d0c63614SJerome Forissier# To use this feature, set EARLY_TA_PATHS to the paths to one or more TA ELF
243d0c63614SJerome Forissier# file(s). For example:
244d0c63614SJerome Forissier#   $ make ... \
245d0c63614SJerome Forissier#     EARLY_TA_PATHS="path/to/8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf \
246d0c63614SJerome Forissier#                     path/to/cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.stripped.elf"
247d0c63614SJerome Forissier# Typical build steps:
248d0c63614SJerome Forissier#   $ make ta_dev_kit CFG_EARLY_TA=y # Create the dev kit (user mode libraries,
249d0c63614SJerome Forissier#                                    # headers, makefiles), ready to build TAs.
250d0c63614SJerome Forissier#                                    # CFG_EARLY_TA=y is optional, it prevents
251d0c63614SJerome Forissier#                                    # later library recompilations.
252d0c63614SJerome Forissier#   <build some TAs>
253d0c63614SJerome Forissier#   $ make EARLY_TA_PATHS=<paths>    # Build OP-TEE and embbed the TA(s)
2543638ea32SJens Wiklander#
2553638ea32SJens Wiklander# Another option is CFG_IN_TREE_EARLY_TAS which is used to point at
2563638ea32SJens Wiklander# in-tree TAs. CFG_IN_TREE_EARLY_TAS is formatted as:
2573638ea32SJens Wiklander# <name-of-ta>/<uuid>
2583638ea32SJens Wiklander# for instance avb/023f8f1a-292a-432b-8fc4-de8471358067
2593638ea32SJens Wiklanderifneq ($(EARLY_TA_PATHS)$(CFG_IN_TREE_EARLY_TAS),)
260d0c63614SJerome Forissier$(call force,CFG_EARLY_TA,y)
261d0c63614SJerome Forissierelse
262d0c63614SJerome ForissierCFG_EARLY_TA ?= n
263d0c63614SJerome Forissierendif
264509a9802SJerome Forissierifeq ($(CFG_EARLY_TA),y)
265509a9802SJerome Forissier$(call force,CFG_ZLIB,y)
266509a9802SJerome Forissierendif
267d0c63614SJerome Forissier
268c27907e1SJerome Forissier# Support for dynamically linked user TAs
269c27907e1SJerome ForissierCFG_TA_DYNLINK ?= y
270c27907e1SJerome Forissier
271a884c935SJens Wiklander# Enable paging, requires SRAM, can't be enabled by default
272a884c935SJens WiklanderCFG_WITH_PAGER ?= n
273a884c935SJens Wiklander
274ab0df69eSJerome Forissier# Runtime lock dependency checker: ensures that a proper locking hierarchy is
275ab0df69eSJerome Forissier# used in the TEE core when acquiring and releasing mutexes. Any violation will
276ab0df69eSJerome Forissier# cause a panic as soon as the invalid locking condition is detected. If
277ab0df69eSJerome Forissier# CFG_UNWIND is enabled, the algorithm records the call stacks when locks are
278ab0df69eSJerome Forissier# taken, and prints them when a potential deadlock is found.
279ab0df69eSJerome Forissier# Expect a significant performance impact when enabling this.
280ab0df69eSJerome ForissierCFG_LOCKDEP ?= n
281ab0df69eSJerome Forissier
282bde8a250SJoakim Bech# BestFit algorithm in bget reduces the fragmentation of the heap when running
283ab0df69eSJerome Forissier# with the pager enabled or lockdep
284ab0df69eSJerome ForissierCFG_CORE_BGET_BESTFIT ?= $(call cfg-one-enabled, CFG_WITH_PAGER CFG_LOCKDEP)
285bde8a250SJoakim Bech
286a884c935SJens Wiklander# Use the pager for user TAs
287a884c935SJens WiklanderCFG_PAGED_USER_TA ?= $(CFG_WITH_PAGER)
288a884c935SJens Wiklander
289be715239SJens Wiklander# Enable support for detected undefined behavior in C
2901d171f95SJens Wiklander# Uses a lot of memory, can't be enabled by default
291be715239SJens WiklanderCFG_CORE_SANITIZE_UNDEFINED ?= n
292b908c675SJens Wiklander
2931d171f95SJens Wiklander# Enable Kernel Address sanitizer, has a huge performance impact, uses a
2941d171f95SJens Wiklander# lot of memory and need platform specific adaptations, can't be enabled by
2951d171f95SJens Wiklander# default
2961d171f95SJens WiklanderCFG_CORE_SANITIZE_KADDRESS ?= n
2971d171f95SJens Wiklander
298b908c675SJens Wiklander# Device Tree support
299c95b9511SEtienne Carriere#
300c95b9511SEtienne Carriere# When CFG_DT is enabled core embeds the FDT library (libfdt) allowing
301c95b9511SEtienne Carriere# device tree blob (DTB) parsing from the core.
302c95b9511SEtienne Carriere#
303c95b9511SEtienne Carriere# When CFG_DT is enabled, the TEE _start function expects to find
304c95b9511SEtienne Carriere# the address of a DTB in register X2/R2 provided by the early boot stage
305c95b9511SEtienne Carriere# or value 0 if boot stage provides no DTB.
306c95b9511SEtienne Carriere#
307c95b9511SEtienne Carriere# When CFG_EMBED_DTB is enabled, CFG_EMBED_DTB_SOURCE_FILE shall define the
308c95b9511SEtienne Carriere# relative path of a DTS file located in core/arch/$(ARCH)/dts.
309c95b9511SEtienne Carriere# The DTS file is compiled into a DTB file which content is embedded in a
310c95b9511SEtienne Carriere# read-only section of the core.
311c95b9511SEtienne Carriereifneq ($(strip $(CFG_EMBED_DTB_SOURCE_FILE)),)
312c95b9511SEtienne CarriereCFG_EMBED_DTB ?= y
313c95b9511SEtienne Carriereendif
314c95b9511SEtienne Carriereifeq ($(CFG_EMBED_DTB),y)
315c95b9511SEtienne Carriere$(call force,CFG_DT,y)
316c95b9511SEtienne Carriereendif
317c95b9511SEtienne CarriereCFG_EMBED_DTB ?= n
318b908c675SJens WiklanderCFG_DT ?= n
31976358becSJens Wiklander
32076358becSJens Wiklander# Maximum size of the Device Tree Blob, has to be large enough to allow
32176358becSJens Wiklander# editing of the supplied DTB.
32276358becSJens WiklanderCFG_DTB_MAX_SIZE ?= 0x10000
3234d62e91aSVictor Chong
3240a3ad9b6SBryan O'Donoghue# Device Tree Overlay support.
3250a3ad9b6SBryan O'Donoghue# This define enables support for an OP-TEE provided DTB overlay.
3260a3ad9b6SBryan O'Donoghue# One of two modes is supported in this case:
3270a3ad9b6SBryan O'Donoghue# 1. Append OP-TEE nodes to an existing DTB overlay located at CFG_DT_ADDR or
3280a3ad9b6SBryan O'Donoghue#    passed in arg2
3290a3ad9b6SBryan O'Donoghue# 2. Generate a new DTB overlay at CFG_DT_ADDR
3300a3ad9b6SBryan O'Donoghue# A subsequent boot stage must then merge the generated overlay DTB into a main
3310a3ad9b6SBryan O'Donoghue# DTB using the standard fdt_overlay_apply() method.
3320a3ad9b6SBryan O'DonoghueCFG_EXTERNAL_DTB_OVERLAY ?= n
3330a3ad9b6SBryan O'Donoghue
33435964dc9SEtienne Carriere# Enable core self tests and related pseudo TAs
3354d62e91aSVictor ChongCFG_TEE_CORE_EMBED_INTERNAL_TESTS ?= y
3366d96f208Syanyan-wrs
3376d96f208Syanyan-wrs# This option enables OP-TEE to respond to SMP boot request: the Rich OS
3386d96f208Syanyan-wrs# issues this to request OP-TEE to release secondaries cores out of reset,
3396d96f208Syanyan-wrs# with specific core number and non-secure entry address.
3406d96f208Syanyan-wrsCFG_BOOT_SECONDARY_REQUEST ?= n
3416d96f208Syanyan-wrs
342f5f914aaSJens Wiklander# Default heap size for Core, 64 kB
343f5f914aaSJens WiklanderCFG_CORE_HEAP_SIZE ?= 65536
344f3bb2312SJerome Forissier
345386fc264SVolodymyr Babchuk# Default size of nexus heap. 16 kB. Used only if CFG_VIRTUALIZATION
346386fc264SVolodymyr Babchuk# is enabled
347386fc264SVolodymyr BabchukCFG_CORE_NEX_HEAP_SIZE ?= 16384
348386fc264SVolodymyr Babchuk
349883c4be3SJerome Forissier# TA profiling.
350883c4be3SJerome Forissier# When this option is enabled, OP-TEE can execute Trusted Applications
351883c4be3SJerome Forissier# instrumented with GCC's -pg flag and will output profiling information
352883c4be3SJerome Forissier# in gmon.out format to /tmp/gmon-<ta_uuid>.out (path is defined in
353883c4be3SJerome Forissier# tee-supplicant)
354883c4be3SJerome ForissierCFG_TA_GPROF_SUPPORT ?= n
355f3bb2312SJerome Forissier
356883c4be3SJerome Forissier# Enable to compile user TA libraries with profiling (-pg).
357883c4be3SJerome Forissier# Depends on CFG_TA_GPROF_SUPPORT.
358883c4be3SJerome ForissierCFG_ULIBS_GPROF ?= n
359883c4be3SJerome Forissier
360883c4be3SJerome Forissierifeq ($(CFG_ULIBS_GPROF),y)
361f3bb2312SJerome Forissierifneq ($(CFG_TA_GPROF_SUPPORT),y)
362883c4be3SJerome Forissier$(error Cannot instrument user libraries if user mode profiling is disabled)
363f3bb2312SJerome Forissierendif
364f3bb2312SJerome Forissierendif
365cb0b5954SJens Wiklander
36664718c93SJerome Forissier# Build libutee, libutils, libmpa/libmbedtls as shared libraries.
36764718c93SJerome Forissier# - Static libraries are still generated when this is enabled, but TAs will use
36864718c93SJerome Forissier# the shared libraries unless explicitly linked with the -static flag.
36964718c93SJerome Forissier# - Shared libraries are made of two files: for example, libutee is
37064718c93SJerome Forissier#   libutee.so and 527f1a47-b92c-4a74-95bd-72f19f4a6f74.ta. The '.so' file
37164718c93SJerome Forissier#   is a totally standard shared object, and should be used to link against.
37264718c93SJerome Forissier#   The '.ta' file is a signed version of the '.so' and should be installed
37364718c93SJerome Forissier#   in the same way as TAs so that they can be found at runtime.
37464718c93SJerome ForissierCFG_ULIBS_SHARED ?= n
37564718c93SJerome Forissier
37670aa7511SJerome Forissierifeq (yy,$(CFG_TA_GPROF_SUPPORT)$(CFG_ULIBS_SHARED))
37770aa7511SJerome Forissier# FIXME:
37870aa7511SJerome Forissier# TA profiling with gprof does not work well with shared libraries (not limited
37970aa7511SJerome Forissier# to CFG_ULIBS_SHARED=y actually), because the total .text size is not known at
38070aa7511SJerome Forissier# link time. The symptom is an error trace when the TA starts (and no gprof
38170aa7511SJerome Forissier# output is produced):
38270aa7511SJerome Forissier#  E/TA: __utee_gprof_init:159 gprof: could not allocate profiling buffer
38370aa7511SJerome Forissier# The allocation of the profiling buffer should probably be done at runtime
38470aa7511SJerome Forissier# via a new syscall/PTA call instead of having it pre-allocated in .bss by the
38570aa7511SJerome Forissier# linker.
38670aa7511SJerome Forissier$(error CFG_TA_GPROF_SUPPORT and CFG_ULIBS_SHARED are currently incompatible)
38770aa7511SJerome Forissierendif
38870aa7511SJerome Forissier
389cb0b5954SJens Wiklander# CFG_GP_SOCKETS
390cb0b5954SJens Wiklander# Enable Global Platform Sockets support
391cb0b5954SJens WiklanderCFG_GP_SOCKETS ?= y
39280a4e51dSEtienne Carriere
39380a4e51dSEtienne Carriere# Enable Secure Data Path support in OP-TEE core (TA may be invoked with
39480a4e51dSEtienne Carriere# invocation parameters referring to specific secure memories).
39580a4e51dSEtienne CarriereCFG_SECURE_DATA_PATH ?= n
39600da26ecSAndrew F. Davis
397c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
398c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
399c9720143SJens Wiklander# metadata in secure storage.
400c9720143SJens WiklanderCFG_SECSTOR_TA ?= $(call cfg-all-enabled,CFG_REE_FS CFG_WITH_USER_TA)
401c9720143SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA,CFG_REE_FS CFG_WITH_USER_TA))
402c9720143SJens Wiklander
40330668b28SJens Wiklander# Enable the pseudo TA that managages TA storage in secure storage
40430668b28SJens WiklanderCFG_SECSTOR_TA_MGMT_PTA ?= $(call cfg-all-enabled,CFG_SECSTOR_TA)
40530668b28SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA_MGMT_PTA,CFG_SECSTOR_TA))
406c9720143SJens Wiklander
4074bca302aSIgor Opaniuk# Enable the pseudo TA for misc. auxilary services, extending existing
4084bca302aSIgor Opaniuk# GlobalPlatform Core API (for example, re-seeding RNG entropy pool etc.)
4094bca302aSIgor OpaniukCFG_SYSTEM_PTA ?= y
4104bca302aSIgor Opaniuk
4110b611081SSumit Garg# Enable the pseudo TA for enumeration of TEE based devices for the normal
4120b611081SSumit Garg# world OS.
4130b611081SSumit GargCFG_DEVICE_ENUM_PTA ?= y
4140b611081SSumit Garg
41500da26ecSAndrew F. Davis# Define the number of cores per cluster used in calculating core position.
41600da26ecSAndrew F. Davis# The cluster number is shifted by this value and added to the core ID,
41700da26ecSAndrew F. Davis# so its value represents log2(cores/cluster).
41800da26ecSAndrew F. Davis# Default is 2**(2) = 4 cores per cluster.
41900da26ecSAndrew F. DavisCFG_CORE_CLUSTER_SHIFT ?= 2
420d81f93a7SVolodymyr Babchuk
42137a6b717SJens Wiklander# Enable support for dynamic shared memory (shared memory anywhere in
42237a6b717SJens Wiklander# non-secure memory).
42337a6b717SJens WiklanderCFG_CORE_DYN_SHM ?= y
42437a6b717SJens Wiklander
4258aeb6c94SJens Wiklander# Enable support for reserved shared memory (shared memory in a carved out
4268aeb6c94SJens Wiklander# memory area).
4278aeb6c94SJens WiklanderCFG_CORE_RESERVED_SHM ?= y
4288aeb6c94SJens Wiklander
429dd3afbacSJens Wiklander# Enables support for larger physical addresses, that is, it will define
430dd3afbacSJens Wiklander# paddr_t as a 64-bit type.
431dd3afbacSJens WiklanderCFG_CORE_LARGE_PHYS_ADDR ?= n
432e3458e03SJerome Forissier
433e3458e03SJerome Forissier# Define the maximum size, in bits, for big numbers in the Internal Core API
434e3458e03SJerome Forissier# Arithmetical functions. This does *not* influence the key size that may be
435e3458e03SJerome Forissier# manipulated through the Cryptographic API.
436e3458e03SJerome Forissier# Set this to a lower value to reduce the TA memory footprint.
437e3458e03SJerome ForissierCFG_TA_BIGNUM_MAX_BITS ?= 2048
438409d2ff0SJerome Forissier
439409d2ff0SJerome Forissier# Define the maximum size, in bits, for big numbers in the TEE core (privileged
440409d2ff0SJerome Forissier# layer).
441409d2ff0SJerome Forissier# This value is an upper limit for the key size in any cryptographic algorithm
442409d2ff0SJerome Forissier# implemented by the TEE core.
443409d2ff0SJerome Forissier# Set this to a lower value to reduce the memory footprint.
444409d2ff0SJerome ForissierCFG_CORE_BIGNUM_MAX_BITS ?= 4096
445a97bc4a0SJens Wiklander
446a97bc4a0SJens Wiklander# Compiles mbedTLS for TA usage
447a97bc4a0SJens WiklanderCFG_TA_MBEDTLS ?= y
448a97bc4a0SJens Wiklander
449a97bc4a0SJens Wiklander# Compile the TA library mbedTLS with self test functions, the functions
450a97bc4a0SJens Wiklander# need to be called to test anything
451a97bc4a0SJens WiklanderCFG_TA_MBEDTLS_SELF_TEST ?= y
452017dfaf8SGabor Szekely
45368689d86SJens Wiklander# By default use tomcrypt as the main crypto lib providing an implementation
45468689d86SJens Wiklander# for the API in <crypto/crypto.h>
45568689d86SJens Wiklander# CFG_CRYPTOLIB_NAME is used as libname and
45668689d86SJens Wiklander# CFG_CRYPTOLIB_DIR is used as libdir when compiling the library
45777327d7aSEdison Ai#
45877327d7aSEdison Ai# It's also possible to configure to use mbedtls instead of tomcrypt.
45977327d7aSEdison Ai# Then the variables should be assigned as "CFG_CRYPTOLIB_NAME=mbedtls" and
46077327d7aSEdison Ai# "CFG_CRYPTOLIB_DIR=lib/libmbedtls" respectively.
46168689d86SJens WiklanderCFG_CRYPTOLIB_NAME ?= tomcrypt
46268689d86SJens WiklanderCFG_CRYPTOLIB_DIR ?= core/lib/libtomcrypt
46368689d86SJens Wiklander
464017dfaf8SGabor Szekely# Enable TEE_ALG_RSASSA_PKCS1_V1_5 algorithm for signing with PKCS#1 v1.5 EMSA
46568689d86SJens Wiklander# without ASN.1 around the hash.
46668689d86SJens Wiklanderifeq ($(CFG_CRYPTOLIB_NAME),tomcrypt)
467017dfaf8SGabor SzekelyCFG_CRYPTO_RSASSA_NA1 ?= y
468471ce4b6SJens WiklanderCFG_CORE_MBEDTLS_MPI ?= y
46968689d86SJens Wiklanderendif
47015216d4dSVolodymyr Babchuk
47115216d4dSVolodymyr Babchuk# Enable virtualization support. OP-TEE will not work without compatible
47215216d4dSVolodymyr Babchuk# hypervisor if this option is enabled.
47315216d4dSVolodymyr BabchukCFG_VIRTUALIZATION ?= n
47415216d4dSVolodymyr Babchuk
47515216d4dSVolodymyr Babchukifeq ($(CFG_VIRTUALIZATION),y)
47615216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RODATA_NOEXEC,y)
47715216d4dSVolodymyr Babchuk$(call force,CFG_CORE_RWDATA_NOEXEC,y)
478c4e8be26SVolodymyr Babchuk
479c4e8be26SVolodymyr Babchuk# Default number of virtual guests
480c4e8be26SVolodymyr BabchukCFG_VIRT_GUEST_COUNT ?= 2
48115216d4dSVolodymyr Babchukendif
48215216d4dSVolodymyr Babchuk
48317888736SJens Wiklander# Enables backwards compatible derivation of RPMB and SSK keys
48417888736SJens WiklanderCFG_CORE_HUK_SUBKEY_COMPAT ?= y
485