[PATCH u-boot-mvebu 10/31] tools: kwbimage: Print size of binary header in kwbimage_print_header()
Stefan Roese
sr at denx.de
Thu Jul 15 10:37:59 CEST 2021
On 08.07.21 19:30, Marek Behún wrote:
> From: Pali Rohár <pali at kernel.org>
>
> The binary header in kwbimage contains executable SPL code.
>
> Print information about this binary header and not only information
> about it's data part.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> Reviewed-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> tools/kwbimage.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index de6eb3f075..d8a14cb093 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -1625,6 +1625,30 @@ static void kwbimage_print_header(const void *ptr)
> printf("Image Type: MVEBU Boot from %s Image\n",
> image_boot_mode_name(mhdr->blockid));
> printf("Image version:%d\n", image_version((void *)ptr));
> + if (image_version((void *)ptr) == 1) {
> + struct main_hdr_v1 *mhdr = (struct main_hdr_v1 *)ptr;
> +
> + if (mhdr->ext & 0x1) {
> + struct opt_hdr_v1 *ohdr = (struct opt_hdr_v1 *)
> + ((uint8_t *)ptr +
> + sizeof(*mhdr));
> +
> + while (1) {
> + uint32_t ohdr_size;
> +
> + ohdr_size = (ohdr->headersz_msb << 16) |
> + ohdr->headersz_lsb;
> + if (ohdr->headertype == OPT_HDR_V1_BINARY_TYPE) {
> + printf("BIN Hdr Size: ");
> + genimg_print_size(ohdr_size);
> + }
> + if (!(*((uint8_t *)ohdr + 4 + ohdr_size) & 0x1))
> + break;
> + ohdr = (struct opt_hdr_v1 *)((uint8_t *)ohdr +
> + 4 + ohdr_size + 4);
> + }
> + }
> + }
> printf("Data Size: ");
> genimg_print_size(mhdr->blocksize - sizeof(uint32_t));
> printf("Load Address: %08x\n", mhdr->destaddr);
>
Viele Grüße,
Stefan
--
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 at denx.de
More information about the U-Boot
mailing list