coreboot-kgpe-d16/payloads/libpayload/vboot/Makefile.inc
Jakub Czapiga 395f5b3129 libpayload: Install vboot headers and add include paths to lpgcc
New CBFS API uses commonlib/bsd/cbfs_serialized.h, which includes
vboot's vb2_sha.h. And, because vboot's includes are not available
in libpayload's installation directory nor in lpgcc paths, it was
causing compilation errors. This patch fixes this issue.

lpgcc will look for `vboot` directory like it is doing for `include`
directory to create correct paths. However, if payload will be built
using libpayload's build dir as a base, then vboot headers from
3rdparty/vboot will be used, as there is no way to pass VBOOT_SOURCE
from makefile to lpgcc.

Moreover, this patch moves VBOOT_SOURCE to the main Makefile to
make it available for installation target, to install headers from
vboot directory provided by caller.

Change-Id: I68dd7e1545cfcaf24547d8a9fe289447c79da222
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Reported-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61032
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2022-01-15 00:22:41 +00:00

46 lines
1.4 KiB
Makefile

# SPDX-License-Identifier: BSD-3-Clause
VBOOT_BUILD_DIR ?= $(abspath $(obj)/external/vboot)
VBOOT_FW_LIB = $(VBOOT_BUILD_DIR)/vboot_fw.a
TLCL_LIB = $(VBOOT_BUILD_DIR)/tlcl.a
vboot_fw-objs += $(VBOOT_FW_LIB)
tlcl-objs += $(TLCL_LIB)
kconfig-to-binary=$(if $(1),1,0)
vboot-fixup-includes = $(patsubst -I%,-I$(top)/%,\
$(patsubst include/%.h,$(top)/include/%.h,\
$(filter-out -I$(obj),$(1))))
ifeq ($(CONFIG_LP_ARCH_MOCK),)
VBOOT_CFLAGS += $(call vboot-fixup-includes,$(CFLAGS))
VBOOT_CFLAGS += -I$(abspath $(obj))
endif
# Enable vboot debug by default
VBOOT_CFLAGS += -DVBOOT_DEBUG
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM) := arm
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_X86) := x86
VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64
ifeq ($(CONFIG_LP_ARCH_MOCK)$(VBOOT_FIRMWARE_ARCH-y),)
$(error vboot requires architecture to be set in the configuration)
endif
$(VBOOT_FW_LIB): $(obj)/libpayload-config.h
@printf " MAKE $(subst $(obj)/,,$(@))\n"
+$(Q) FIRMWARE_ARCH=$(VBOOT_FIRMWARE_ARCH-y) \
CC=$(CC) \
CFLAGS="$(VBOOT_CFLAGS)" \
$(MAKE) -C "$(VBOOT_SOURCE)" \
TPM2_MODE=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_TPM2_MODE)) \
X86_SHA_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_SHA_EXT)) \
UNROLL_LOOPS=1 \
BUILD=$(VBOOT_BUILD_DIR) \
V=$(V) \
$(VBOOT_BUILD_DIR)/vboot_fw.a tlcl
$(TLCL_LIB): $(VBOOT_FW_LIB)
.PHONY: $(VBOOT_FW_LIB) $(TLCL_LIB)