xref: /optee_os/core/sub.mk (revision c84eee6397bb8ae0745d9aa24b5228a58793378b)
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)
23define process_early_ta
24early-ta-$1-uuid := $(firstword $(subst ., ,$(notdir $1)))
25gensrcs-y += early-ta-$1
26produce-early-ta-$1 = early_ta_$$(early-ta-$1-uuid).c
27depends-early-ta-$1 = $1 scripts/ts_bin_to_c.py
28recipe-early-ta-$1 = $(PYTHON3) scripts/ts_bin_to_c.py --compress --ta $1 \
29		--out $(sub-dir-out)/early_ta_$$(early-ta-$1-uuid).c
30endef
31$(foreach f, $(EARLY_TA_PATHS), $(eval $(call process_early_ta,$(f))))
32$(foreach f, $(CFG_IN_TREE_EARLY_TAS), $(eval $(call \
33	process_early_ta,$(out-dir)/ta/$(f).stripped.elf)))
34endif
35
36define process_secure_partition
37sp-$1-uuid := $(firstword $(subst ., ,$(notdir $1)))
38gensrcs-y += sp-$1
39produce-sp-$1 = sp_$$(sp-$1-uuid).c
40depends-sp-$1 = $1 scripts/ts_bin_to_c.py
41recipe-sp-$1 = $(PYTHON3) scripts/ts_bin_to_c.py --compress --sp $1 \
42		--out $(sub-dir-out)/sp_$$(sp-$1-uuid).c
43endef
44$(foreach f, $(SP_PATHS), $(eval $(call process_secure_partition,$(f))))
45
46ifeq ($(CFG_EMBED_DTB),y)
47core-embed-fdt-dts = $(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE)
48core-embed-fdt-dtb = $(out-dir)/$(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.dtb)
49core-embed-fdt-c = $(out-dir)/$(arch-dir)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.c)
50gensrcs-y += embedded_secure_dtb
51produce-embedded_secure_dtb = arch/$(ARCH)/dts/$(CFG_EMBED_DTB_SOURCE_FILE:.dts=.c)
52depends-embedded_secure_dtb = $(core-embed-fdt-dtb) scripts/bin_to_c.py
53recipe-embedded_secure_dtb = $(PYTHON3) scripts/bin_to_c.py \
54				--bin $(core-embed-fdt-dtb) \
55				--vname embedded_secure_dtb \
56				--out $(core-embed-fdt-c)
57$(eval $(call gen-dtb-file,$(core-embed-fdt-dts),$(core-embed-fdt-dtb)))
58endif
59
60ifeq ($(CFG_SHOW_CONF_ON_BOOT),y)
61conf-mk-xz-base64 := $(sub-dir-out)/conf.mk.xz.base64
62cleanfiles += $(conf-mk-xz-base64)
63
64$(conf-mk-xz-base64): $(conf-mk-file)
65	@$(cmd-echo-silent) '  GEN     $@'
66	$(q)tail +3 $< | xz | base64 -w 100 >$@
67
68gensrcs-y += conf_str
69produce-conf_str = conf.mk.xz.base64.c
70depends-conf_str = $(conf-mk-xz-base64)
71recipe-conf_str = $(PYTHON3) scripts/bin_to_c.py --text --bin $(conf-mk-xz-base64) \
72			--out $(sub-dir-out)/conf.mk.xz.base64.c \
73			--vname conf_str
74endif
75
76ifneq ($(CFG_STMM_PATH),)
77gensrcs-y += stmm
78produce-stmm = stmm_hex.c
79depends-stmm = scripts/gen_stmm_hex.py $(CFG_STMM_PATH)
80recipe-stmm = scripts/gen_stmm_hex.py --input $(CFG_STMM_PATH) \
81			--output $(sub-dir-out)/stmm_hex.c
82cleanfiles += $(sub-dir-out)/stmm_hex.c
83endif
84