[PATCH v5 13/24] efi_loader: fwu_arm_psa: Allow keeping the FMP payload header

abdellatif.elkhlifi at arm.com abdellatif.elkhlifi at arm.com
Fri Sep 26 16:13:40 CEST 2025


From: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>

Allow sending the payload with its FMP header

The Secure world needs the data provided by the payload
FMP header. So, let's allow the user to keep it in
case of FWU_ARM_PSA. This is controlled with
CONFIG_FWU_KEEP_FMP_HEADER.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Simon Glass <sjg at chromium.org>
Cc: Michal Simek <michal.simek at amd.com>
Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
Cc: Casey Connolly <casey.connolly at linaro.org>
Cc: Adriano Cordova <adrianox at gmail.com>

---

Changelog of changes:
===========================

v5:

* Add CONFIG_FWU_KEEP_FMP_HEADER to control whether
  the user wants to keep the FMP header or strip it

 lib/efi_loader/efi_firmware.c | 7 +++++--
 lib/fwu_updates/Kconfig       | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 46d500966ad..61cfa791ffa 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -510,8 +510,11 @@ static void efi_firmware_get_fw_version(const void **p_image,
 		/* FMP header is inserted above the capsule payload */
 		state->fw_version = header->fw_version;
 
-		*p_image += header->header_size;
-		*p_image_size -= header->header_size;
+		if (!IS_ENABLED(CONFIG_FWU_KEEP_FMP_HEADER)) {
+			*p_image += header->header_size;
+			*p_image_size -= header->header_size;
+		}
+
 	}
 }
 
diff --git a/lib/fwu_updates/Kconfig b/lib/fwu_updates/Kconfig
index cdc96109f0a..29e1d441813 100644
--- a/lib/fwu_updates/Kconfig
+++ b/lib/fwu_updates/Kconfig
@@ -57,6 +57,14 @@ config FWU_ARM_PSA
 	  driver that supports the Arm PSA firmware update specification as
 	  mentioned in https://developer.arm.com/documentation/den0118/a/
 
+config FWU_KEEP_FMP_HEADER
+	bool "Allow sending the FMP header with the payload"
+	depends on FWU_ARM_PSA
+	default y
+	help
+	  Select this option if you do not want to strip the FMP header
+	  of the payload
+
 config FWU_BUFFER_PAGES
 	int "Number of 4KB pages in the FWU shared buffer"
 	depends on FWU_ARM_PSA
-- 
2.43.0



More information about the U-Boot mailing list