summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2022-04-15 08:59:37 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-04-15 11:43:18 +0300
commita9e6f01a941fab3697be5cc5042b5fe81cc3839e (patch)
tree589c2fdb19cdee888ecc5d75a8383f9c38d34368 /lib
parent7cf06f09cc516c276ce7ad5f2c7c2b0a5110dd34 (diff)
downloadu-boot-a9e6f01a941fab3697be5cc5042b5fe81cc3839e.tar.xz
efi: Define set_dfu_alt_info() for boards with UEFI capsule update enabled
Currently, there are a bunch of boards which enable the UEFI capsule update feature. The actual update of the firmware images is done through the dfu framework which uses the dfu_alt_info environment variable for getting information on the update, like device, partition number/address etc. The dfu framework allows the variable to be set through the set_dfu_alt_info function defined by the platform, or if the function is not defined, it gets the variable from the environment. Using the value set in the environment is not very robust, since the variable can be modified from the u-boot command line and this can cause an incorrect update. To prevent this from happening, define the set_dfu_alt_info function when the capsule update feature is enabled. A weak function is defined which sets the dfu_alt_info environment variable by getting the string for the variable from the platform. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/Kconfig2
-rw-r--r--lib/efi_loader/efi_firmware.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index 559b95a599..d50cd2563d 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -181,6 +181,7 @@ config EFI_CAPSULE_FIRMWARE_FIT
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
select UPDATE_FIT
select DFU
+ select SET_DFU_ALT_INFO
select EFI_CAPSULE_FIRMWARE
help
Select this option if you want to enable firmware management protocol
@@ -192,6 +193,7 @@ config EFI_CAPSULE_FIRMWARE_RAW
depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
select DFU_WRITE_ALT
select DFU
+ select SET_DFU_ALT_INFO
select EFI_CAPSULE_FIRMWARE
help
Select this option if you want to enable firmware management protocol
diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 56bd113de1..36a62b02b3 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -35,6 +35,11 @@ struct fmp_payload_header {
u32 lowest_supported_version;
};
+__weak void set_dfu_alt_info(char *interface, char *devstr)
+{
+ env_set("dfu_alt_info", update_info.dfu_string);
+}
+
/* Place holder; not supported */
static
efi_status_t EFIAPI efi_firmware_get_image_unsupported(