Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 1 | # SPDX-License-Identifier: BSD-3-Clause |
| 2 | |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 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 |
| 6 | |
| 7 | vboot_fw-objs += $(VBOOT_FW_LIB) |
| 8 | tlcl-objs += $(TLCL_LIB) |
| 9 | |
Jakub Czapiga | 7f663ab | 2022-02-17 18:08:09 +0100 | [diff] [blame] | 10 | kconfig-to-binary=$(if $(strip $(1)),1,0) |
Jakub Czapiga | 3068d56 | 2022-03-22 17:56:51 +0100 | [diff] [blame] | 11 | vboot-fixup-includes = $(filter -I$(coreboottop)/%, $(1)) \ |
| 12 | $(patsubst -I%,-I$(top)/%,\ |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 13 | $(patsubst include/%.h,$(top)/include/%.h,\ |
Jakub Czapiga | 3068d56 | 2022-03-22 17:56:51 +0100 | [diff] [blame] | 14 | $(filter-out -I$(obj),\ |
| 15 | $(filter-out -I$(coreboottop)/%,$(1))))) |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 16 | |
| 17 | VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM) := arm |
| 18 | VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_X86) := x86 |
| 19 | VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64 |
| 20 | |
Yu-Ping Wu | c6d25cf | 2024-01-10 15:27:11 +0800 | [diff] [blame] | 21 | ifneq ($(CONFIG_LP_ARCH_MOCK),) |
| 22 | VBOOT_FIRMWARE_ARCH-y := mock |
| 23 | else |
| 24 | VBOOT_CFLAGS += $(call vboot-fixup-includes,$(CFLAGS)) |
| 25 | VBOOT_CFLAGS += -I$(abspath $(obj)) |
| 26 | endif |
| 27 | |
| 28 | ifeq ($(VBOOT_FIRMWARE_ARCH-y),) |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 29 | $(error vboot requires architecture to be set in the configuration) |
| 30 | endif |
| 31 | |
Yu-Ping Wu | c6d25cf | 2024-01-10 15:27:11 +0800 | [diff] [blame] | 32 | # Enable vboot debug by default |
| 33 | VBOOT_CFLAGS += -DVBOOT_DEBUG |
| 34 | |
Jeremy Compostella | 3dcd0d9 | 2023-11-27 15:01:28 -0800 | [diff] [blame] | 35 | ifeq ($(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION),y) |
| 36 | CPPFLAGS_common += -DVB2_X86_RSA_ACCELERATION |
| 37 | endif |
| 38 | |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 39 | $(VBOOT_FW_LIB): $(obj)/libpayload-config.h |
| 40 | @printf " MAKE $(subst $(obj)/,,$(@))\n" |
Jakub Czapiga | b17f1ce | 2022-02-18 10:24:08 +0100 | [diff] [blame] | 41 | +$(Q) FIRMWARE_ARCH="$(VBOOT_FIRMWARE_ARCH-y)" \ |
| 42 | CC="$(CC)" \ |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 43 | CFLAGS="$(VBOOT_CFLAGS)" \ |
| 44 | $(MAKE) -C "$(VBOOT_SOURCE)" \ |
| 45 | TPM2_MODE=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_TPM2_MODE)) \ |
| 46 | X86_SHA_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_SHA_EXT)) \ |
Jeremy Compostella | 3dcd0d9 | 2023-11-27 15:01:28 -0800 | [diff] [blame] | 47 | VB2_X86_RSA_ACCELERATION=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION)) \ |
Yidi Lin | 7040921 | 2023-01-31 15:09:24 +0800 | [diff] [blame] | 48 | ARMV8_CRYPTO_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_SHA_ARMV8_CE)) \ |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 49 | UNROLL_LOOPS=1 \ |
Jakub Czapiga | b17f1ce | 2022-02-18 10:24:08 +0100 | [diff] [blame] | 50 | BUILD="$(VBOOT_BUILD_DIR)" \ |
Jakub Czapiga | 1fa3da4 | 2021-12-06 09:01:50 +0000 | [diff] [blame] | 51 | V=$(V) \ |
| 52 | $(VBOOT_BUILD_DIR)/vboot_fw.a tlcl |
| 53 | |
| 54 | $(TLCL_LIB): $(VBOOT_FW_LIB) |
| 55 | |
| 56 | .PHONY: $(VBOOT_FW_LIB) $(TLCL_LIB) |