diff options
author | Jordan Hand <jordanhand22@gmail.com> | 2019-03-05 14:47:56 -0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-03-08 11:31:44 -0500 |
commit | d32aa3cae44e618048ff7f378577d44f9b6d6dcc (patch) | |
tree | fc4cfbe78b9629281ee4a8c1ccead9204afa9224 /tools/imagetool.c | |
parent | 280fafff165428bc69db221faaccaf4edfc32d9d (diff) | |
download | u-boot-d32aa3cae44e618048ff7f378577d44f9b6d6dcc.tar.gz |
fdt: Fix FIT header verification in mkimage and conduct same checks as bootm
FIT header verification in mkimage was treating a return code as a boolean,
which meant that failures in validating the fit were seen as successes.
Additionally, mkimage was checking all formats to find a header which
passes validation, rather than using the image type specified to
mkimage.
checkpatch.pl checks for lines ending with '(' and alignment matching
open parentheses are ignored to keep with existing coding style.
Signed-off-by: Jordan Hand <jorhand@microsoft.com>
Diffstat (limited to 'tools/imagetool.c')
-rw-r--r-- | tools/imagetool.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tools/imagetool.c b/tools/imagetool.c index b3e628f612..ba1f64aa37 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -46,7 +46,7 @@ int imagetool_verify_print_header( if (retval == 0) { /* - * Print the image information if verify is + * Print the image information if verify is * successful */ if ((*curr)->print_header) { @@ -65,6 +65,38 @@ int imagetool_verify_print_header( return retval; } +int imagetool_verify_print_header_by_type( + void *ptr, + struct stat *sbuf, + struct image_type_params *tparams, + struct image_tool_params *params) +{ + int retval; + + retval = tparams->verify_header((unsigned char *)ptr, sbuf->st_size, + params); + + if (retval == 0) { + /* + * Print the image information if verify is successful + */ + if (tparams->print_header) { + if (!params->quiet) + tparams->print_header(ptr); + } else { + fprintf(stderr, + "%s: print_header undefined for %s\n", + params->cmdname, tparams->name); + } + } else { + fprintf(stderr, + "%s: verify_header failed for %s with exit code %d\n", + params->cmdname, tparams->name, retval); + } + + return retval; +} + int imagetool_save_subimage( const char *file_name, ulong file_data, |