summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-14 20:18:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-15 10:20:09 +0100
commit9c11a31ce2d30ff2c8bb004cd3da794b5be56625 (patch)
treee2e7811810a589c35f5b12455e0368fd6ec94949 /common
parent56442bb101597ecaf133647b2ee4707cbcdb0c97 (diff)
downloadbarebox-9c11a31ce2d30ff2c8bb004cd3da794b5be56625.tar.gz
barebox-9c11a31ce2d30ff2c8bb004cd3da794b5be56625.tar.xz
filetype: Add oftree detection
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/filetype.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 5635d40af0..40faff3ada 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -36,6 +36,7 @@ static const char *filetype_str[] = {
[filetype_jffs2] = "JFFS2 image",
[filetype_gzip] = "gzip compressed",
[filetype_bzip2] = "bzip2 compressed",
+ [filetype_oftree] = "open firmware flat device tree",
};
const char *file_type_to_string(enum filetype f)
@@ -69,6 +70,8 @@ enum filetype file_detect_type(void *_buf)
if (buf8[0] == 'B' && buf8[1] == 'Z' && buf8[2] == 'h' &&
buf8[3] > '0' && buf8[3] <= '9')
return filetype_bzip2;
+ if (buf[0] == be32_to_cpu(0xd00dfeed))
+ return filetype_oftree;
return filetype_unknown;
}