public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing
@ 2016-11-21 20:37 Andrew F. Davis
  2016-11-24  2:20 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew F. Davis @ 2016-11-21 20:37 UTC (permalink / raw)
  To: u-boot

After an image is selected out of a FIT blob for further processing we
run an optional, platform specific, post-processing function on this
component. This post-processing may modify the position and size of the
image, so after post-processing we update the location and size for this
image in the FIT header. This can cause problems as the position of
subsequent components in the FIT blob are only referenced by relative
position to the end of the last component. When we resize or move a
component the following components position will be calculated
incorrectly. To fix this, we do not update the FIT header but instead
only update our local understanding of the image data. This also allows
us to re-run post-processing steps if needed.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Tested-by: Carlos Hernandez <ceh@ti.com>
---
 common/image-fit.c | 29 ++++++-----------------------
 1 file changed, 6 insertions(+), 23 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index 77dc011..23b9c54 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1505,12 +1505,6 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
 
 static int fit_image_select(const void *fit, int rd_noffset, int verify)
 {
-#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
-	const void *data;
-	size_t size;
-	int ret;
-#endif
-
 	fit_image_print(fit, rd_noffset, "   ");
 
 	if (verify) {
@@ -1522,23 +1516,6 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify)
 		puts("OK\n");
 	}
 
-#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
-	ret = fit_image_get_data(fit, rd_noffset, &data, &size);
-	if (ret)
-		return ret;
-
-	/* perform any post-processing on the image data */
-	board_fit_image_post_process((void **)&data, &size);
-
-	/*
-	 * update U-Boot's understanding of the "data" property start address
-	 * and size according to the performed post-processing
-	 */
-	ret = fdt_setprop((void *)fit, rd_noffset, FIT_DATA_PROP, data, size);
-	if (ret)
-		return ret;
-#endif
-
 	return 0;
 }
 
@@ -1738,6 +1715,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
 		bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA);
 		return -ENOENT;
 	}
+
+#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
+	/* perform any post-processing on the image data */
+	board_fit_image_post_process((void **)&buf, &size);
+#endif
+
 	len = (ulong)size;
 
 	/* verify that image data is a proper FDT blob */
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing
  2016-11-21 20:37 [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing Andrew F. Davis
@ 2016-11-24  2:20 ` Simon Glass
  2016-11-24  4:10 ` Lokesh Vutla
  2016-12-04 23:07 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-11-24  2:20 UTC (permalink / raw)
  To: u-boot

On 21 November 2016 at 13:37, Andrew F. Davis <afd@ti.com> wrote:
> After an image is selected out of a FIT blob for further processing we
> run an optional, platform specific, post-processing function on this
> component. This post-processing may modify the position and size of the
> image, so after post-processing we update the location and size for this
> image in the FIT header. This can cause problems as the position of
> subsequent components in the FIT blob are only referenced by relative
> position to the end of the last component. When we resize or move a
> component the following components position will be calculated
> incorrectly. To fix this, we do not update the FIT header but instead
> only update our local understanding of the image data. This also allows
> us to re-run post-processing steps if needed.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Tested-by: Carlos Hernandez <ceh@ti.com>
> ---
>  common/image-fit.c | 29 ++++++-----------------------
>  1 file changed, 6 insertions(+), 23 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing
  2016-11-21 20:37 [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing Andrew F. Davis
  2016-11-24  2:20 ` Simon Glass
@ 2016-11-24  4:10 ` Lokesh Vutla
  2016-12-04 23:07 ` [U-Boot] " Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Lokesh Vutla @ 2016-11-24  4:10 UTC (permalink / raw)
  To: u-boot



On Tuesday 22 November 2016 02:07 AM, Andrew F. Davis wrote:
> After an image is selected out of a FIT blob for further processing we
> run an optional, platform specific, post-processing function on this
> component. This post-processing may modify the position and size of the
> image, so after post-processing we update the location and size for this
> image in the FIT header. This can cause problems as the position of
> subsequent components in the FIT blob are only referenced by relative
> position to the end of the last component. When we resize or move a
> component the following components position will be calculated
> incorrectly. To fix this, we do not update the FIT header but instead
> only update our local understanding of the image data. This also allows
> us to re-run post-processing steps if needed.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Tested-by: Carlos Hernandez <ceh@ti.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] common: image: Remove FIT header update from image post-processing
  2016-11-21 20:37 [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing Andrew F. Davis
  2016-11-24  2:20 ` Simon Glass
  2016-11-24  4:10 ` Lokesh Vutla
@ 2016-12-04 23:07 ` Tom Rini
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-12-04 23:07 UTC (permalink / raw)
  To: u-boot

On Mon, Nov 21, 2016 at 02:37:09PM -0600, Andrew F. Davis wrote:

> After an image is selected out of a FIT blob for further processing we
> run an optional, platform specific, post-processing function on this
> component. This post-processing may modify the position and size of the
> image, so after post-processing we update the location and size for this
> image in the FIT header. This can cause problems as the position of
> subsequent components in the FIT blob are only referenced by relative
> position to the end of the last component. When we resize or move a
> component the following components position will be calculated
> incorrectly. To fix this, we do not update the FIT header but instead
> only update our local understanding of the image data. This also allows
> us to re-run post-processing steps if needed.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Tested-by: Carlos Hernandez <ceh@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161204/050c4070/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-04 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 20:37 [U-Boot] [PATCH] common: image: Remove FIT header update from image post-processing Andrew F. Davis
2016-11-24  2:20 ` Simon Glass
2016-11-24  4:10 ` Lokesh Vutla
2016-12-04 23:07 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox