tools: mkimage/dumpimage: Allow to use -l with -T
authorPali Rohár <pali@kernel.org>
Sun, 13 Feb 2022 00:09:46 +0000 (01:09 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 28 Feb 2022 15:33:11 +0000 (10:33 -0500)
commit11f29d443622070c9423ed5fda74b9564570aac7
tree3f69b209af8f00ed44ee648aeeebe3d8114f221e
parenta900c7f8161b74fc66ec715e68e7244b53f04298
tools: mkimage/dumpimage: Allow to use -l with -T

Currently -l option for mkimage and dumpimage ignores option -T and always
tries to autodetect image type.

With this change it is possible to tell mkimage and dumpimage to parse
image file as specific type (and not random autodetected type). This allows
to use mkimage -l or dumpimage -l as tool for validating image.

params.type for -l option is now by default initialized to zero
(IH_TYPE_INVALID) instead of IH_TYPE_KERNEL. imagetool_get_type() for
IH_TYPE_INVALID returns NULL, which is assigned to tparams. mkimage and
dumpimage code is extended to handle tparams with NULL for -l option. And
imagetool_verify_print_header() is extended to do validation via tparams if
is not NULL.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
doc/mkimage.1
tools/dumpimage.c
tools/imagetool.c
tools/imagetool.h
tools/mkimage.c