public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] efi_loader: change the error message when storing EFI variables
@ 2024-04-19  9:45 Ilias Apalodimas
  2024-04-19  9:49 ` Ilias Apalodimas
  0 siblings, 1 reply; 2+ messages in thread
From: Ilias Apalodimas @ 2024-04-19  9:45 UTC (permalink / raw)
  To: heinrich.schuchardt
  Cc: Ilias Apalodimas, Heinrich Schuchardt, Tom Rini, Simon Glass,
	Weizhao Ouyang, u-boot

When we try to store EFI variables on a file, we need to use an ESP.
if an ESP is not found, variables will change in memory, but U-Boot
won't be able to restore them across reboots.

Adjust the error message so users can understand what's going on

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
Changes since v1:
- print different messages if ESP is missing or write to file failed

 lib/efi_loader/efi_var_file.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 413e1794e88c..d5d347d50f8d 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -73,16 +73,20 @@ efi_status_t efi_var_to_file(void)
 		goto error;

 	ret = efi_set_blk_dev_to_system_partition();
-	if (ret != EFI_SUCCESS)
+	if (ret != EFI_SUCCESS) {
+		log_err("ESP not found.");
 		goto error;
+	}

 	r = fs_write(EFI_VAR_FILE_NAME, map_to_sysmem(buf), 0, len, &actlen);
-	if (r || len != actlen)
+	if (r || len != actlen) {
+		log_err("Failed to store variables.");
 		ret = EFI_DEVICE_ERROR;
+	}

 error:
 	if (ret != EFI_SUCCESS)
-		log_err("Failed to persist EFI variables\n");
+		log_err(" UEFI variables won't persist reboot\n");
 	free(buf);
 	return ret;
 #else
--
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-19  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-19  9:45 [PATCH v2] efi_loader: change the error message when storing EFI variables Ilias Apalodimas
2024-04-19  9:49 ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox