kumquat-buildroot/package/tpm2-tss/tpm2-tss.mk
Romain Naour 2a026ca501 package/tpm2-tss: create tss user and group for tpm /dev nodes
When systemd and tpm2-tss with fapi support are enabled, the fakeroot
script fail with:

    <stdin>:35: Failed to resolve user 'tss': No such process.

When fapi support is enabled, tpm2-tss package install additional
configuration files that are expecting tss user and group exist [1].

  /etc/sysusers.d/tpm2-tss.conf
  /etc/tmpfiles.d/tpm2-tss-fapi.conf

The build fail in the fakeroot environment while handling tmpfiles
installed by tpm2-tss with fapi by host-systemd.

tss user and group is currently created by the tpm2-abrmd package but
tpm2-tss package also provide a udev rule file tpm-udev.rules [2] that
set the ownership of dev nodes /dev/tpmX and /dev/tpmrmX to tss
user/group. So tpm2-tss package must define TPM2_TSS_USERS to create
tss user and group, not tpm2-abrmd package.

So, move TPM2_ABRMD_USERS to TPM2_TSS_USERS.

Note: tpm2-abrmd is nowadays deprecated since the in-kernel Resource
      Manager (available since kernel 4.12) is preferred [3].

[1] https://github.com/tpm2-software/tpm2-tss/blob/4.1.3/INSTALL.md?plain=1#L184
[2] https://github.com/tpm2-software/tpm2-tss/blob/4.1.3/dist/tpm-udev.rules
[3] https://github.com/tpm2-software/tpm2-abrmd/blob/3.0.0/README.md?plain=1#L39

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit 2cdd3d1ccf)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2024-06-08 20:15:32 +02:00

50 lines
1.6 KiB
Makefile

################################################################################
#
# tpm2-tss
#
################################################################################
TPM2_TSS_VERSION = 3.2.2
TPM2_TSS_SITE = https://github.com/tpm2-software/tpm2-tss/releases/download/$(TPM2_TSS_VERSION)
TPM2_TSS_LICENSE = BSD-2-Clause
TPM2_TSS_LICENSE_FILES = LICENSE
TPM2_TSS_CPE_ID_VENDOR = tpm2_software_stack_project
TPM2_TSS_CPE_ID_PRODUCT = tpm2_software_stack
TPM2_TSS_INSTALL_STAGING = YES
TPM2_TSS_DEPENDENCIES = openssl host-pkgconf
# 0001-configure-Only-use-CXX-when-fuzzing.patch
TPM2_TSS_AUTORECONF = YES
# systemd-sysusers and systemd-tmpfiles are only used at install time
# to trigger the creation of users adn tmpfiles, which we do not care
# about at build time. groupadd, useradd, and setfacl are used in the
# fallback path when systemd-sysusers or systemd-tmpfiles are missing
# and their failure is ignored anyway.
TPM2_TSS_CONF_OPTS = \
ac_cv_prog_result_groupadd=yes \
ac_cv_prog_result_setfacl=yes \
ac_cv_prog_systemd_sysusers=no \
ac_cv_prog_systemd_tmpfiles=no \
ac_cv_prog_useradd=yes \
ac_cv_prog_groupadd=yes \
--with-crypto=ossl \
--disable-doxygen-doc \
--disable-defaultflags
# uses C99 code but forgets to pass -std=c99 when --disable-defaultflags is used
TPM2_TSS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=c99"
ifeq ($(BR2_PACKAGE_TPM2_TSS_FAPI),y)
TPM2_TSS_DEPENDENCIES += json-c libcurl
TPM2_TSS_CONF_OPTS += --enable-fapi
else
TPM2_TSS_CONF_OPTS += --disable-fapi
endif
define TPM2_TSS_USERS
tss -1 tss -1 * - - - tss user for tpm2
endef
$(eval $(autotools-package))