1 # SPDX-License-Identifier: BSD-3-Clause
3 VBOOT_BUILD_DIR ?
= $(abspath
$(obj
)/external
/vboot
)
4 VBOOT_FW_LIB
= $(VBOOT_BUILD_DIR
)/vboot_fw.a
5 TLCL_LIB
= $(VBOOT_BUILD_DIR
)/tlcl.a
7 vboot_fw-objs
+= $(VBOOT_FW_LIB
)
8 tlcl-objs
+= $(TLCL_LIB
)
10 kconfig-to-binary
=$(if
$(strip $(1)),1,0)
11 vboot-fixup-includes
= $(filter -I
$(coreboottop
)/%, $(1)) \
12 $(patsubst -I
%,-I
$(top
)/%,\
13 $(patsubst include/%.h
,$(top
)/include/%.h
,\
14 $(filter-out -I
$(obj
),\
15 $(filter-out -I
$(coreboottop
)/%,$(1)))))
17 VBOOT_FIRMWARE_ARCH-
$(CONFIG_LP_ARCH_ARM
) := arm
18 VBOOT_FIRMWARE_ARCH-
$(CONFIG_LP_ARCH_X86_32
) := x86
19 VBOOT_FIRMWARE_ARCH-
$(CONFIG_LP_ARCH_X86_64
) := x86_64
20 VBOOT_FIRMWARE_ARCH-
$(CONFIG_LP_ARCH_ARM64
) := arm64
22 ifneq ($(CONFIG_LP_ARCH_MOCK
),)
23 VBOOT_FIRMWARE_ARCH-y
:= mock
25 VBOOT_CFLAGS
+= $(call vboot-fixup-includes
,$(CFLAGS
))
26 VBOOT_CFLAGS
+= -I
$(abspath
$(obj
))
29 ifeq ($(VBOOT_FIRMWARE_ARCH-y
),)
30 $(error vboot requires architecture to be set in the configuration
)
33 # Enable vboot debug by default
34 VBOOT_CFLAGS
+= -DVBOOT_DEBUG
36 ifeq ($(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION
),y
)
37 CPPFLAGS_common
+= -DVB2_X86_RSA_ACCELERATION
40 $(VBOOT_FW_LIB
): $(obj
)/libpayload-config.h
41 @printf
" MAKE $(subst $(obj)/,,$(@))\n"
42 +$(Q
) FIRMWARE_ARCH
="$(VBOOT_FIRMWARE_ARCH-y)" \
44 CFLAGS
="$(VBOOT_CFLAGS)" \
45 $(MAKE
) -C
"$(VBOOT_SOURCE)" \
46 TPM2_MODE
=$(call kconfig-to-binary
, $(CONFIG_LP_VBOOT_TPM2_MODE
)) \
47 X86_SHA_EXT
=$(call kconfig-to-binary
, $(CONFIG_LP_VBOOT_X86_SHA_EXT
)) \
48 VB2_X86_RSA_ACCELERATION
=$(call kconfig-to-binary
, $(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION
)) \
49 ARMV8_CRYPTO_EXT
=$(call kconfig-to-binary
, $(CONFIG_LP_VBOOT_SHA_ARMV8_CE
)) \
50 ARM64_RSA_ACCELERATION
=$(call kconfig-to-binary
, $(CONFIG_LP_VBOOT_ARM64_RSA_ACCELERATION
)) \
52 BUILD
="$(VBOOT_BUILD_DIR)" \
54 $(VBOOT_BUILD_DIR
)/vboot_fw.a tlcl
56 $(TLCL_LIB
): $(VBOOT_FW_LIB
)
58 .PHONY
: $(VBOOT_FW_LIB
) $(TLCL_LIB
)