Skip to content

Commit

Permalink
filetype: Detect ARM aarch64 Linux images
Browse files Browse the repository at this point in the history
ARM aarch64 Linux image have a special type. Allow to detect them.

Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
saschahauer committed Apr 4, 2018
1 parent 8bdd7a1 commit 41dd040
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/filetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_socfpga_xload] = { "SoCFPGA prebootloader image", "socfpga-xload" },
[filetype_kwbimage_v1] = { "MVEBU kwbimage (v1)", "kwb" },
[filetype_android_sparse] = { "Android sparse image", "sparse" },
[filetype_arm64_linux_image] = { "ARM aarch64 Linux image", "aarch64-linux" },
};

const char *file_type_to_string(enum filetype f)
Expand Down Expand Up @@ -296,6 +297,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
return filetype_mips_barebox;
if (buf[0] == be32_to_cpu(0x534F4659))
return filetype_bpk;
if (le32_to_cpu(buf[14]) == 0x644d5241)
return filetype_arm64_linux_image;
if ((buf8[0] == 0x5a || buf8[0] == 0x69 || buf8[0] == 0x78 ||
buf8[0] == 0x8b || buf8[0] == 0x9c) &&
buf8[0x1] == 0 && buf8[0x2] == 0 && buf8[0x3] == 0 &&
Expand Down
1 change: 1 addition & 0 deletions include/filetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum filetype {
filetype_socfpga_xload,
filetype_kwbimage_v1,
filetype_android_sparse,
filetype_arm64_linux_image,
filetype_max,
};

Expand Down

0 comments on commit 41dd040

Please sign in to comment.