summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-04-19 10:56:14 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-19 10:56:16 +0200
commit50de03c8d3dc64950feab0d9158cfaef8f1fc1da (patch)
tree286792404be76e671773dedc71bc7accffafa1f5
parentcb8cf33ce849f71f7fe1d717aa02b5669a54a19e (diff)
downloadbarebox-50de03c8d3dc64950feab0d9158cfaef8f1fc1da.tar.gz
barebox-50de03c8d3dc64950feab0d9158cfaef8f1fc1da.tar.xz
filetype: Fix booting ARM Linux Kernels with CONFIG_EFI enabled
When an ARM kernel is built with CONFIG_EFI enabled, then the kernel image also looks like a EXE file. Move ARM zImage detection before EXE detection so that the kernel is still detected as zImage. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/filetype.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/filetype.c b/common/filetype.c
index 74baf51446..a8666a1439 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -291,8 +291,6 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (bufsize < 64)
return filetype_unknown;
- if (buf8[0] == 'M' && buf8[1] == 'Z')
- return filetype_exe;
if (le32_to_cpu(buf[5]) == 0x504d5453)
return filetype_mxs_bootstream;
@@ -301,6 +299,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)
return filetype_arm_zimage;
+ if (buf8[0] == 'M' && buf8[1] == 'Z')
+ return filetype_exe;
+
if (bufsize < 512)
return filetype_unknown;