xref: /optee_os/mk/config.mk (revision c97201431c503a720c786523201f7c1320868447)
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
35b0104773SPascal Brand# Define NOWERROR=1 so that warnings are not treated as errors
36b0104773SPascal Brand# NOWERROR=1
37b0104773SPascal Brand
383f17b838SEtienne Carriere# Define DEBUG=1 to compile without optimization (forces -O0)
39b0104773SPascal Brand# DEBUG=1
40b0104773SPascal Brand
414ec2358eSJerome Forissier# If y, enable debug features of the TEE core (assertions and lock checks
424ec2358eSJerome Forissier# are enabled, panic and assert messages are more verbose, data and prefetch
434ec2358eSJerome Forissier# aborts show a stack dump). When disabled, the NDEBUG directive is defined
444ec2358eSJerome Forissier# so assertions are disabled.
454ec2358eSJerome ForissierCFG_TEE_CORE_DEBUG ?= y
46b0104773SPascal Brand
47e0042c88SPascal Brand# Max level of the tee core traces. 0 means disable, 4 is max.
48e0042c88SPascal Brand# Supported values: 0 (no traces) to 4 (all traces)
49b0104773SPascal Brand# If CFG_TEE_DRV_DEBUGFS is set, the level of traces to print can be
50b0104773SPascal Brand# dynamically changes via debugfs in the range 1 => CFG_TEE_CORE_LOG_LEVEL
51e0042c88SPascal BrandCFG_TEE_CORE_LOG_LEVEL ?= 1
52b0104773SPascal Brand
53b0104773SPascal Brand# TA and TEECore log level
54e0042c88SPascal Brand# Supported values: 0 (no traces) to 4 (all traces)
55b0104773SPascal Brand# If CFG_TEE_DRV_DEBUGFS is set, the level of traces to print can be
56b0104773SPascal Brand# dynamically changes via debugfs in the range 1 => CFG_TEE_TA_LOG_LEVEL
57e0042c88SPascal BrandCFG_TEE_TA_LOG_LEVEL ?= 1
58b0104773SPascal Brand
597c876f12SPascal Brand# TA enablement
607c876f12SPascal Brand# When defined to "y", TA traces are output according to
617c876f12SPascal Brand# CFG_TEE_TA_LOG_LEVEL. Otherwise, they are not output at all
627c876f12SPascal BrandCFG_TEE_CORE_TA_TRACE ?= y
63b0104773SPascal Brand
64120c43adSJerome Forissier# If 1, enable debug features in TA memory allocation.
65120c43adSJerome Forissier# Debug features include check of buffer overflow, statistics, mark/check heap
66120c43adSJerome Forissier# feature.
67b0104773SPascal BrandCFG_TEE_CORE_USER_MEM_DEBUG ?= 1
687018ae01SSY Chiu
690fcbddd4SSY Chiu# If y, enable memory leak detection feature in bget memory allocator.
700fcbddd4SSY ChiuCFG_TEE_CORE_MALLOC_DEBUG ?= n
710fcbddd4SSY ChiuCFG_TEE_TA_MALLOC_DEBUG ?= n
720fcbddd4SSY Chiu
732bfab756SJerome Forissier# Mask to select which messages are prefixed with long debugging information
742bfab756SJerome Forissier# (severity, thread ID, component name, function name, line number) based on
752bfab756SJerome Forissier# the message level. If BIT(level) is set, the long prefix is shown.
762bfab756SJerome Forissier# Otherwise a short prefix is used (severity and component name only).
77f4aa5b11SJerome Forissier# Levels: 0=none 1=error 2=info 3=debug 4=flow
782bfab756SJerome ForissierCFG_MSG_LONG_PREFIX_MASK ?= 0x1a
79f4aa5b11SJerome Forissier
80120c43adSJerome Forissier# PRNG configuration
817018ae01SSY Chiu# If CFG_WITH_SOFTWARE_PRNG is enabled, crypto provider provided
827018ae01SSY Chiu# software PRNG implementation is used.
837018ae01SSY Chiu# Otherwise, you need to implement hw_get_random_byte() for your platform
847018ae01SSY ChiuCFG_WITH_SOFTWARE_PRNG ?= y
85120c43adSJerome Forissier
86120c43adSJerome Forissier# Number of threads
87120c43adSJerome ForissierCFG_NUM_THREADS ?= 2
88ab35d7adSCedric Chaumont
89ab35d7adSCedric Chaumont# API implementation version
90ab35d7adSCedric ChaumontCFG_TEE_API_VERSION ?= GPD-1.1-dev
91ab35d7adSCedric Chaumont
92ab35d7adSCedric Chaumont# Implementation description (implementation-dependent)
93ab35d7adSCedric ChaumontCFG_TEE_IMPL_DESCR ?= OPTEE
94ab35d7adSCedric Chaumont
9529cff5cfSJerome Forissier# Should OPTEE_SMC_CALL_GET_OS_REVISION return a build identifier to Normal
9629cff5cfSJerome Forissier# World?
9729cff5cfSJerome ForissierCFG_OS_REV_REPORTS_GIT_SHA1 ?= y
9829cff5cfSJerome Forissier
99ab35d7adSCedric Chaumont# Trusted OS implementation version
1004bf425c1SJens WiklanderTEE_IMPL_VERSION ?= $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
10129cff5cfSJerome Forissierifeq ($(CFG_OS_REV_REPORTS_GIT_SHA1),y)
10229cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo 0)
10329cff5cfSJerome Forissierelse
10429cff5cfSJerome ForissierTEE_IMPL_GIT_SHA1 := 0x0
10529cff5cfSJerome Forissierendif
10635c507f2SJerome Forissier# The following values are not extracted from the "git describe" output because
10735c507f2SJerome Forissier# we might be outside of a Git environment, or the tree may have been cloned
10835c507f2SJerome Forissier# with limited depth not including any tag, so there is really no guarantee
10935c507f2SJerome Forissier# that TEE_IMPL_VERSION contains the major and minor revision numbers.
110a0cd5d60SPascal BrandCFG_OPTEE_REVISION_MAJOR ?= 2
111a3bb2887SJerome ForissierCFG_OPTEE_REVISION_MINOR ?= 6
112ab35d7adSCedric Chaumont
113ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
114ab35d7adSCedric ChaumontCFG_TEE_MANUFACTURER ?= LINARO
115ab35d7adSCedric Chaumont
116ab35d7adSCedric Chaumont# Trusted firmware version
117ab35d7adSCedric ChaumontCFG_TEE_FW_IMPL_VERSION ?= FW_IMPL_UNDEF
118ab35d7adSCedric Chaumont
119ab35d7adSCedric Chaumont# Trusted OS implementation manufacturer name
120ab35d7adSCedric ChaumontCFG_TEE_FW_MANUFACTURER ?= FW_MAN_UNDEF
121ab35d7adSCedric Chaumont
122b44708c1SJerome Forissier# Rich Execution Environment (REE) file system support: normal world OS
123b44708c1SJerome Forissier# provides the actual storage.
124b44708c1SJerome Forissier# This is the default FS when enabled (i.e., the one used when
125b44708c1SJerome Forissier# TEE_STORAGE_PRIVATE is passed to the trusted storage API)
126b44708c1SJerome ForissierCFG_REE_FS ?= y
127bc420748SJens Wiklander
12888e6e089SJerome Forissier# RPMB file system support
12988e6e089SJerome ForissierCFG_RPMB_FS ?= n
13088e6e089SJerome Forissier
13188e6e089SJerome Forissier# Device identifier used when CFG_RPMB_FS = y.
13288e6e089SJerome Forissier# The exact meaning of this value is platform-dependent. On Linux, the
13388e6e089SJerome Forissier# tee-supplicant process will open /dev/mmcblk<id>rpmb
13488e6e089SJerome ForissierCFG_RPMB_FS_DEV_ID ?= 0
13588e6e089SJerome Forissier
136ed1993b7SJerome Forissier# Enables RPMB key programming by the TEE, in case the RPMB partition has not
137ed1993b7SJerome Forissier# been configured yet.
138ed1993b7SJerome Forissier# !!! Security warning !!!
139ed1993b7SJerome Forissier# Do *NOT* enable this in product builds, as doing so would allow the TEE to
140ed1993b7SJerome Forissier# leak the RPMB key.
141ed1993b7SJerome Forissier# This option is useful in the following situations:
142ed1993b7SJerome Forissier# - Testing
143ed1993b7SJerome Forissier# - RPMB key provisioning in a controlled environment (factory setup)
144ed1993b7SJerome ForissierCFG_RPMB_WRITE_KEY ?= n
145ed1993b7SJerome Forissier
146bc420748SJens Wiklander# Embed public part of this key in OP-TEE OS
147bc420748SJens WiklanderTA_SIGN_KEY ?= keys/default_ta.pem
148c4553de7SJerome Forissier
149c4553de7SJerome Forissier# Include lib/libutils/isoc in the build? Most platforms need this, but some
150c4553de7SJerome Forissier# may not because they obtain the isoc functions from elsewhere
151c4553de7SJerome ForissierCFG_LIBUTILS_WITH_ISOC ?= y
152fce4cfa1SJens Wiklander
1530de9a5fbSJens Wiklander# Enables floating point support for user TAs
1540de9a5fbSJens Wiklander# ARM32: EABI defines both a soft-float ABI and a hard-float ABI,
1550de9a5fbSJens Wiklander#	 hard-float is basically a super set of soft-float. Hard-float
1560de9a5fbSJens Wiklander#	 requires all the support routines provided for soft-float, but the
1570de9a5fbSJens Wiklander#	 compiler may choose to optimize to not use some of them and use
1580de9a5fbSJens Wiklander#	 the floating-point registers instead.
1590de9a5fbSJens Wiklander# ARM64: EABI doesn't define a soft-float ABI, everything is hard-float (or
1600de9a5fbSJens Wiklander#	 nothing with ` -mgeneral-regs-only`)
1610de9a5fbSJens Wiklander# With CFG_TA_FLOAT_SUPPORT enabled TA code is free use floating point types
1620de9a5fbSJens WiklanderCFG_TA_FLOAT_SUPPORT ?= y
163923c1f34SJens Wiklander
1647411e0e1SJerome Forissier# Stack unwinding: print a stack dump to the console on core or TA abort, or
1657411e0e1SJerome Forissier# when a TA panics.
16631a29642SJerome Forissier# If CFG_UNWIND is enabled, both the kernel and user mode call stacks can be
16731a29642SJerome Forissier# unwound (not paged TAs, however).
16831a29642SJerome Forissier# Note that 32-bit ARM code needs unwind tables for this to work, so enabling
16931a29642SJerome Forissier# this option will increase the size of the 32-bit TEE binary by a few KB.
17031a29642SJerome Forissier# Similarly, TAs have to be compiled with -funwind-tables (default when the
17131a29642SJerome Forissier# option is set) otherwise they can't be unwound.
1727411e0e1SJerome Forissier# Warning: since the unwind sequence for user-mode (TA) code is implemented in
1737411e0e1SJerome Forissier# the privileged layer of OP-TEE, enabling this feature will weaken the
1747411e0e1SJerome Forissier# user/kernel isolation. Therefore it should be disabled in release builds.
1753f17b838SEtienne Carriereifeq ($(CFG_TEE_CORE_DEBUG),y)
17631a29642SJerome ForissierCFG_UNWIND ?= y
177923c1f34SJens Wiklanderendif
1786fbac37eSJens Wiklander
1796fbac37eSJens Wiklander# Enable support for dynamically loaded user TAs
1806fbac37eSJens WiklanderCFG_WITH_USER_TA ?= y
1812a142248SJens Wiklander
182ee664c19SJerome Forissier# Load user TAs from the REE filesystem via tee-supplicant
183ee664c19SJerome Forissier# There is currently no other alternative, but you may want to disable this in
184ee664c19SJerome Forissier# case you implement your own TA store
185ee664c19SJerome ForissierCFG_REE_FS_TA ?= y
186ee664c19SJerome Forissier
187d0c63614SJerome Forissier# Support for loading user TAs from a special section in the TEE binary.
188d0c63614SJerome Forissier# Such TAs are available even before tee-supplicant is available (hence their
189d0c63614SJerome Forissier# name), but note that many services exported to TAs may need tee-supplicant,
190d0c63614SJerome Forissier# so early use is limited to a subset of the TEE Internal Core API (crypto...)
191d0c63614SJerome Forissier# To use this feature, set EARLY_TA_PATHS to the paths to one or more TA ELF
192d0c63614SJerome Forissier# file(s). For example:
193d0c63614SJerome Forissier#   $ make ... \
194d0c63614SJerome Forissier#     EARLY_TA_PATHS="path/to/8aaaf200-2450-11e4-abe2-0002a5d5c51b.stripped.elf \
195d0c63614SJerome Forissier#                     path/to/cb3e5ba0-adf1-11e0-998b-0002a5d5c51b.stripped.elf"
196d0c63614SJerome Forissier# Typical build steps:
197d0c63614SJerome Forissier#   $ make ta_dev_kit CFG_EARLY_TA=y # Create the dev kit (user mode libraries,
198d0c63614SJerome Forissier#                                    # headers, makefiles), ready to build TAs.
199d0c63614SJerome Forissier#                                    # CFG_EARLY_TA=y is optional, it prevents
200d0c63614SJerome Forissier#                                    # later library recompilations.
201d0c63614SJerome Forissier#   <build some TAs>
202d0c63614SJerome Forissier#   $ make EARLY_TA_PATHS=<paths>    # Build OP-TEE and embbed the TA(s)
203d0c63614SJerome Forissierifneq ($(EARLY_TA_PATHS),)
204d0c63614SJerome Forissier$(call force,CFG_EARLY_TA,y)
205d0c63614SJerome Forissierelse
206d0c63614SJerome ForissierCFG_EARLY_TA ?= n
207d0c63614SJerome Forissierendif
208509a9802SJerome Forissierifeq ($(CFG_EARLY_TA),y)
209509a9802SJerome Forissier$(call force,CFG_ZLIB,y)
210509a9802SJerome Forissierendif
211d0c63614SJerome Forissier
212a884c935SJens Wiklander# Enable paging, requires SRAM, can't be enabled by default
213a884c935SJens WiklanderCFG_WITH_PAGER ?= n
214a884c935SJens Wiklander
215a884c935SJens Wiklander# Use the pager for user TAs
216a884c935SJens WiklanderCFG_PAGED_USER_TA ?= $(CFG_WITH_PAGER)
217a884c935SJens Wiklander
218be715239SJens Wiklander# Enable support for detected undefined behavior in C
2191d171f95SJens Wiklander# Uses a lot of memory, can't be enabled by default
220be715239SJens WiklanderCFG_CORE_SANITIZE_UNDEFINED ?= n
221b908c675SJens Wiklander
2221d171f95SJens Wiklander# Enable Kernel Address sanitizer, has a huge performance impact, uses a
2231d171f95SJens Wiklander# lot of memory and need platform specific adaptations, can't be enabled by
2241d171f95SJens Wiklander# default
2251d171f95SJens WiklanderCFG_CORE_SANITIZE_KADDRESS ?= n
2261d171f95SJens Wiklander
227b908c675SJens Wiklander# Device Tree support
228b908c675SJens Wiklander# When enabled, the TEE _start function expects to find the address of a
229b908c675SJens Wiklander# Device Tree Blob (DTB) in register r2. The DT parsing code relies on
230b908c675SJens Wiklander# libfdt.  Currently only used to add the optee node and a reserved-memory
231b908c675SJens Wiklander# node for shared memory.
232b908c675SJens WiklanderCFG_DT ?= n
23376358becSJens Wiklander
23476358becSJens Wiklander# Maximum size of the Device Tree Blob, has to be large enough to allow
23576358becSJens Wiklander# editing of the supplied DTB.
23676358becSJens WiklanderCFG_DTB_MAX_SIZE ?= 0x10000
2374d62e91aSVictor Chong
2384d62e91aSVictor Chong# Enable static TA and core self tests
2394d62e91aSVictor ChongCFG_TEE_CORE_EMBED_INTERNAL_TESTS ?= y
2406d96f208Syanyan-wrs
2416d96f208Syanyan-wrs# This option enables OP-TEE to respond to SMP boot request: the Rich OS
2426d96f208Syanyan-wrs# issues this to request OP-TEE to release secondaries cores out of reset,
2436d96f208Syanyan-wrs# with specific core number and non-secure entry address.
2446d96f208Syanyan-wrsCFG_BOOT_SECONDARY_REQUEST ?= n
2456d96f208Syanyan-wrs
246f5f914aaSJens Wiklander# Default heap size for Core, 64 kB
247f5f914aaSJens WiklanderCFG_CORE_HEAP_SIZE ?= 65536
248f3bb2312SJerome Forissier
249883c4be3SJerome Forissier# TA profiling.
250883c4be3SJerome Forissier# When this option is enabled, OP-TEE can execute Trusted Applications
251883c4be3SJerome Forissier# instrumented with GCC's -pg flag and will output profiling information
252883c4be3SJerome Forissier# in gmon.out format to /tmp/gmon-<ta_uuid>.out (path is defined in
253883c4be3SJerome Forissier# tee-supplicant)
254883c4be3SJerome ForissierCFG_TA_GPROF_SUPPORT ?= n
255f3bb2312SJerome Forissier
256883c4be3SJerome Forissier# Enable to compile user TA libraries with profiling (-pg).
257883c4be3SJerome Forissier# Depends on CFG_TA_GPROF_SUPPORT.
258883c4be3SJerome ForissierCFG_ULIBS_GPROF ?= n
259883c4be3SJerome Forissier
260883c4be3SJerome Forissierifeq ($(CFG_ULIBS_GPROF),y)
261f3bb2312SJerome Forissierifneq ($(CFG_TA_GPROF_SUPPORT),y)
262883c4be3SJerome Forissier$(error Cannot instrument user libraries if user mode profiling is disabled)
263f3bb2312SJerome Forissierendif
264f3bb2312SJerome Forissierendif
265cb0b5954SJens Wiklander
266cb0b5954SJens Wiklander# CFG_GP_SOCKETS
267cb0b5954SJens Wiklander# Enable Global Platform Sockets support
268cb0b5954SJens WiklanderCFG_GP_SOCKETS ?= y
26980a4e51dSEtienne Carriere
27080a4e51dSEtienne Carriere# Enable Secure Data Path support in OP-TEE core (TA may be invoked with
27180a4e51dSEtienne Carriere# invocation parameters referring to specific secure memories).
27280a4e51dSEtienne CarriereCFG_SECURE_DATA_PATH ?= n
27300da26ecSAndrew F. Davis
274*c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
275*c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
276*c9720143SJens Wiklander# metadata in secure storage.
277*c9720143SJens WiklanderCFG_SECSTOR_TA ?= $(call cfg-all-enabled,CFG_REE_FS CFG_WITH_USER_TA)
278*c9720143SJens Wiklander$(eval $(call cfg-depends-all,CFG_SECSTOR_TA,CFG_REE_FS CFG_WITH_USER_TA))
279*c9720143SJens Wiklander
280*c9720143SJens Wiklander# Enable storage for TAs in secure storage, depends on CFG_REE_FS=y
281*c9720143SJens Wiklander# TA binaries are stored encrypted in the REE FS and are protected by
282*c9720143SJens Wiklander# metadata in secure storage.
283*c9720143SJens WiklanderCFG_SECSTOR_TA ?= y
284*c9720143SJens Wiklander
28500da26ecSAndrew F. Davis# Define the number of cores per cluster used in calculating core position.
28600da26ecSAndrew F. Davis# The cluster number is shifted by this value and added to the core ID,
28700da26ecSAndrew F. Davis# so its value represents log2(cores/cluster).
28800da26ecSAndrew F. Davis# Default is 2**(2) = 4 cores per cluster.
28900da26ecSAndrew F. DavisCFG_CORE_CLUSTER_SHIFT ?= 2
290d81f93a7SVolodymyr Babchuk
291d81f93a7SVolodymyr Babchuk# Do not report to NW that dynamic shared memory (shared memory outside
292d81f93a7SVolodymyr Babchuk# predefined region) is enabled.
293d81f93a7SVolodymyr Babchuk# Note that you can disable this feature for debug purposes. OP-TEE will not
294d81f93a7SVolodymyr Babchuk# report to Normal World that it support dynamic SHM. But, nevertheles it
295d81f93a7SVolodymyr Babchuk# will accept dynamic SHM buffers.
296d81f93a7SVolodymyr BabchukCFG_DYN_SHM_CAP ?= y
297dd3afbacSJens Wiklander
298dd3afbacSJens Wiklander# Enables support for larger physical addresses, that is, it will define
299dd3afbacSJens Wiklander# paddr_t as a 64-bit type.
300dd3afbacSJens WiklanderCFG_CORE_LARGE_PHYS_ADDR ?= n
301