From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/9] filetype: add is_barebox_mips_head support
Date: Sat, 19 Jan 2013 17:37:18 +0100 [thread overview]
Message-ID: <1358613446-1168-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20130119163524.GC26329@game.jcrosoft.org>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
common/filetype.c | 2 +-
include/filetype.h | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/common/filetype.c b/common/filetype.c
index 748e364..bafdc31 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -145,7 +145,7 @@ enum filetype file_detect_type(void *_buf, size_t bufsize)
return filetype_aimage;
if (buf64[0] == le64_to_cpu(0x0a1a0a0d474e5089ull))
return filetype_png;
- if (strncmp(buf8 + 0x10, "barebox", 7) == 0)
+ if (is_barebox_mips_head(_buf))
return filetype_mips_barebox;
if (bufsize < 64)
diff --git a/include/filetype.h b/include/filetype.h
index 91139db..c2af917 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -50,4 +50,20 @@ static inline int is_barebox_arm_head(const char *head)
}
#endif
+#define MIPS_HEAD_SIZE 0x20
+#define MIPS_HEAD_MAGICWORD_OFFSET 0x10
+#define MIPS_HEAD_SIZE_OFFSET 0x1C
+
+#ifdef CONFIG_MIPS
+static inline int is_barebox_mips_head(const char *head)
+{
+ return !strcmp(head + MIPS_HEAD_MAGICWORD_OFFSET, "barebox");
+}
+#else
+static inline int is_barebox_mips_head(const char *head)
+{
+ return 0;
+}
+#endif
+
#endif /* __FILE_TYPE_H */
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-01-19 16:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-19 16:35 [PATCH 0/9 v4] at91: add bootstrap support Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-01-19 16:37 ` [PATCH 2/9] filetype: add is_barebox_head Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 18:04 ` Alexander Aring
2013-01-19 20:39 ` Antony Pavlov
2013-01-19 16:37 ` [PATCH 3/9] at91: add test commamd to emulate bootrom boot Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 4/9] at91sam926x: lowlevel add external boot support Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 5/9] at91: sam926x: switch lowlevel param to c code Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 6/9] at91: usb-a9263 add lowlevel init Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 7/9] introduce common bootstrap code Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 8/9] at91: add bootstrap version Jean-Christophe PLAGNIOL-VILLARD
2013-01-19 16:37 ` [PATCH 9/9] at91: usb_a9263: " Jean-Christophe PLAGNIOL-VILLARD
2013-01-20 15:40 ` [PATCH 0/9 v4] at91: add bootstrap support Sascha Hauer
2013-01-21 10:21 ` Jean-Christophe PLAGNIOL-VILLARD
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=1358613446-1168-1-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--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