From: Andrew F. Davis <afd@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] tools: fit_image: Use fit_image_get_data_and_size for getting offset/size
Date: Tue, 17 Sep 2019 17:09:34 -0400 [thread overview]
Message-ID: <20190917210935.3666-2-afd@ti.com> (raw)
In-Reply-To: <20190917210935.3666-1-afd@ti.com>
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>
---
tools/fit_image.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 5aca634b5e..0e4c2271ce 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -738,9 +738,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);
--
2.17.1
next prev parent reply other threads:[~2019-09-17 21:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 21:09 [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors Andrew F. Davis
2019-09-17 21:09 ` Andrew F. Davis [this message]
2019-11-14 11:46 ` [U-Boot] [PATCH 2/3] tools: fit_image: Use fit_image_get_data_and_size for getting offset/size Lokesh Vutla
2020-01-08 20:10 ` Tom Rini
2019-09-17 21:09 ` [U-Boot] [PATCH 3/3] tools: dumpimage: Fall-though to print usage for help command Andrew F. Davis
2019-11-14 11:46 ` Lokesh Vutla
2020-01-08 20:10 ` Tom Rini
2019-11-13 16:14 ` [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors Andrew F. Davis
2020-01-07 14:07 ` Andrew F. Davis
2019-11-14 11:46 ` Lokesh Vutla
2020-01-08 20:10 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190917210935.3666-2-afd@ti.com \
--to=afd@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox