diff --git a/native/jni/magiskboot/bootimg.cpp b/native/jni/magiskboot/bootimg.cpp index 07ba2e160..0fd7557f9 100644 --- a/native/jni/magiskboot/bootimg.cpp +++ b/native/jni/magiskboot/bootimg.cpp @@ -308,6 +308,7 @@ int unpack(const char *image, bool hdr) { decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size); close(fd); } else { + fprintf(stderr, "Kernel is uncompressed or not a supported compressed type!\n"); dump(boot.kernel, boot.hdr->kernel_size, KERNEL_FILE); } @@ -320,6 +321,7 @@ int unpack(const char *image, bool hdr) { decompress(boot.r_fmt, fd, boot.ramdisk, boot.hdr->ramdisk_size); close(fd); } else { + fprintf(stderr, "Ramdisk is uncompressed or not a supported compressed type!\n"); dump(boot.ramdisk, boot.hdr->ramdisk_size, RAMDISK_FILE); } diff --git a/native/jni/magiskboot/compress.cpp b/native/jni/magiskboot/compress.cpp index 936b3bda0..bd7e41d93 100644 --- a/native/jni/magiskboot/compress.cpp +++ b/native/jni/magiskboot/compress.cpp @@ -33,11 +33,13 @@ void decompress(char *infile, const char *outfile) { read_file(in_file, [&](void *buf, size_t len) -> void { if (out_fd < 0) { format_t type = check_fmt(buf, len); + + fprintf(stderr, "Detected format: [%s]\n", fmt2name[type]); + if (!COMPRESSED(type)) - LOGE("Input file is not a compressed type!\n"); + LOGE("Input file is not a supported compressed type!\n"); cmp.reset(get_decoder(type)); - fprintf(stderr, "Detected format: [%s]\n", fmt2name[type]); /* If user does not provide outfile, infile has to be either * .[ext], or '-'. Outfile will be either or '-'. diff --git a/native/jni/magiskboot/format.cpp b/native/jni/magiskboot/format.cpp index eda3ceaa7..7ed50a2fd 100644 --- a/native/jni/magiskboot/format.cpp +++ b/native/jni/magiskboot/format.cpp @@ -89,7 +89,7 @@ const char *Fmt2Ext::operator[](format_t fmt) { case GZIP: return ".gz"; case LZOP: - return ".lzop"; + return ".lzo"; case XZ: return ".xz"; case LZMA: diff --git a/native/jni/magiskboot/format.h b/native/jni/magiskboot/format.h index 6ec8ab042..293776bc1 100644 --- a/native/jni/magiskboot/format.h +++ b/native/jni/magiskboot/format.h @@ -17,8 +17,9 @@ typedef enum { BZIP2, LZ4, LZ4_LEGACY, -/* Misc */ +/* Unsupported compression */ LZOP, +/* Misc */ MTK, DTB, } format_t;