[PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing
Ilias Apalodimas
ilias.apalodimas at linaro.org
Wed Jan 18 17:12:08 CET 2023
When we try to load EFI variables from a file in the ESP partition and the
file is missing We print a scary error looking like
=> printenv -e
** Unable to read file ubootefi.var **
Failed to load EFI variables
This is not an error though since the file wasn't there to begin with.
So silence the warning by aborting the load if the file is not there,
instead of failing the load.
Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
lib/efi_loader/efi_var_file.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 62e071bd8341..7d7141473634 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void)
return EFI_OUT_OF_RESOURCES;
}
+ ret = efi_set_blk_dev_to_system_partition();
+ if (ret != EFI_SUCCESS)
+ goto error;
+ if (!fs_exists(EFI_VAR_FILE_NAME))
+ goto error;
+
ret = efi_set_blk_dev_to_system_partition();
if (ret != EFI_SUCCESS)
goto error;
--
2.38.1
More information about the U-Boot
mailing list