summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-07-04 09:26:17 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-14 08:01:11 +0200
commit66f1030e11970c5e201c9ef95ad9a5228f255bb7 (patch)
tree971c5b056d2bc2e1ba11c06cba73a251eef8307f /common
parent0ed7bda1bc9f71e53c4385fdea89cbae4a0eaae6 (diff)
downloadbarebox-66f1030e11970c5e201c9ef95ad9a5228f255bb7.tar.gz
barebox-66f1030e11970c5e201c9ef95ad9a5228f255bb7.tar.xz
filetype: Add DOS EXE file detection support
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 a04fbdd541..5d6a5443f0 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -56,6 +56,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_ch_image] = { "TI OMAP CH boot image", "ch-image" },
[filetype_ch_image_be] = {
"TI OMAP CH boot image (big endian)", "ch-image-be" },
+ [filetype_exe] = { "MS-DOS executable", "exe" },
};
const char *file_type_to_string(enum filetype f)
@@ -236,6 +237,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (bufsize < 64)
return filetype_unknown;
+ if (buf8[0] == 'M' && buf8[1] == 'Z')
+ return filetype_exe;
+
if (is_barebox_arm_head(_buf))
return filetype_arm_barebox;
if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)