blob: e9f9ba01c34f8d757b6d7944ca624c55c85952fa [file] [log] [blame]
# Copyright 2022 The ChromiumOS Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
CROS_WORKON_INCREMENTAL_BUILD=1
CROS_WORKON_LOCALNAME="platform2"
CROS_WORKON_PROJECT="chromiumos/platform2"
CROS_WORKON_OUTOFTREE_BUILD=1
CROS_WORKON_SUBTREE="common-mk attestation libhwsec-foundation metrics tpm_manager trunks vtpm .gn"
PLATFORM_SUBDIR="vtpm"
# Do not run test parallelly until unit tests are fixed.
# shellcheck disable=SC2034
PLATFORM_PARALLEL_GTEST_TEST="no"
inherit cros-workon libchrome platform user
DESCRIPTION="Virtual TPM service for Chromium OS"
HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/vtpm/"
LICENSE="BSD-Google"
KEYWORDS="~*"
IUSE="profiling test"
RDEPEND="
chromeos-base/attestation:=[test?]
chromeos-base/libhwsec-foundation:=
chromeos-base/system_api:=
chromeos-base/tpm_manager-client:=
chromeos-base/trunks:=
dev-libs/protobuf:=
"
DEPEND="
${RDEPEND}
chromeos-base/attestation-client:=
chromeos-base/trunks:=[test?]
"
BDEPEND="
chromeos-base/chromeos-dbus-bindings
chromeos-base/minijail
dev-libs/protobuf
"
pkg_preinst() {
# Create user and group for vtpm.
enewuser "vtpm"
enewgroup "vtpm"
}
src_install() {
platform_src_install
# Allow specific syscalls for profiling.
# TODO (b/242806964): Need a better approach for fixing up the seccomp policy
# related issues (i.e. fix with a single function call)
if use profiling; then
echo -e "\n# Syscalls added for profiling case only.\nmkdir: 1\nftruncate: 1\n" >> \
"${D}/usr/share/policy/vtpmd-seccomp.policy"
fi
}
platform_pkg_test() {
platform test_all
}