aboutsummaryrefslogtreecommitdiff
path: root/tools/fit_image.c
diff options
context:
space:
mode:
authorAndrew F. Davis2019-09-17 17:09:34 -0400
committerTom Rini2020-01-07 11:12:46 -0500
commite5b5628e8a3e4476509a025121315480ea7b79ca (patch)
tree4c9e2f53390f1e50beaadee96f0e70031e0009d1 /tools/fit_image.c
parent79e984c470f7a2bfa4d292214a985ec39185d935 (diff)
tools: fit_image: Use fit_image_get_data_and_size for getting offset/size
This is very similar to fit_image_get_data but has the benefit of working on FIT images with external data unlike fit_image_get_data. This is useful for extracting sub-images from type of FIT image as this would previously just silently fail. Add an error message also so if this still fails it is easier to find out why. Signed-off-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'tools/fit_image.c')
-rw-r--r--tools/fit_image.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 0201cc44d8f..114df5af305 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -741,9 +741,14 @@ static int fit_image_extract(
{
const void *file_data;
size_t file_size = 0;
+ int ret;
- /* get the "data" property of component at offset "image_noffset" */
- fit_image_get_data(fit, image_noffset, &file_data, &file_size);
+ /* get the data address and size of component at offset "image_noffset" */
+ ret = fit_image_get_data_and_size(fit, image_noffset, &file_data, &file_size);
+ if (ret) {
+ fprintf(stderr, "Could not get component information\n");
+ return ret;
+ }
/* save the "file_data" into the file specified by "file_name" */
return imagetool_save_subimage(file_name, (ulong) file_data, file_size);