-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved code from swtpm_env_setup with these changes: * improved grep pattern (previous would fit to also TPM-bypass) * use record_info (script_output will fail the same way as assert_script_run) * works for any RPI version (previously tied to RPI 4) Signed-off-by: Petr Vorel <[email protected]>
- Loading branch information
Showing
2 changed files
with
45 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright SUSE LLC | ||
# SPDX-License-Identifier: FSFAP | ||
|
||
package rpi; | ||
|
||
use warnings; | ||
use strict; | ||
|
||
use Exporter 'import'; | ||
use testapi; | ||
use power_action_utils 'power_action'; | ||
|
||
our @EXPORT = 'enable_tpm_slb9670'; | ||
|
||
# Enable TPM on Raspberry Pi | ||
# https://en.opensuse.org/HCL:Raspberry_Pi3_TPM | ||
sub enable_tpm_slb9670 { | ||
my $module = "tpm_tis_spi"; | ||
|
||
assert_script_run('echo -e "dtparam=spi=on\ndtoverlay=tpm-slb9670" >> /boot/efi/extraconfig.txt'); | ||
assert_script_run('cat /boot/efi/extraconfig.txt'); | ||
assert_script_run("echo '$module' > /etc/modules-load.d/tpm.conf"); | ||
power_action('reboot', textmode => 1); | ||
|
||
# Add some timeout to wait for reboot | ||
sleep(60); | ||
|
||
# Restore SSH connection | ||
reset_consoles; | ||
select_console('root-ssh'); | ||
|
||
record_info('RPi TPM', script_output("dmesg | grep '$module.*2.0 TPM.*device-id.*rev-id'")); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters