Skip to content
Snippets Groups Projects
Commit 44402fe7 authored by Andrew F. Davis's avatar Andrew F. Davis Committed by Tom Rini
Browse files

common: image: Remove FIT header update from image post-processing


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: default avatarAndrew F. Davis <afd@ti.com>
Tested-by: default avatarCarlos Hernandez <ceh@ti.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarLokesh Vutla <lokeshvutla@ti.com>
parent a7747aff
No related branches found
No related tags found
No related merge requests found
...@@ -1513,12 +1513,6 @@ void fit_conf_print(const void *fit, int noffset, const char *p) ...@@ -1513,12 +1513,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) 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, " "); fit_image_print(fit, rd_noffset, " ");
if (verify) { if (verify) {
...@@ -1530,23 +1524,6 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify) ...@@ -1530,23 +1524,6 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify)
puts("OK\n"); 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; return 0;
} }
...@@ -1755,6 +1732,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr, ...@@ -1755,6 +1732,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA); bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA);
return -ENOENT; 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; len = (ulong)size;
/* verify that image data is a proper FDT blob */ /* verify that image data is a proper FDT blob */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment