diff options
author | Tobias Powalowski <tobias.powalowski@googlemail.com> | 2023-03-22 13:24:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 12:24:57 +0000 |
commit | bf9f07a62966043c0f1fd7ac4a249790643d1f9a (patch) | |
tree | c838041349d9c1b5fdfb27d07b43385817387237 /src/ukify/ukify.py | |
parent | a3b00f91bb985fa10bc33db5c7883e33dbdf83d0 (diff) | |
download | systemd-bf9f07a62966043c0f1fd7ac4a249790643d1f9a.tar.gz |
ukify: allow uncompressed kernel images for UNAME detection on aarch64 and riscv64 (#26929)
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
Diffstat (limited to 'src/ukify/ukify.py')
-rwxr-xr-x | src/ukify/ukify.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index d34d3acc27..0231c55245 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -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() |