1#
2# Copyright 2021 NXP
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#
7
8CSF_HDR_SOURCES	:=  $(PLAT_DRIVERS_PATH)/auth/csf_hdr_parser/csf_hdr_parser.c
9
10CSF_HDR_SOURCES	+=  $(PLAT_DRIVERS_PATH)/auth/csf_hdr_parser/plat_img_parser.c
11
12PLAT_INCLUDES	+= -I$(PLAT_DRIVERS_INCLUDE_PATH)/auth/csf_hdr_parser/
13
14$(eval $(call add_define, CSF_HEADER_PREPENDED))
15
16
17# Path to CST directory is required to generate the CSF header
18# and prepend it to image before fip image gets generated
19ifeq (${CST_DIR},)
20  $(error Error: CST_DIR not set)
21endif
22
23# Rules are created for generating and appending CSF header to images before
24# FIT image generation
25
26# CST_BL31
27define CST_BL31_RULE
28$(1): $(2)
29	@echo " Generating CSF Header for $$@ $$<"
30	$(Q)$(CST_DIR)/create_hdr_esbc --in $(2) --out $(1) --app_off ${CSF_HDR_SZ} \
31					--app $(2) ${BL31_INPUT_FILE}
32endef
33
34CST_BL31_SUFFIX := .cst
35
36# CST_BL32
37define CST_BL32_RULE
38$(1): $(2)
39	@echo " Generating CSF Header for $$@ $$<"
40	$(Q)$(CST_DIR)/create_hdr_esbc --in $(2) --out $(1) --app_off ${CSF_HDR_SZ} \
41					--app $(2) ${BL32_INPUT_FILE}
42endef
43
44CST_BL32_SUFFIX := .cst
45
46# CST_BL33
47define CST_BL33_RULE
48$(1): $(2)
49	@echo " Generating CSF Header for $$@ $$<"
50	$(Q)$(CST_DIR)/create_hdr_esbc --in $(2) --out $(1) --app_off ${CSF_HDR_SZ} \
51					--app $(2) ${BL33_INPUT_FILE}
52endef
53
54CST_BL33_SUFFIX := .cst
55
56# CST_SCP_BL2
57define CST_SCP_BL2_RULE
58$(1): $(2)
59	@echo " Generating CSF Header for $$@ $$<"
60	$(Q)$(CST_DIR)/create_hdr_esbc --in $(2) --out $(1) --app_off ${CSF_HDR_SZ} \
61					--app $(2) ${FUSE_INPUT_FILE}
62endef
63
64CST_SCP_BL2_SUFFIX := .cst
65