summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-02-19 18:06:29 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-20 14:43:43 +0100
commit0de5aae341bf0b46b859417c946793c72be14aae (patch)
tree16fef545aa50b1e61f493754cc853aae4f27b186 /common
parente9241844a8103b62775040cdb35c09002e904fb5 (diff)
downloadbarebox-0de5aae341bf0b46b859417c946793c72be14aae.tar.gz
barebox-0de5aae341bf0b46b859417c946793c72be14aae.tar.xz
filetype: Add detection for barebox environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/filetype.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 8cdf82741a..0b5da3042a 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -23,6 +23,7 @@
#include <fs.h>
#include <malloc.h>
#include <errno.h>
+#include <envfs.h>
struct filetype_str {
const char *name; /* human readable filetype */
@@ -51,6 +52,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_ext] = { "ext filesystem", "ext" },
[filetype_gpt] = { "GUID Partition Table", "gpt" },
[filetype_bpk] = { "Binary PacKage", "bpk" },
+ [filetype_barebox_env] = { "barebox environment file", "bbenv" },
};
const char *file_type_to_string(enum filetype f)
@@ -188,6 +190,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (strncmp(buf8, "#!/bin/sh", 9) == 0)
return filetype_sh;
+ if (buf[0] == ENVFS_32(ENVFS_MAGIC))
+ return filetype_barebox_env;
if (bufsize < 32)
return filetype_unknown;