Make TPM more optional (Fixes: #2360)

- Rename the `plugin_tpm` option to `tpm` and when it's disabled
remove TPM support from all plugins
- If enabled then require the TSS to be installed
This commit is contained in:
Mario Limonciello 2020-09-08 12:58:38 -05:00 committed by Mario Limonciello
parent d19aff3df1
commit 110eb286bc
7 changed files with 17 additions and 13 deletions

View File

@ -22,7 +22,7 @@ meson .. \
-Dplugin_altos=false \
-Dplugin_dell=false \
-Dplugin_nvme=false \
-Dplugin_tpm=false \
-Dtpm=false \
-Dsystemd=false \
-Dplugin_emmc=false \
-Dplugin_amt=false \

View File

@ -15,7 +15,7 @@ meson build \
-Dman=false \
-Ddaemon=false \
-Dgusb:tests=false \
-Dplugin_tpm=false \
-Dtpm=false \
-Dplugin_modem_manager=false \
-Dplugin_flashrom=false \
-Dplugin_uefi=false \

View File

@ -201,11 +201,11 @@ Data files for installed tests.
%if 0%{?have_uefi}
-Dplugin_uefi=true \
-Dplugin_nvme=true \
-Dplugin_tpm=true \
-Dtpm=true \
%else
-Dplugin_uefi=false \
-Dplugin_nvme=false \
-Dplugin_tpm=false \
-Dtpm=false \
%endif
%if 0%{?have_dell}
-Dplugin_dell=true \

View File

@ -226,10 +226,6 @@ libgcab = dependency('libgcab-1.0', version : '>= 1.0', fallback : ['gcab', 'gca
gcab = find_program('gcab', required : true)
bashcomp = dependency('bash-completion', required: false)
python3 = find_program('python3')
tpm2tss = dependency('tss2-esys', version : '>= 2.0', required: false)
if tpm2tss.found()
conf.set('HAVE_TSS2', '1')
endif
platform_deps = []
if get_option('default_library') != 'static'
@ -290,8 +286,11 @@ if cc.has_function('pwrite', args : '-D_XOPEN_SOURCE')
conf.set('HAVE_PWRITE', '1')
endif
if build_standalone and get_option('plugin_tpm') and not tpm2tss.found()
error('tss2-esys is required for -Dplugin_tpm=true')
if build_standalone and get_option('tpm')
tpm2tss = dependency('tss2-esys', version : '>= 2.0')
conf.set('HAVE_TSS2', '1')
else
tpm2tss = dependency('', required: false)
endif
if build_standalone and get_option('plugin_uefi')

View File

@ -15,7 +15,6 @@ option('plugin_emmc', type : 'boolean', value : true, description : 'enable eMMC
option('plugin_synaptics', type: 'boolean', value: true, description : 'enable Synaptics MST hub support')
option('plugin_thunderbolt', type : 'boolean', value : true, description : 'enable Thunderbolt support')
option('plugin_redfish', type : 'boolean', value : true, description : 'enable Redfish support')
option('plugin_tpm', type : 'boolean', value : true, description : 'enable TPM support')
option('plugin_uefi', type : 'boolean', value : true, description : 'enable UEFI support')
option('plugin_nvme', type : 'boolean', value : true, description : 'enable NVMe support')
option('plugin_modem_manager', type : 'boolean', value : false, description : 'enable ModemManager support')
@ -27,6 +26,7 @@ option('systemd', type : 'boolean', value : true, description : 'enable systemd
option('systemd_root_prefix', type: 'string', value: '', description: 'Directory to base systemds installation directories on')
option('elogind', type : 'boolean', value : false, description : 'enable elogind support')
option('tests', type : 'boolean', value : true, description : 'enable tests')
option('tpm', type : 'boolean', value : true, description : 'enable TPM support')
option('udevdir', type: 'string', value: '', description: 'Directory for udev rules')
option('efi-cc', type : 'string', value : 'gcc', description : 'the compiler to use for EFI modules')
option('efi-ld', type : 'string', value : 'ld', description : 'the linker to use for EFI modules')

View File

@ -57,9 +57,9 @@ endif
# depends on dfu
subdir('csr')
if get_option('plugin_tpm')
if get_option('tpm')
if not get_option('gudev')
error('gudev is required for plugin_tpm')
error('gudev is required for tpm')
endif
subdir('tpm')
subdir('tpm-eventlog')

View File

@ -50,6 +50,11 @@ fu_uefi_pcrs_2_0_func (void)
const gchar *tpm_server_running = g_getenv ("TPM_SERVER_RUNNING");
g_setenv ("FWUPD_FORCE_TPM2", "1", TRUE);
#ifndef HAVE_TSS2
g_test_skip ("Compiled without TPM2.0 support");
return;
#endif
#ifdef HAVE_GETUID
if (tpm_server_running == NULL &&
(getuid () != 0 || geteuid () != 0)) {