Skip to contentSkip to conversation

imx: hab: Support FIT images with external data

RFC PATCH New Ariel D'Alessandro 1 participant 1 message Apr 20, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 imx: hab: Support FIT images with external data

The IVT table is located right after the FIT image. If the FIT image is generated using external data, the total size needs to be computed including the FIT struct and external data lengths.

---
 arch/arm/mach-imx/hab.c |  3 ++-
 boot/image-fit.c        | 44 +++++++++++++++++++++++++++++++++++++++++
 include/image.h         |  9 +++++++++
 3 files changed, 55 insertions(+), 1 deletion(-)
arch/arm/mach-imx/hab.c +2 -1
index 55317abba23..d0bee716772 100644
@@ -593,7 +593,8 @@ static ulong get_image_ivt_offset(ulong img_addr)
 #endif
 #if CONFIG_IS_ENABLED(FIT)
 	case IMAGE_FORMAT_FIT:
-		return (fit_get_size(buf) + 0x1000 - 1)  & ~(0x1000 - 1);
+		return (fit_get_size_external(buf)
+			+ 0x1000 - 1)  & ~(0x1000 - 1);
 #endif
 	default:
 		return 0;
boot/image-fit.c +44 -0

50 lines not on this page · raw message

include/image.h +9 -0
index e4c6a50b885..012ea28ba1b 100644
@@ -979,6 +979,15 @@ static inline ulong fit_get_size(const void *fit)
  */
 ulong fit_get_end(const void *fit);
 
+/**
+ * fit_get_size_external - get FIT image size including external data
+ * @fit: pointer to the FIT format image header
+ *
+ * returns:
+ *     size of the FIT image (including external data) in memory
+ */
+ulong fit_get_size_external(const void *fit);
+
 /**
  * fit_get_name - get FIT node name
  * @fit: pointer to the FIT format image header
Signature · 1 line
2.34.1