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