From f8b8ce3847bd31fa2c8ca207c30b1b6e264ad991 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 Jan 2026 14:29:23 -0500 Subject: [PATCH] Fallback to filename for PE format kernels Some ARM64 kernels ship as EFI executables, but it's not obvious how to extract version numbers from those properly. --- imgutil/imgutil | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index acc9e0f4..0aaf7f55 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -824,11 +824,14 @@ def version_sort(iterable): def get_kern_version(filename): with open(filename, 'rb') as kernfile: - checkgzip = kernfile.read(2) - if checkgzip == b'\x1f\x8b': - # gzipped... this would probably be aarch64 + header = kernfile.read(2) + if header == b'\x1f\x8b': + # gzipped... we can't process this right now, # assume the filename has the version embedded return os.path.basename(filename).replace('vmlinuz-', '') + if header == b'MZ': + # PE format, no easy way to get version, assume filename has it + return os.path.basename(filename).replace('vmlinuz-', '') kernfile.seek(0x20e) offset = struct.unpack('