From d9f0aed5718226854ad1a632aaa8cb18f090ba63 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Mon, 13 Mar 2023 21:57:23 +0800 Subject: [PATCH] Fix unpack -n and repack -n of ZIMAGE kernel --- native/src/boot/bootimg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/src/boot/bootimg.cpp b/native/src/boot/bootimg.cpp index 5b84e23ed..03a5cd982 100644 --- a/native/src/boot/bootimg.cpp +++ b/native/src/boot/bootimg.cpp @@ -590,7 +590,7 @@ void repack(const char *src_img, const char *out_img, bool skip_comp) { fprintf(stderr, "! Recompressed kernel is too large, using original kernel\n"); ftruncate64(fd, lseek64(fd, - (off64_t) hdr->kernel_size(), SEEK_CUR)); xwrite(fd, boot.kernel, boot.hdr->kernel_size()); - } else { + } else if (!skip_comp) { // Pad zeros to make sure the zImage file size does not change // Also ensure the last 4 bytes are the uncompressed vmlinux size uint32_t sz = m.sz;