summaryrefslogtreecommitdiffstats
path: root/payloads/libpayload/vboot/Makefile.mk
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2024-01-18 16:33:55 -0700
committerFelix Singer <service+coreboot-gerrit@felixsinger.de>2024-01-24 10:15:10 +0000
commit354389365bac2c972749b9fc4fd21c6cd953cb59 (patch)
treeced96887bdc48548c77ada79b4e89ba8d0fb65b3 /payloads/libpayload/vboot/Makefile.mk
parentfd96da95c4a36ffae8118400aa8cdab0d50b5060 (diff)
downloadcoreboot-354389365bac2c972749b9fc4fd21c6cd953cb59.tar.gz
coreboot-354389365bac2c972749b9fc4fd21c6cd953cb59.tar.bz2
coreboot-354389365bac2c972749b9fc4fd21c6cd953cb59.zip
payloads: Rename Makefiles from .inc to .mk
The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: Ie7038712de8cc646632d5e7d29550e3260bf2c62 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80103 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'payloads/libpayload/vboot/Makefile.mk')
-rw-r--r--payloads/libpayload/vboot/Makefile.mk56
1 files changed, 56 insertions, 0 deletions
diff --git a/payloads/libpayload/vboot/Makefile.mk b/payloads/libpayload/vboot/Makefile.mk
new file mode 100644
index 000000000000..bdc9ad2ad67a
--- /dev/null
+++ b/payloads/libpayload/vboot/Makefile.mk
@@ -0,0 +1,56 @@
+# 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 $(strip $(1)),1,0)
+vboot-fixup-includes = $(filter -I$(coreboottop)/%, $(1)) \
+ $(patsubst -I%,-I$(top)/%,\
+ $(patsubst include/%.h,$(top)/include/%.h,\
+ $(filter-out -I$(obj),\
+ $(filter-out -I$(coreboottop)/%,$(1)))))
+
+VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM) := arm
+VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_X86) := x86
+VBOOT_FIRMWARE_ARCH-$(CONFIG_LP_ARCH_ARM64) := arm64
+
+ifneq ($(CONFIG_LP_ARCH_MOCK),)
+VBOOT_FIRMWARE_ARCH-y := mock
+else
+VBOOT_CFLAGS += $(call vboot-fixup-includes,$(CFLAGS))
+VBOOT_CFLAGS += -I$(abspath $(obj))
+endif
+
+ifeq ($(VBOOT_FIRMWARE_ARCH-y),)
+$(error vboot requires architecture to be set in the configuration)
+endif
+
+# Enable vboot debug by default
+VBOOT_CFLAGS += -DVBOOT_DEBUG
+
+ifeq ($(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION),y)
+CPPFLAGS_common += -DVB2_X86_RSA_ACCELERATION
+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)) \
+ VB2_X86_RSA_ACCELERATION=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_X86_RSA_ACCELERATION)) \
+ ARMV8_CRYPTO_EXT=$(call kconfig-to-binary, $(CONFIG_LP_VBOOT_SHA_ARMV8_CE)) \
+ 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)