From 4a329b5a86044190644b12d8573f4d7de8e1fa84 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 14 Jul 2023 19:17:46 +0100 Subject: [PATCH] On arm64, attempt to decompress vmlinuz automatically. --- bin/ubuntu-core-initramfs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/ubuntu-core-initramfs b/bin/ubuntu-core-initramfs index 0d2535ed..3e90542d 100755 --- a/bin/ubuntu-core-initramfs +++ b/bin/ubuntu-core-initramfs @@ -381,6 +381,17 @@ def create_efi(parser, args): args.initrd = "-".join([args.initrd, args.kernelver]) args.output = "-".join([args.output, args.kernelver]) + if platform.machine() == "aarch64": + import gzip + raw_kernel=tempfile.NamedTemporaryFile(mode='wb') + try: + with gzip.open(args.kernel, 'rb') as comp_kernel: + shutil.copyfileobj(comp_kernel, raw_kernel) + raw_kernel.flush() + args.kernel = raw_kernel.name + except gzip.BadGzipFile: + pass + # kernel.efi sections will be aligned to the page size by llvm-objcopy # (which is the default value for SectionAlignment in the PE header). # --set-section-flags are such so added COFF sections have flags: