tools: default_image: Accept images with padding
authorPali Rohár <pali@kernel.org>
Sun, 29 Jan 2023 16:44:11 +0000 (17:44 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 6 Feb 2023 22:10:14 +0000 (17:10 -0500)
commit598e911f2391d0a9f002bc49d37a06b5ef3213cb
tree306921a6f3cffdb7836cbd18d8a50e0216a3236b
parent3f837b06b76d06189055a0fcdaee4d31c7758d9e
tools: default_image: Accept images with padding

If image file is stored on flash partition then it contains padding, which
is not part of the image itself. Image data size is stored in the image
header. So use image size from the header instead of expecting that total
image file size is size of the header plus size of the image data. This
allows dumpimage to parse image files with padding (e.g. dumped from flash
partition).

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/default_image.c