summaryrefslogtreecommitdiff
path: root/tools/dumpimage.c
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2019-09-17 17:09:33 -0400
committerTom Rini <trini@konsulko.com>2020-01-07 11:12:46 -0500
commit79e984c470f7a2bfa4d292214a985ec39185d935 (patch)
treef86eb9fd7603c3cd912d50d5d7bcfb4f41a310f7 /tools/dumpimage.c
parentd8a3f5259a36e76d1de127f65714c40918e8ee4c (diff)
tools: dumpimage: Provide more feedback on internal errors
The dumpimage utility errors out in a number of places without providing sufficient feedback to allow the user to easily determine what has gone wrong. Add additional error messages to make the cause of the failure more obvious. Signed-off-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'tools/dumpimage.c')
-rw-r--r--tools/dumpimage.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/dumpimage.c b/tools/dumpimage.c
index ee3d41dda4..d5f893daf1 100644
--- a/tools/dumpimage.c
+++ b/tools/dumpimage.c
@@ -35,14 +35,23 @@ static int dumpimage_extract_subimage(struct image_type_params *tparams,
if (tparams->verify_header) {
retval = tparams->verify_header((unsigned char *)ptr,
sbuf->st_size, &params);
- if (retval != 0)
+ if (retval != 0) {
+ fprintf(stderr, "%s: failed to verify header of %s\n",
+ params.cmdname, tparams->name);
return -1;
+ }
+
/*
* Extract the file from the image
* if verify is successful
*/
if (tparams->extract_subimage) {
retval = tparams->extract_subimage(ptr, &params);
+ if (retval != 0) {
+ fprintf(stderr, "%s: extract_subimage failed for %s\n",
+ params.cmdname, tparams->name);
+ return -3;
+ }
} else {
fprintf(stderr,
"%s: extract_subimage undefined for %s\n",
@@ -175,6 +184,9 @@ int main(int argc, char **argv)
* image type. Returns the error code if not matched
*/
retval = dumpimage_extract_subimage(tparams, ptr, &sbuf);
+ if (retval)
+ fprintf(stderr, "%s: Can't extract subimage from %s\n",
+ params.cmdname, params.imagefile);
} else {
/*
* Print the image information for matched image type