summaryrefslogtreecommitdiff
path: root/tools/kwbimage.h
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-01-12 18:20:52 +0100
committerStefan Roese <sr@denx.de>2022-01-14 11:39:16 +0100
commit44691034e18d3b242f911abeb20566d418995710 (patch)
treefbc357be5654d12c9c568485c5710f4c93300f36 /tools/kwbimage.h
parent1a0e52f50a2085c46bf3bc5116f820a3cb655a2c (diff)
tools: kwbimage/kwboot: Check ext field for non-zero value
Despite the official specification, BootROM does not look at the lowest bit of ext field but rather checks if ext field is non-zero. Moreover original Marvell doimage tool puts into the mhdr->ext field the number of extended headers, so basically it sets ext filed to non-zero value if some extended header is present. Fix U-Boot dumpimage and kwboot tools to parse correctly also kwbimage files created by Marvell doimage tool, in the same way as the BootROM is doing it when booting these images. 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>
Diffstat (limited to 'tools/kwbimage.h')
-rw-r--r--tools/kwbimage.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/kwbimage.h b/tools/kwbimage.h
index c000cba4b8..9ebc7d72d3 100644
--- a/tools/kwbimage.h
+++ b/tools/kwbimage.h
@@ -208,7 +208,7 @@ static inline size_t kwbheader_size(const void *header)
const struct main_hdr_v0 *hdr = header;
return sizeof(*hdr) +
- (hdr->ext & 0x1) ? sizeof(struct ext_hdr_v0) : 0;
+ hdr->ext ? sizeof(struct ext_hdr_v0) : 0;
} else {
const struct main_hdr_v1 *hdr = header;
@@ -252,7 +252,7 @@ static inline struct opt_hdr_v1 *opt_hdr_v1_first(void *img) {
return NULL;
mhdr = img;
- if (mhdr->ext & 0x1)
+ if (mhdr->ext)
return (struct opt_hdr_v1 *)(mhdr + 1);
else
return NULL;
@@ -272,7 +272,7 @@ static inline struct opt_hdr_v1 *_opt_hdr_v1_next(struct opt_hdr_v1 *cur)
static inline struct opt_hdr_v1 *opt_hdr_v1_next(struct opt_hdr_v1 *cur)
{
- if (*opt_hdr_v1_ext(cur) & 0x1)
+ if (*opt_hdr_v1_ext(cur))
return _opt_hdr_v1_next(cur);
else
return NULL;