[PATCH] filetype: Fix booting ARM Linux Kernels with CONFIG_EFI enabled

Sascha Hauer s.hauer at pengutronix.de
Tue Apr 19 01:58:48 PDT 2016


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 at pengutronix.de>
---
 common/filetype.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/filetype.c b/common/filetype.c
index 74baf51..a8666a1 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;
 
-- 
2.8.0.rc3




More information about the barebox mailing list