summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-10-03 21:12:19 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-03 21:12:19 +0200
commitcd323c02240af01eb914c87d9d7c41db6e34984b (patch)
treef040bcd063d5de45d287ea93a08dda46c848a70e /common/filetype.c
parent6a6402414852d994ce67f5df1eb7ff6e827d531b (diff)
parentf65c991d410bc5e04cf0798618f94a0627f33057 (diff)
downloadbarebox-cd323c02240af01eb914c87d9d7c41db6e34984b.tar.gz
barebox-cd323c02240af01eb914c87d9d7c41db6e34984b.tar.xz
Merge branch 'for-next/png'
Conflicts: common/filetype.c include/filetype.h
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 3d544cd6ce..3a1674223e 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -44,6 +44,8 @@ static const char *filetype_str[] = {
[filetype_mips_barebox] = "MIPS barebox image",
[filetype_fat] = "FAT filesytem",
[filetype_mbr] = "MBR sector",
+ [filetype_bmp] = "BMP image",
+ [filetype_png] = "PNG image",
};
const char *file_type_to_string(enum filetype f)
@@ -97,6 +99,7 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
enum filetype file_detect_type(void *_buf)
{
u32 *buf = _buf;
+ u64 *buf64 = _buf;
u8 *buf8 = _buf;
enum filetype type;
@@ -129,6 +132,10 @@ enum filetype file_detect_type(void *_buf)
type = is_fat_or_mbr(buf8, NULL);
if (type != filetype_unknown)
return type;
+ if (strncmp(buf8, "BM", 2) == 0)
+ return filetype_bmp;
+ if (buf64[0] == le64_to_cpu(0x0a1a0a0d474e5089ull))
+ return filetype_png;
return filetype_unknown;
}