From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [RFC 07/10] filetype: add ELF type
Date: Tue, 15 Apr 2014 11:38:31 +0400 [thread overview]
Message-ID: <1397547514-19925-8-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1397547514-19925-1-git-send-email-antonynpavlov@gmail.com>
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
common/filetype.c | 5 +++++
include/filetype.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 0b5da30..dacfa38 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -24,6 +24,7 @@
#include <malloc.h>
#include <errno.h>
#include <envfs.h>
+#include <elf.h>
struct filetype_str {
const char *name; /* human readable filetype */
@@ -53,6 +54,7 @@ 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_elf] = { "ELF", "elf" },
};
const char *file_type_to_string(enum filetype f)
@@ -246,6 +248,9 @@ 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, ELFMAG, 4) == 0)
+ return filetype_elf;
+
return filetype_unknown;
}
diff --git a/include/filetype.h b/include/filetype.h
index c20a4f9..c4f776f 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -30,6 +30,7 @@ enum filetype {
filetype_ubifs,
filetype_bpk,
filetype_barebox_env,
+ filetype_elf,
filetype_max,
};
--
1.9.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-04-15 7:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 7:38 [RFC 00/10] MIPS: use kexec to load ELF linux images Antony Pavlov
2014-04-15 7:38 ` [RFC 01/10] MIPS: add initial cache support for R4000-class CPUs Antony Pavlov
2014-04-15 7:38 ` [RFC 02/10] MIPS: introduce arch_shutdown() Antony Pavlov
2014-04-15 7:38 ` [RFC 03/10] MIPS: use arch_shutdown() for flushing caches Antony Pavlov
2014-04-23 8:43 ` Sascha Hauer
2014-04-15 7:38 ` [RFC 04/10] MIPS: add virt_to_phys() and phys_to_virt() Antony Pavlov
2014-04-15 7:38 ` [RFC 05/10] resource: add create_resource() helper function Antony Pavlov
2014-04-23 8:46 ` Sascha Hauer
2014-04-15 7:38 ` [RFC 06/10] import initial kexec stuff Antony Pavlov
2014-04-15 7:38 ` Antony Pavlov [this message]
2014-04-15 7:38 ` [RFC 08/10] bootm: add kexec ELF support Antony Pavlov
2014-04-23 9:15 ` Sascha Hauer
2014-04-15 7:38 ` [RFC 09/10] MIPS: add " Antony Pavlov
2014-04-15 7:38 ` [RFC 10/10] MIPS: mach-malta: add kexec-capable reboot() Antony Pavlov
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=1397547514-19925-8-git-send-email-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.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