filetype: add is_barebox_mips_head support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
d40e6e1476
commit
03939c0dfb
|
@ -145,7 +145,7 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
|
|||
return filetype_aimage;
|
||||
if (buf64[0] == le64_to_cpu(0x0a1a0a0d474e5089ull))
|
||||
return filetype_png;
|
||||
if (strncmp(buf8 + 0x10, "barebox", 7) == 0)
|
||||
if (is_barebox_mips_head(_buf))
|
||||
return filetype_mips_barebox;
|
||||
|
||||
if (bufsize < 64)
|
||||
|
|
|
@ -50,4 +50,20 @@ static inline int is_barebox_arm_head(const char *head)
|
|||
}
|
||||
#endif
|
||||
|
||||
#define MIPS_HEAD_SIZE 0x20
|
||||
#define MIPS_HEAD_MAGICWORD_OFFSET 0x10
|
||||
#define MIPS_HEAD_SIZE_OFFSET 0x1C
|
||||
|
||||
#ifdef CONFIG_MIPS
|
||||
static inline int is_barebox_mips_head(const char *head)
|
||||
{
|
||||
return !strcmp(head + MIPS_HEAD_MAGICWORD_OFFSET, "barebox");
|
||||
}
|
||||
#else
|
||||
static inline int is_barebox_mips_head(const char *head)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FILE_TYPE_H */
|
||||
|
|
Loading…
Reference in New Issue