summaryrefslogtreecommitdiffstats
path: root/common/filetype.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-01-09 16:00:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-01-17 11:04:44 +0100
commitc5ebb4d5b4a8612c8c16ae4545e2ffa4aeb6c7b1 (patch)
tree63fc5c69c359074cd6a8365ed6afa5c3b8a81856 /common/filetype.c
parent13f649a4f960b6ded4735ba99d59dee49e3e77cc (diff)
downloadbarebox-c5ebb4d5b4a8612c8c16ae4545e2ffa4aeb6c7b1.tar.gz
barebox-c5ebb4d5b4a8612c8c16ae4545e2ffa4aeb6c7b1.tar.xz
filetype: Add fastboot sparse format detection
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/filetype.c')
-rw-r--r--common/filetype.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 323da026af..f9c034ff2a 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <envfs.h>
#include <disks.h>
+#include <image-sparse.h>
struct filetype_str {
const char *name; /* human readable filetype */
@@ -64,6 +65,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_mxs_bootstream] = { "Freescale MXS bootstream", "mxsbs" },
[filetype_socfpga_xload] = { "SoCFPGA prebootloader image", "socfpga-xload" },
[filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb" },
+ [filetype_android_sparse] = { "Android sparse image", "sparse" },
};
const char *file_type_to_string(enum filetype f)
@@ -301,6 +303,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
(buf8[0x1e] == 0 || buf8[0x1e] == 1))
return filetype_kwbimage_v1;
+ if (is_sparse_image(_buf))
+ return filetype_android_sparse;
+
if (bufsize < 64)
return filetype_unknown;