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)))))
16 ifeq ($(CONFIG_LP_ARCH_MOCK),)
17 VBOOT_CFLAGS += $(call vboot-fixup-includes,$(CFLAGS))
18 VBOOT_CFLAGS += -I$(abspath $(obj))
21 # Enable vboot debug by default
22 VBOOT_CFLAGS += -DVBOOT_DEBUG
24 VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM) := arm
25 VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_X86) := x86
26 VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64
28 ifeq ($(CONFIG_LP_ARCH_MOCK)$(VBOOT_FIRMWARE_ARCH-y),)
29 $(error vboot requires architecture to be set in the configuration)
32 $(VBOOT_FW_LIB): $(obj)/libpayload-config.h
33 @printf " MAKE $(subst $(obj)/,,$(@))\n"
34 +$(Q) FIRMWARE_ARCH="$(VBOOT_FIRMWARE_ARCH-y)" \
36 CFLAGS="$(VBOOT_CFLAGS)" \
37 $(MAKE) -C "$(VBOOT_SOURCE)" \
38 TPM2_MODE=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_TPM2_MODE)) \
39 X86_SHA_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_SHA_EXT)) \
41 BUILD="$(VBOOT_BUILD_DIR)" \
43 $(VBOOT_BUILD_DIR)/vboot_fw.a tlcl
45 $(TLCL_LIB): $(VBOOT_FW_LIB)
47 .PHONY: $(VBOOT_FW_LIB) $(TLCL_LIB)