summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-10-24 07:51:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-10-24 07:51:14 +0200
commit2f81d316d21113ab4288fbd3e84c03bf6f0c08ed (patch)
tree768f797847ed0f0aec51d9aa27f131fa90162cc6 /common/filetype.c
parent15f8f9282e58ce4421c645528419e8d7a2a8f0b4 (diff)
downloadbarebox-2f81d316d21113ab4288fbd3e84c03bf6f0c08ed.tar.gz
filetype: Add XZ filetype support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index c8f3582..d98a60e 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -57,6 +57,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_xz_compressed] = { "XZ compressed", "xz" },
[filetype_exe] = { "MS-DOS executable", "exe" },
};
@@ -224,6 +225,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (buf8[0] == 'B' && buf8[1] == 'Z' && buf8[2] == 'h' &&
buf8[3] > '0' && buf8[3] <= '9')
return filetype_bzip2;
+ if (buf8[0] == 0xfd && buf8[1] == 0x37 && buf8[2] == 0x7a &&
+ buf8[3] == 0x58 && buf8[4] == 0x5a && buf8[5] == 0x00)
+ return filetype_xz_compressed;
if (buf[0] == be32_to_cpu(0xd00dfeed))
return filetype_oftree;
if (strncmp(buf8, "ANDROID!", 8) == 0)