From cc8be37a59e4b2304272be9d45b583fd86fbe519 Mon Sep 17 00:00:00 2001 From: Nicholas Chin Date: Sat, 18 Jun 2022 14:06:59 -0600 Subject: [PATCH] libpayload/Makefile.inc: Initialize vboot submodule After commit 63e54275f684 (libpayload: Implement new CBFS access API), libpayload includes headers from commonlib/bsd, which in turn include vb2_sha.h from vboot after commit 0655f78041ef (commonlib/bsd: Add new CBFS core implementation). Usually submodules are initialized by the top level Makefile.inc, but since this file is never read when building libpayload based payloads outside the main coreboot build, the header cannot be found unless the vboot submodule had previously been initialized. This is especially evident when following Tutorial 1 in the documentation, where the coreboot repo is cloned without recursing into submodules and coreinfo is built separately from the coreboot build using `make -C payloads/coreinfo`. TEST=Deinitialize submodules and run `make -C payloads/coreinfo`. Coreinfo should build without error. Change-Id: I29b16525999921fbce51c2459d3d534b64e00b3c Signed-off-by: Nicholas Chin Reviewed-on: https://review.coreboot.org/c/coreboot/+/65222 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- payloads/libpayload/Makefile.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/payloads/libpayload/Makefile.inc b/payloads/libpayload/Makefile.inc index 538309a14f..c511e12855 100644 --- a/payloads/libpayload/Makefile.inc +++ b/payloads/libpayload/Makefile.inc @@ -28,6 +28,13 @@ ## SUCH DAMAGE. ## +ifneq ($(NOCOMPILE),1) +GIT:=$(shell git -C "$(top)" rev-parse --git-dir 1>/dev/null 2>&1 \ + && command -v git) +else +GIT:= +endif + export KERNELVERSION := 0.2.0 ARCHDIR-$(CONFIG_LP_ARCH_ARM) := arm @@ -76,6 +83,10 @@ ifeq ($(CONFIG_LP_LTO),y) CFLAGS += -flto endif +# Some of the commonlib cbfs headers include vboot headers, so initialize the +# submodule in case we are building a payload outside the main coreboot build +forgetthis:=$(if $(GIT),$(shell git submodule update --init ../../3rdparty/vboot $(quiet_errors))) + $(obj)/libpayload.config: $(DOTCONFIG) cp $< $@