Commit d28baea078fac4c438874880df385e1e4e8d2b6b

Authored by Michal Simek
1 parent c436bf92f6

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>

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

... ... @@ -147,6 +147,12 @@
147 147 if (image_size < sizeof(struct zynq_header))
148 148 return -1;
149 149  
  150 + if (zynqhdr->__reserved1 != 0)
  151 + return -1;
  152 +
  153 + if (zynqhdr->__reserved2 != 0)
  154 + return -1;
  155 +
150 156 if (zynqhdr->width_detection != HEADER_WIDTHDETECTION)
151 157 return -1;
152 158 if (zynqhdr->image_identifier != HEADER_IMAGEIDENTIFIER)
... ... @@ -178,7 +178,7 @@
178 178 struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr;
179 179 int i;
180 180  
181   - printf("Image Type : Xilinx Zynq Boot Image support\n");
  181 + printf("Image Type : Xilinx ZynqMP Boot Image support\n");
182 182 printf("Image Offset : 0x%08x\n", le32_to_cpu(zynqhdr->image_offset));
183 183 printf("Image Size : %lu bytes (%lu bytes packed)\n",
184 184 (unsigned long)le32_to_cpu(zynqhdr->image_size),