]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ukify: allow uncompressed kernel images for UNAME detection on aarch64 and riscv64...
authorTobias Powalowski <tobias.powalowski@googlemail.com>
Wed, 22 Mar 2023 12:24:57 +0000 (13:24 +0100)
committerGitHub <noreply@github.com>
Wed, 22 Mar 2023 12:24:57 +0000 (12:24 +0000)
Uncompressed aarch64 and riscv64 kernels have a different startpoint than x86.
Example output from ukify:
aarch64: NotImplementedError: unknown file format (starts with b'MZ@\xfa')
riscv64: NotImplementedError: unknown file format (starts with b'MZo\x10')
Add check for (b'MZ') to catch both in one call.

Fix:
https://github.com/systemd/systemd/issues/26923

src/ukify/ukify.py

index d34d3acc2738cf45be7bc89f1a024449d4aaed37..0231c5524542970f5dbf2170ab65ba7004da5b09 100755 (executable)
@@ -106,6 +106,10 @@ def maybe_decompress(filename):
         # not compressed
         return f.read()
 
+    if start.startswith(b'MZ'):
+        # not compressed aarch64 and riscv64
+        return f.read()
+
     if start.startswith(b'\x1f\x8b'):
         gzip = try_import('gzip')
         return gzip.open(f).read()