diff options
author | Pali Rohár | 2021-07-23 11:14:04 +0200 |
---|---|---|
committer | Stefan Roese | 2021-07-31 09:49:31 +0200 |
commit | 34dcf952d80b3c87fa58333bf5973100d2fd9819 (patch) | |
tree | 5d52bbc0126395ac20cf9ee88b249468c5d84e28 /tools | |
parent | e0c243c398a771df22fd3caf309b04eef3ba2683 (diff) |
tools: kwbimage: Print size of binary header in kwbimage_print_header()
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@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/kwbimage.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c index edda0ce7aac..bc302338716 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -1627,6 +1627,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) | + le16_to_cpu(ohdr->headersz_lsb); + if (ohdr->headertype == OPT_HDR_V1_BINARY_TYPE) { + printf("BIN Hdr Size: "); + genimg_print_size(ohdr_size - 12 - 4 * ohdr->data[0]); + } + if (!(*((uint8_t *)ohdr + ohdr_size - 4) & 0x1)) + break; + ohdr = (struct opt_hdr_v1 *)((uint8_t *)ohdr + + ohdr_size); + } + } + } printf("Data Size: "); genimg_print_size(mhdr->blocksize - sizeof(uint32_t)); printf("Load Address: %08x\n", mhdr->destaddr); |