summaryrefslogtreecommitdiff
path: root/tools/zynqimage.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2018-03-14 11:02:24 +0100
committerMichal Simek <michal.simek@xilinx.com>2018-03-23 09:36:15 +0100
commitd28baea078fac4c438874880df385e1e4e8d2b6b (patch)
treeddbe6ead71fbb0f5c8621b422b2c5b9f21fa3e62 /tools/zynqimage.c
parentc436bf92f6bf4014710bfeb067a0a35692e68bd3 (diff)
tools: xilinx: Fix zynq/zynqmp image recognition
There is an issue to recognize zynq or zynqmp image because header checking is just the same. That's why zynqmp images are recognized as zynq one. Check unused fields which are initialized to zero in zynq format (__reserved1 0x38 and __reserved2 0x44) which are initialized for zynqmp. This should ensure that images are properly recognized by: ./tools/mkimage -l spl/boot.bin Also show image type as ZynqMP instead of Zynq which is confusing. Reported-by: Alexander Graf <agraf@suse.de> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'tools/zynqimage.c')
-rw-r--r--tools/zynqimage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/zynqimage.c b/tools/zynqimage.c
index 021d2d3fc9..aa003a7543 100644
--- a/tools/zynqimage.c
+++ b/tools/zynqimage.c
@@ -147,6 +147,12 @@ static int zynqimage_verify_header(unsigned char *ptr, int image_size,
if (image_size < sizeof(struct zynq_header))
return -1;
+ if (zynqhdr->__reserved1 != 0)
+ return -1;
+
+ if (zynqhdr->__reserved2 != 0)
+ return -1;
+
if (zynqhdr->width_detection != HEADER_WIDTHDETECTION)
return -1;
if (zynqhdr->image_identifier != HEADER_IMAGEIDENTIFIER)