提交 d28baea0 编写于 作者: M Michal Simek

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: NAlexander Graf <agraf@suse.de>
Signed-off-by: NMichal Simek <michal.simek@xilinx.com>
Tested-by: NAlexander Graf <agraf@suse.de>
上级 c436bf92
...@@ -147,6 +147,12 @@ static int zynqimage_verify_header(unsigned char *ptr, int image_size, ...@@ -147,6 +147,12 @@ static int zynqimage_verify_header(unsigned char *ptr, int image_size,
if (image_size < sizeof(struct zynq_header)) if (image_size < sizeof(struct zynq_header))
return -1; return -1;
if (zynqhdr->__reserved1 != 0)
return -1;
if (zynqhdr->__reserved2 != 0)
return -1;
if (zynqhdr->width_detection != HEADER_WIDTHDETECTION) if (zynqhdr->width_detection != HEADER_WIDTHDETECTION)
return -1; return -1;
if (zynqhdr->image_identifier != HEADER_IMAGEIDENTIFIER) if (zynqhdr->image_identifier != HEADER_IMAGEIDENTIFIER)
......
...@@ -178,7 +178,7 @@ static void zynqmpimage_print_header(const void *ptr) ...@@ -178,7 +178,7 @@ static void zynqmpimage_print_header(const void *ptr)
struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr;
int i; int i;
printf("Image Type : Xilinx Zynq Boot Image support\n"); printf("Image Type : Xilinx ZynqMP Boot Image support\n");
printf("Image Offset : 0x%08x\n", le32_to_cpu(zynqhdr->image_offset)); printf("Image Offset : 0x%08x\n", le32_to_cpu(zynqhdr->image_offset));
printf("Image Size : %lu bytes (%lu bytes packed)\n", printf("Image Size : %lu bytes (%lu bytes packed)\n",
(unsigned long)le32_to_cpu(zynqhdr->image_size), (unsigned long)le32_to_cpu(zynqhdr->image_size),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册