aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_var_file.c
Commit message (Collapse)AuthorAgeFilesLines
* efi_loader: avoid adding variables twiceIlias Apalodimas2022-12-291-0/+2
| | | | | | | | | | | | | | | | When the efi subsystem starts we restore variables that are both in a file or stored into the .efi_runtime section of U-Boot. However once a variable gets created or changed the preseeded entries will end up in the file. As a consequence on the next boot we will end up adding identical variable entries twice. Fix this by checking if the to be inserted variable already exists. Also swap the restoration order and start with the file instead of the builtin variables, so a user can replace the preseeded ones if needed. Tested-by: Leo Yan <leo.yan@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* efi_loader: typo non-volatile in efi_var_restoreHeinrich Schuchardt2022-12-291-1/+1
| | | | | | | It is volatile variables that we do not allow to be restored from file. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
* blk: Rename if_type to uclass_idSimon Glass2022-09-251-2/+2
| | | | | | Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass <sjg@chromium.org>
* efi: Correct assumption about if_typeSimon Glass2022-09-161-1/+1
| | | | | | | | efi_set_blk_dev_to_system_partition() assumes that 0 is an invalid if_type. This is true now but is about to be false. Fix this bug to avoid a test failure. Signed-off-by: Simon Glass <sjg@chromium.org>
* efi_loader: don't load Shim's MOK database from fileHeinrich Schuchardt2021-10-211-0/+8
| | | | | | | | | | | When using a file to store UEFI variables we must make sure that secure boot related variables are not loaded from this file. With commit 9ef82e29478c ("efi_loader: don't load signature database from file") this has already been implemented for variables defined in the UEFI specification. As most Linux distributions use Shim we should do the same for Shim's MOK database. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* efi_loader: don't load signature database from fileHeinrich Schuchardt2021-09-041-16/+25
| | | | | | | | The UEFI specification requires that the signature database may only be stored in tamper-resistant storage. So these variable may not be read from an unsigned file. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* efi_loader: partition numbers are hexadecimalHeinrich Schuchardt2021-06-091-1/+1
| | | | | | | | | | | If we want to address partition 15 of virtio block device 11, we have to write: virtio b:f When calling sprintf() we must use %x for the device and partition numbers. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: Enable run-time variable support for tee based variablesIlias Apalodimas2020-08-011-18/+7
| | | | | | | | | | | | | | | | | | | | We recently added functions for storing/restoring variables from a file to a memory backed buffer marked as __efi_runtime_data commit f1f990a8c958 ("efi_loader: memory buffer for variables") commit 5f7dcf079de8 ("efi_loader: UEFI variable persistence") Using the same idea we now can support GetVariable() and GetNextVariable() on the OP-TEE based variables as well. So let's re-arrange the code a bit and move the commmon code for accessing variables out of efi_variable.c. Create common functions for reading variables from memory that both implementations can use on run-time. Then just use those functions in the run-time variants of the OP-TEE based EFI variable implementation and initialize the memory buffer on ExitBootServices() Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: pre-seed UEFI variablesHeinrich Schuchardt2020-07-161-7/+1
| | | | | | | | Include a file with the initial values for non-volatile UEFI variables into the U-Boot binary. If this variable is set, changes to variable PK will not be allowed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: enable UEFI variables at runtimeHeinrich Schuchardt2020-07-111-3/+3
| | | | | | Enable UEFI variables at runtime. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* efi_loader: UEFI variable persistenceHeinrich Schuchardt2020-07-111-0/+239
Persist non-volatile UEFI variables in a file on the EFI system partition. The file is written whenever a non-volatile UEFI variable is changed after initialization of the UEFI sub-system. The file is read during the UEFI sub-system initialization to restore non-volatile UEFI variables. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>