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>
This commit is contained in:
Jakub Czapiga 2022-01-12 09:59:39 +00:00 committed by Julius Werner
parent d74b8d9c99
commit 395f5b3129
5 changed files with 19 additions and 2 deletions

View File

@ -45,6 +45,7 @@ export obj ?= build
export objutil ?= $(obj)/util export objutil ?= $(obj)/util
export objk := $(objutil)/lp_kconfig export objk := $(objutil)/lp_kconfig
export absobj := $(abspath $(obj)) export absobj := $(abspath $(obj))
VBOOT_SOURCE ?= $(coreboottop)/3rdparty/vboot
export KCONFIG_AUTOHEADER := $(obj)/config.h export KCONFIG_AUTOHEADER := $(obj)/config.h
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf export KCONFIG_AUTOCONFIG := $(obj)/auto.conf

View File

@ -131,6 +131,15 @@ install: real-target
$(foreach item,$(includes), \ $(foreach item,$(includes), \
install -m 755 -d $(DESTDIR)/libpayload/include/$(call extract_nth,2,$(item)); \ install -m 755 -d $(DESTDIR)/libpayload/include/$(call extract_nth,2,$(item)); \
install -m 644 $(call extract_nth,1,$(item)) $(DESTDIR)/libpayload/include/$(call extract_nth,2,$(item)); ) install -m 644 $(call extract_nth,1,$(item)) $(DESTDIR)/libpayload/include/$(call extract_nth,2,$(item)); )
printf " INSTALL $(DESTDIR)/libpayload/vboot\n"
install -m 755 -d $(DESTDIR)/libpayload/vboot
for file in `find $(VBOOT_SOURCE)/firmware/include \
$(VBOOT_SOURCE)/firmware/2lib/include \
-iname '*.h' -type f \
| sed 's,$(VBOOT_SOURCE)/firmware/,,'`; do \
install -m 755 -d $(DESTDIR)/libpayload/vboot/$$(dirname $$file); \
install -m 644 $(VBOOT_SOURCE)/firmware/$$file $(DESTDIR)/libpayload/vboot/$$file ; \
done
printf " INSTALL $(DESTDIR)/libpayload/bin\n" printf " INSTALL $(DESTDIR)/libpayload/bin\n"
install -m 755 -d $(DESTDIR)/libpayload/bin install -m 755 -d $(DESTDIR)/libpayload/bin
install -m 755 bin/lpgcc $(DESTDIR)/libpayload/bin install -m 755 bin/lpgcc $(DESTDIR)/libpayload/bin

View File

@ -63,3 +63,9 @@ if [ -d $BASE/../include ]; then
else else
_INCDIR=$LIBPAYLOAD_PREFIX/include _INCDIR=$LIBPAYLOAD_PREFIX/include
fi fi
if [ -d $BASE/../vboot ]; then
_VBOOTINCDIR=$BASE/../vboot/include
else
_VBOOTINCDIR=$LIBPAYLOAD_PREFIX/../vboot/include
fi

View File

@ -169,6 +169,9 @@ if [ $_LIBDIR = $_OBJ ]; then
fi fi
_CFLAGS="$_CFLAGS -I$BASE/../../../src/commonlib/bsd/include" _CFLAGS="$_CFLAGS -I$BASE/../../../src/commonlib/bsd/include"
_CFLAGS="$_CFLAGS -I$BASE/../../../3rdparty/vboot/firmware/include"
else
_CFLAGS="$_CFLAGS -I$_VBOOTINCDIR"
fi fi
# Check for the -fno-stack-protector silliness # Check for the -fno-stack-protector silliness

View File

@ -1,7 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
VBOOT_SOURCE ?= $(coreboottop)/3rdparty/vboot
VBOOT_BUILD_DIR ?= $(abspath $(obj)/external/vboot) VBOOT_BUILD_DIR ?= $(abspath $(obj)/external/vboot)
VBOOT_FW_LIB = $(VBOOT_BUILD_DIR)/vboot_fw.a VBOOT_FW_LIB = $(VBOOT_BUILD_DIR)/vboot_fw.a
TLCL_LIB = $(VBOOT_BUILD_DIR)/tlcl.a TLCL_LIB = $(VBOOT_BUILD_DIR)/tlcl.a