diff options
author | Pali Rohár <pali@kernel.org> | 2022-01-12 18:20:52 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2022-01-14 11:39:16 +0100 |
commit | 44691034e18d3b242f911abeb20566d418995710 (patch) | |
tree | fbc357be5654d12c9c568485c5710f4c93300f36 /tools/kwboot.c | |
parent | 1a0e52f50a2085c46bf3bc5116f820a3cb655a2c (diff) | |
download | u-boot-socfpga-44691034e18d3b242f911abeb20566d418995710.tar.gz |
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/kwboot.c')
-rw-r--r-- | tools/kwboot.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c index d22e6ea96a..c3d8ab6544 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1398,7 +1398,7 @@ kwboot_add_bin_ohdr_v1(void *img, size_t *size, uint32_t binsz) uint32_t ohdrsz; uint8_t *prev_ext; - if (hdr->ext & 0x1) { + if (hdr->ext) { for_each_opt_hdr_v1 (ohdr, img) if (opt_hdr_v1_next(ohdr) == NULL) break; @@ -1422,7 +1422,7 @@ kwboot_add_bin_ohdr_v1(void *img, size_t *size, uint32_t binsz) ohdrsz = sizeof(*ohdr) + 4 + 4 * num_args + binsz + 4; kwboot_img_grow_hdr(hdr, size, ohdrsz); - *prev_ext |= 1; + *prev_ext = 1; ohdr->headertype = OPT_HDR_V1_BINARY_TYPE; ohdr->headersz_msb = ohdrsz >> 16; |