diff options
Diffstat (limited to 'common/filetype.c')
-rw-r--r-- | common/filetype.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/filetype.c b/common/filetype.c index bb807df721..c5f2384a6c 100644 --- a/common/filetype.c +++ b/common/filetype.c @@ -27,6 +27,7 @@ #include <envfs.h> #include <disks.h> #include <image-sparse.h> +#include <elf.h> struct filetype_str { const char *name; /* human readable filetype */ @@ -69,6 +70,7 @@ static const struct filetype_str filetype_str[] = { [filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb1" }, [filetype_android_sparse] = { "Android sparse image", "sparse" }, [filetype_arm64_linux_image] = { "ARM aarch64 Linux image", "aarch64-linux" }, + [filetype_elf] = { "ELF", "elf" }, }; const char *file_type_to_string(enum filetype f) @@ -356,6 +358,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize) buf[7] == 0x47530000) return filetype_ch_image_be; + if (strncmp(buf8, ELFMAG, 4) == 0) + return filetype_elf; + return filetype_unknown; } |