efi_loader: type of efi_secure_mode
[oweals/u-boot.git] / tools / dumpimage.c
index ee3d41dda4d4b2b0ed46f2b430c5d01ab95812d8..e5481435a7644add00810f7d6a7548762d2cb79a 100644 (file)
@@ -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",
@@ -95,7 +104,6 @@ int main(int argc, char **argv)
                        printf("dumpimage version %s\n", PLAIN_VERSION);
                        exit(EXIT_SUCCESS);
                case 'h':
-                       usage();
                default:
                        usage();
                        break;
@@ -175,6 +183,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