diff --git a/native/jni/magiskboot/bootimg.cpp b/native/jni/magiskboot/bootimg.cpp index 0fd7557f9..73e971069 100644 --- a/native/jni/magiskboot/bootimg.cpp +++ b/native/jni/magiskboot/bootimg.cpp @@ -419,7 +419,7 @@ void repack(const char* orig_image, const char* out_image) { size_t raw_size; void *raw_buf; mmap_ro(KERNEL_FILE, raw_buf, raw_size); - if (!COMPRESSED(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.k_fmt)) { + if (!COMPRESSED_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.k_fmt)) { boot.hdr->kernel_size = compress(boot.k_fmt, fd, raw_buf, raw_size); } else { boot.hdr->kernel_size = write(fd, raw_buf, raw_size); @@ -442,7 +442,7 @@ void repack(const char* orig_image, const char* out_image) { size_t raw_size; void *raw_buf; mmap_ro(RAMDISK_FILE, raw_buf, raw_size); - if (!COMPRESSED(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt)) { + if (!COMPRESSED_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt)) { boot.hdr->ramdisk_size = compress(boot.r_fmt, fd, raw_buf, raw_size); } else { boot.hdr->ramdisk_size = write(fd, raw_buf, raw_size); diff --git a/native/jni/magiskboot/format.h b/native/jni/magiskboot/format.h index 293776bc1..a445e6200 100644 --- a/native/jni/magiskboot/format.h +++ b/native/jni/magiskboot/format.h @@ -25,6 +25,7 @@ typedef enum { } format_t; #define COMPRESSED(fmt) ((fmt) >= GZIP && (fmt) <= LZ4_LEGACY) +#define COMPRESSED_ANY(fmt) ((fmt) >= GZIP && (fmt) <= LZOP) #define BOOT_MAGIC "ANDROID!" #define CHROMEOS_MAGIC "CHROMEOS"