[PATCH 07/14] efi_loader: Add config option to indicate fmp header presence
Sughosh Ganu
sughosh.ganu at linaro.org
Mon Dec 7 07:02:16 CET 2020
On Sat, 5 Dec 2020 at 16:04, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> On 11/26/20 7:41 PM, Sughosh Ganu wrote:
> > When building the capsule using scripts in edk2, an fmp header is
> > added on top of the binary payload. Add a config option to indicate
> > the presence of the header. When enabled, the pointer to the image
> > needs to be adjusted as per the size of the header to point to the
> > actual binary payload.
>
> Why do we need a config option? Can't we detect the header?
>
We do have a header signature that can be read, so yes this can be detected
at runtime.
>
> Can we harmonize the capsule format in EDK II and U-Boot?
>
I am not sure about this though. The FMP payload header that gets added by
the edk2 scripts is not defined by the uefi specification but is a edk2
specific structure. I am not sure if defining it in u-boot would make sense.
-sughosh
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> > ---
> > lib/efi_loader/Kconfig | 7 +++++++
> > lib/efi_loader/efi_firmware.c | 12 ++++++++++++
> > 2 files changed, 19 insertions(+)
> >
> > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> > index 0d1b1b5356..55e4787e32 100644
> > --- a/lib/efi_loader/Kconfig
> > +++ b/lib/efi_loader/Kconfig
> > @@ -138,6 +138,13 @@ config EFI_CAPSULE_FIRMWARE_MANAGEMENT
> > Select this option if you want to enable capsule-based
> > firmware update using Firmware Management Protocol.
> >
> > +config EFI_CAPSULE_FMP_HEADER
> > + bool "Capsule uses FMP header"
> > + depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> > + help
> > + Select this option if the capsule is built using the
> > + scripts in edk2.
> > +
> > config EFI_CAPSULE_FIRMWARE_FIT
> > bool "FMP driver for FIT image"
> > depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> > diff --git a/lib/efi_loader/efi_firmware.c
> b/lib/efi_loader/efi_firmware.c
> > index 7e56077383..6c97604d8b 100644
> > --- a/lib/efi_loader/efi_firmware.c
> > +++ b/lib/efi_loader/efi_firmware.c
> > @@ -385,10 +385,22 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
> > if (!image)
> > return EFI_EXIT(EFI_INVALID_PARAMETER);
> >
> > + if (CONFIG_IS_ENABLED(EFI_CAPSULE_FMP_HEADER)) {
> > + /*
> > + * When building the capsule with the scripts in
> > + * edk2, a FMP header is inserted above the capsule
> > + * payload. Compensate for this header to get the
> > + * actual payload that is to be updated.
> > + */
> > + image += 0x10;
> > + image_size -= 0x10;
> > + }
> > +
> > if (dfu_write_by_alt(image_index - 1, (void *)image, image_size,
> > NULL, NULL))
> > return EFI_EXIT(EFI_DEVICE_ERROR);
> >
> > + printf("%s: Capsule update complete!\n", __func__);
> > return EFI_EXIT(EFI_SUCCESS);
> > }
> >
> >
>
>
More information about the U-Boot
mailing list