[U-Boot] [PATCH 1/1] efi_loader: disable saving of EFI variables

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Oct 19 22:15:08 UTC 2017


The current implementation of saving of EFI variables has
unwanted side effects:

- Writing to flash on every boot may harm the memory.
- All variables are saved. Not only the EFI ones.
- Variables are saved even if there is not change.

So let us disable saving for now until we have a complete
solution.

This will also mean every boot is "first boot", ie. falling back
to fallback.efi to populate BootOrder/BootNNNN variables, and
never using bootmgr.

Fixes: ad644e7c1823 efi_loader: efi variable support
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_loader/efi_boottime.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f627340de4..a734d84d38 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1440,8 +1440,17 @@ static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle,
 	efi_tpl = TPL_HIGH_LEVEL;
 
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-	/* save any EFI variables that have been written: */
-	env_save();
+	/*
+	 * save any EFI variables that have been written:
+	 *
+	 * This feature is disabled due to the following deficiencies:
+	 * Writing to flash on every boot may ruin the memory.
+	 * We should not save non-EFI variables here.
+	 * We should only save if an EFI variable has actually been
+	 * changed.
+	 *
+	 * env_save();
+	 */
 #endif
 
 	board_quiesce_devices();
-- 
2.14.2



More information about the U-Boot mailing list