mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] filetype: add Zynq image type
Date: Tue, 10 Dec 2019 23:03:21 +0100	[thread overview]
Message-ID: <20191210220322.47425-3-dev@lynxeye.de> (raw)
In-Reply-To: <20191210220322.47425-1-dev@lynxeye.de>

Use the 2 invariant words (width detection and image identification)
from the Zynq image header to detect the filetype.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 common/filetype.c  | 4 ++++
 include/filetype.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/common/filetype.c b/common/filetype.c
index 39fea45edff5..fd6e8e3d1c35 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -80,6 +80,7 @@ static const struct filetype_str filetype_str[] = {
 	[filetype_ubootvar] = { "U-Boot environmemnt variable data",
 				"ubootvar" },
 	[filetype_stm32_image_v1] = { "STM32 image (v1)", "stm32-image-v1" },
+	[filetype_zynq_image] = { "Zynq image", "zynq-image" },
 };
 
 const char *file_type_to_string(enum filetype f)
@@ -392,6 +393,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (is_imx_flash_header_v2(_buf))
 		return filetype_imx_image_v2;
 
+	if (buf[8] == 0xAA995566 && buf[9] == 0x584C4E58)
+		return filetype_zynq_image;
+
 	return filetype_unknown;
 }
 
diff --git a/include/filetype.h b/include/filetype.h
index 90a03de58105..db95fdaa0a5f 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -49,6 +49,7 @@ enum filetype {
 	filetype_layerscape_qspi_image,
 	filetype_ubootvar,
 	filetype_stm32_image_v1,
+	filetype_zynq_image,
 	filetype_max,
 };
 
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-12-10 22:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 22:03 [PATCH 1/4] ARM: zynq: zedboard: split out PS7 init Lucas Stach
2019-12-10 22:03 ` [PATCH 2/4] ARM: zynq: zedboard: allow lowlevel init to be called as second stage Lucas Stach
2019-12-10 22:03 ` Lucas Stach [this message]
2019-12-10 22:03 ` [PATCH 4/4] ARM: zynq: add Zynq image bootm handler Lucas Stach
2019-12-11  8:52 ` [PATCH 1/4] ARM: zynq: zedboard: split out PS7 init Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210220322.47425-3-dev@lynxeye.de \
    --to=dev@lynxeye.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox