Re: [PATCH u-boot-marvell v2 15/20] tools: kwbimage: Show binary image offset in mkimage -l, in addition to size

Stefan Roese
2022-01-13T06:43:52Z

On 1/12/22 18:20, Pali Rohár wrote:
> For debugging purposes it is good to know where the binary image would be
> loaded and also it is needed to know if printed size is image size or the
> size of header together with image.
>
> Make it unambiguous by showing that printed size is not the size of the
> whole header, but only the size of executable code, and print also the
> executable offset of this binary image. Load/execute address is the offset
> relative to the base address (either 0x40004000 or 0x40000000).
>
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
> tools/kwbimage.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 2de8c371c12a..d1fb67d3db81 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -1872,9 +1872,12 @@ static void kwbimage_print_header(const void *ptr)
>
> for_each_opt_hdr_v1 (ohdr, mhdr) {
> if (ohdr->headertype == OPT_HDR_V1_BINARY_TYPE) {
> - printf("BIN Hdr Size: ");
> + printf("BIN Img Size: ");
> genimg_print_size(opt_hdr_v1_size(ohdr) - 12 -
> 4 * ohdr->data[0]);
> + printf("BIN Img Offs: %08x\n",
> + (unsigned)((uint8_t *)ohdr - (uint8_t *)mhdr) +
> + 8 + 4 * ohdr->data[0]);
> }
> }
>
>

Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de