1subdirs-y += crypto
2subdirs-y += drivers
3subdirs-y += kernel
4subdirs-y += mm
5subdirs-y += pta
6subdirs-y += tee
7subdirs-$(CFG_TEE_CORE_EMBED_INTERNAL_TESTS) += tests
8
9ifeq ($(CFG_WITH_USER_TA),y)
10gensrcs-y += ta_pub_key
11produce-ta_pub_key = ta_pub_key.c
12depends-ta_pub_key = $(TA_PUBLIC_KEY) scripts/pem_to_pub_c.py
13recipe-ta_pub_key = $(PYTHON3) scripts/pem_to_pub_c.py --prefix ta_pub_key \
14		--key $(TA_PUBLIC_KEY) --out $(sub-dir-out)/ta_pub_key.c
15
16gensrcs-y += ldelf
17produce-ldelf = ldelf_hex.c
18depends-ldelf = scripts/gen_ldelf_hex.py $(out-dir)/ldelf/ldelf.elf
19recipe-ldelf = $(PYTHON3) scripts/gen_ldelf_hex.py --input $(out-dir)/ldelf/ldelf.elf \
20			--output $(sub-dir-out)/ldelf_hex.c
21endif
22
23ifeq ($(CFG_WITH_USER_TA)-$(CFG_EARLY_TA),y-y)
24ifeq ($(CFG_EARLY_TA_COMPRESS),y)
25early-ta-compress = --compress
26endif
27define process_early_ta
28early-ta-$1-uuid := $(firstword $(subst ., ,$(notdir $1)))
29gensrcs-y += early-ta-$1
30produce-early-ta-$1 = early_ta_$$(early-ta-$1-uuid).c
31depends-early-ta-$1 = $1 scripts/ts_bin_to_c.py
32recipe-early-ta-$1 = $(PYTHON3) scripts/ts_bin_to_c.py $(early-ta-compress) \
33		--ta $1 --out $(sub-dir-out)/early_ta_$$(early-ta-$1-uuid).c
34endef
35$(foreach f, $(EARLY_TA_PATHS), $(eval $(call process_early_ta,$(f))))
36$(foreach f, $(CFG_IN_TREE_EARLY_TAS), $(eval $(call \
37	process_early_ta,$(out-dir)/ta/$(f).stripped.elf)))
38endif
39
40define process_secure_partition
41sp-$1-uuid := $(firstword $(subst ., ,$(notdir $1)))
42gensrcs-y += sp-$1
43produce-sp-$1 = sp_$$(sp-$1-uuid).c
44depends-sp-$1 = $1 scripts/ts_bin_to_c.py
45dtb-$1-path = $(dir $1)
46dtb-$1 = $$(dtb-$1-path)../manifest/$$(sp-$1-uuid).dtb
47recipe-sp-$1 = $(PYTHON3) scripts/ts_bin_to_c.py --compress --sp $1 \
48		--out $(sub-dir-out)/sp_$$(sp-$1-uuid).c \
49		--manifest $$(dtb-$1)
50endef
51$(foreach f, $(SP_PATHS), $(eval $(call process_secure_partition,$(f))))
52
53ifeq ($(CFG_EMBED_DTB),y)
54core-embed-fdt-dts = $(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE)
55core-embed-fdt-dtb = $(out-dir)/$(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.dtb)
56core-embed-fdt-c = $(out-dir)/$(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.c)
57gensrcs-y += embedded_secure_dtb
58produce-embedded_secure_dtb = arch/$(ARCH)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.c)
59depends-embedded_secure_dtb = $(core-embed-fdt-dtb) scripts/bin_to_c.py
60recipe-embedded_secure_dtb = $(PYTHON3) scripts/bin_to_c.py \
61				--bin $(core-embed-fdt-dtb) \
62				--vname embedded_secure_dtb \
63				--out $(core-embed-fdt-c)
64$(eval $(call gen-dtb-file,$(core-embed-fdt-dts),$(core-embed-fdt-dtb)))
65endif
66
67ifeq ($(CFG_SHOW_CONF_ON_BOOT),y)
68conf-mk-xz-base64 := $(sub-dir-out)/conf.mk.xz.base64
69cleanfiles += $(conf-mk-xz-base64)
70
71$(conf-mk-xz-base64): $(conf-mk-file)
72	@$(cmd-echo-silent) '  GEN     $@'
73	$(q)tail +3 $< | xz | base64 -w 100 >$@
74
75gensrcs-y += conf_str
76produce-conf_str = conf.mk.xz.base64.c
77depends-conf_str = $(conf-mk-xz-base64)
78recipe-conf_str = $(PYTHON3) scripts/bin_to_c.py --text --bin $(conf-mk-xz-base64) \
79			--out $(sub-dir-out)/conf.mk.xz.base64.c \
80			--vname conf_str
81endif
82
83ifneq ($(CFG_STMM_PATH),)
84gensrcs-y += stmm
85produce-stmm = stmm_hex.c
86depends-stmm = scripts/gen_stmm_hex.py $(CFG_STMM_PATH)
87recipe-stmm = scripts/gen_stmm_hex.py --input $(CFG_STMM_PATH) \
88			--output $(sub-dir-out)/stmm_hex.c
89cleanfiles += $(sub-dir-out)/stmm_hex.c
90endif
91