diff options
author | Tom Rini <trini@konsulko.com> | 2024-10-20 08:27:15 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-10-20 08:27:15 -0600 |
commit | fa0ed06a749c8e3c65d8b12a7d2d33a055a08aad (patch) | |
tree | da947666cff586b29d08d7f61768d1dc41e1b789 /lib/efi_loader/efi_var_file.c | |
parent | 7036abbd5c3934059b020d5fd5bcb8b3bf3c788c (diff) | |
parent | 640c6c6cbaafa1b049118d431cf218d9dce3cdd8 (diff) |
Merge tag 'efi-2025-01-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-01-rc1-2
CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/22810
Documentation:
* Add document describing Ethernet boot on AM62x SoC
* Fix typo in blkmap command example
UEFI:
* Avoid #ifdef in efi_setup.c
* Reduce message noisiness if ESP is missing
* Remove ERROR:, WARNING: prefixes in messages
* Use blk_create_devicef() in block device driver
Others:
* Let CONFIG_CMD_WGET depend on CONFIG_CMD_NET
Diffstat (limited to 'lib/efi_loader/efi_var_file.c')
-rw-r--r-- | lib/efi_loader/efi_var_file.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c index 413e1794e88..ba0bf33ffbd 100644 --- a/lib/efi_loader/efi_var_file.c +++ b/lib/efi_loader/efi_var_file.c @@ -37,18 +37,16 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void) char part_str[PART_STR_LEN]; int r; - if (efi_system_partition.uclass_id == UCLASS_INVALID) { - log_err("No EFI system partition\n"); + if (efi_system_partition.uclass_id == UCLASS_INVALID) return EFI_DEVICE_ERROR; - } + snprintf(part_str, PART_STR_LEN, "%x:%x", efi_system_partition.devnum, efi_system_partition.part); r = fs_set_blk_dev(blk_get_uclass_name(efi_system_partition.uclass_id), part_str, FS_TYPE_ANY); - if (r) { - log_err("Cannot read EFI system partition\n"); + if (r) return EFI_DEVICE_ERROR; - } + return EFI_SUCCESS; } @@ -67,14 +65,21 @@ efi_status_t efi_var_to_file(void) loff_t len; loff_t actlen; int r; + static bool once; ret = efi_var_collect(&buf, &len, EFI_VARIABLE_NON_VOLATILE); if (ret != EFI_SUCCESS) goto error; ret = efi_set_blk_dev_to_system_partition(); - if (ret != EFI_SUCCESS) - goto error; + if (ret != EFI_SUCCESS) { + if (!once) { + log_warning("Cannot persist EFI variables without system partition\n"); + once = true; + } + goto out; + } + once = false; r = fs_write(EFI_VAR_FILE_NAME, map_to_sysmem(buf), 0, len, &actlen); if (r || len != actlen) @@ -83,6 +88,7 @@ efi_status_t efi_var_to_file(void) error: if (ret != EFI_SUCCESS) log_err("Failed to persist EFI variables\n"); +out: free(buf); return ret; #else |