Commit bf58205b authored by osm0sis's avatar osm0sis Committed by John Wu

magiskboot: be clear lzop is not a supported compression format

- keep detection and always display detected format type to fascilitate external support
parent c0d1ce96
......@@ -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);
}
......
......@@ -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
* <path>.[ext], or '-'. Outfile will be either <path> or '-'.
......
......@@ -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:
......
......@@ -17,8 +17,9 @@ typedef enum {
BZIP2,
LZ4,
LZ4_LEGACY,
/* Misc */
/* Unsupported compression */
LZOP,
/* Misc */
MTK,
DTB,
} format_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment