From fa64da59cdeb3b5ef89ed0162fb82977e6cf9943 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 14 Jun 2022 20:23:49 -0700 Subject: [PATCH] file: basic linux kernel image support. --- toys/posix/file.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/toys/posix/file.c b/toys/posix/file.c index dfd2a092..a7d5c44e 100644 --- a/toys/posix/file.c +++ b/toys/posix/file.c @@ -258,9 +258,9 @@ static void do_regular_file(int fd, char *name) count, count == 1 ? "" : "s"); for (i = 0, s += 4; i < count; i++, s += 20) { arch = peek_be(s, 4); - if (arch == 0x00000007) name = "i386"; + if (arch == 0x00000007) name = "i386"; else if (arch == 0x01000007) name = "x86_64"; - else if (arch == 0x0000000c) name = "arm"; + else if (arch == 0x0000000c) name = "arm"; else if (arch == 0x0100000c) name = "arm64"; else name = "unknown"; xprintf(" [%s]", name); @@ -384,6 +384,31 @@ static void do_regular_file(int fd, char *name) // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680547(v=vs.85).aspx else if (len>0x70 && !memcmp(s, "MZ", 2) && (magic=peek_le(s+0x3c,4))70) { -- 2.39.2