mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Wadim Egorov <w.egorov@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] barebox: common: added new filetypes
Date: Mon, 12 May 2014 14:24:20 +0200	[thread overview]
Message-ID: <1399897462-21433-2-git-send-email-w.egorov@phytec.de> (raw)
In-Reply-To: <1399897462-21433-1-git-send-email-w.egorov@phytec.de>

- Added omap CH image header recognition
  * filetype_ch_image
  * filetype_ch_image_be

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
 common/filetype.c  |   12 ++++++++++++
 include/filetype.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/common/filetype.c b/common/filetype.c
index 0b5da30..7cdc0a4 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -53,6 +53,9 @@ static const struct filetype_str filetype_str[] = {
 	[filetype_gpt] = { "GUID Partition Table", "gpt" },
 	[filetype_bpk] = { "Binary PacKage", "bpk" },
 	[filetype_barebox_env] = { "barebox environment file", "bbenv" },
+	[filetype_ch_image] = { "TI OMAP CH boot image", "ch-image" },
+	[filetype_ch_image_be] = {
+			"TI OMAP CH boot image (big endian)", "ch-image-be" },
 };
 
 const char *file_type_to_string(enum filetype f)
@@ -177,6 +180,8 @@ enum filetype file_detect_partition_table(const void *_buf, size_t bufsize)
 	return filetype_unknown;
 }
 
+#define CH_TOC_section_name     0x14
+
 enum filetype file_detect_type(const void *_buf, size_t bufsize)
 {
 	const u32 *buf = _buf;
@@ -246,6 +251,13 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
 	if (bufsize >= 1536 && buf16[512 + 28] == le16_to_cpu(0xef53))
 		return filetype_ext;
 
+	if (strncmp(buf8 + CH_TOC_section_name, "CHSETTINGS", 10) == 0)
+		return filetype_ch_image;
+
+	if (buf[5] == 0x43485345 && buf[6] == 0x5454494E &&
+		buf[7] == 0x47530000)
+		return filetype_ch_image_be;
+
 	return filetype_unknown;
 }
 
diff --git a/include/filetype.h b/include/filetype.h
index c20a4f9..fc3140c 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -30,6 +30,8 @@ enum filetype {
 	filetype_ubifs,
 	filetype_bpk,
 	filetype_barebox_env,
+	filetype_ch_image,
+	filetype_ch_image_be,
 	filetype_max,
 };
 
-- 
1.7.0.4


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

  reply	other threads:[~2014-05-12 12:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 12:24 [PATCH 1/4] PCM051: Update RAM timings Wadim Egorov
2014-05-12 12:24 ` Wadim Egorov [this message]
2014-05-12 12:24 ` [PATCH 3/4] ARM: omap: barebox update nand xloadslots handler Wadim Egorov
2014-05-13  8:38   ` Sascha Hauer
2014-05-13  9:46   ` Alexander Aring
2014-05-12 12:24 ` [PATCH 4/4] phycore-am335x: Added bbu " Wadim Egorov
2014-05-12 14:13   ` Holger Schurig
2014-05-14  7:21 ` [PATCH 1/4] PCM051: Update RAM timings 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=1399897462-21433-2-git-send-email-w.egorov@phytec.de \
    --to=w.egorov@phytec.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