[SLOF] [PATCH v3 10/17] Add support for a TPM menu to control the state of the TPM

Stefan Berger stefanb at linux.vnet.ibm.com
Thu Nov 16 03:43:37 AEDT 2017


On 12/15/2015 07:34 AM, Thomas Huth wrote:
> On 30/11/15 23:01, Stefan Berger wrote:
>> From: Stefan Berger <stefanb at linux.vnet.ibm.com>
>>
>> This patch provides an addtional menu that enables the user to control
>> certain aspects of the TPM's state.
>>
>> If a working TPM has been detected, the menu will look like this:
>>
>> The TPM is enabled, active, does not have an owner but one can be installed.
>>
>> To configure the TPM, choose one of the following actions:
>>
>> d. Disable the TPM
>> v. Deactivate the TPM
>> p. Prevent installation of an owner
>>
>>
>> Note: To fully use the TPM it must be enabled and activated.
>>
>> Press escape to continue boot.
>>
>>
>> This menu can be access by pressing the 't' key during boot. The menu will not
>> be shown if no TPM is available.
>>
>> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>> ---
>>   board-qemu/slof/OF.fs       |   3 +
>>   board-qemu/slof/vtpm-sml.fs | 194 ++++++++++++++++++++++++++++++++++++++++++++
>>   lib/libtpm/tcgbios.c        |  39 ++++++++-
>>   lib/libtpm/tcgbios.h        |   9 ++
>>   lib/libtpm/tpm.code         |  20 +++++
>>   lib/libtpm/tpm.in           |   2 +
>>   slof/fs/start-up.fs         |   9 ++
>>   7 files changed, 273 insertions(+), 3 deletions(-)
> ...
>> diff --git a/board-qemu/slof/vtpm-sml.fs b/board-qemu/slof/vtpm-sml.fs
>> index 193b567..3e17c82 100644
>> --- a/board-qemu/slof/vtpm-sml.fs
>> +++ b/board-qemu/slof/vtpm-sml.fs
>> @@ -120,6 +120,200 @@ log-base LOG-SIZE tpm-set-log-parameters
> ...
>> +\ wait for keyboard input
>> +: menu-key-get
>> +    0 0 DO
>> +       key? IF
>> +           key
>> +           UNLOOP EXIT
>> +       THEN
>> +       100 MS
>> +    LOOP
>> +    1b
>> +;
> Is that some kind of timeout that you've tried to do with the "100 MS"
> and 1b at the end here? If so, that should have a proper comment. Then I
> somewhat doubt that it is working as expected: Since you're looping with
> "0 0" that means the loop is running almost forever - and since you're
> delaying 256 ms inbetween (yes, we're hex), the loop will likely never
> end while the user is sitting in front of the screen.
> So if you really want to time-out here, I think you have to rework the
> code. If you wanted to do an endless loop instead ... well then please
> do not use "DO ... LOOP" and something like BEGIN ... WHILE ... REPEAT
> or BEGIN ... UNTIL instead.

I may revive this patch series again... and re-learn Forth after the break.

Does this look ok? I assume 'key' blocks until it has keyboard input.

  \ wait for keyboard input
  : menu-key-get
     BEGIN key 1 UNTIL
  ;

    Stefan



More information about the SLOF mailing list