magiskboot: be clear lzop is not a supported compression format

- keep detection and always display detected format type to fascilitate external support
This commit is contained in:
osm0sis 2019-05-28 12:47:52 -03:00 committed by John Wu
parent c0d1ce96d1
commit bf58205b0a
4 changed files with 9 additions and 4 deletions

View File

@ -308,6 +308,7 @@ int unpack(const char *image, bool hdr) {
decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size); decompress(boot.k_fmt, fd, boot.kernel, boot.hdr->kernel_size);
close(fd); close(fd);
} else { } else {
fprintf(stderr, "Kernel is uncompressed or not a supported compressed type!\n");
dump(boot.kernel, boot.hdr->kernel_size, KERNEL_FILE); 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); decompress(boot.r_fmt, fd, boot.ramdisk, boot.hdr->ramdisk_size);
close(fd); close(fd);
} else { } else {
fprintf(stderr, "Ramdisk is uncompressed or not a supported compressed type!\n");
dump(boot.ramdisk, boot.hdr->ramdisk_size, RAMDISK_FILE); dump(boot.ramdisk, boot.hdr->ramdisk_size, RAMDISK_FILE);
} }

View File

@ -33,11 +33,13 @@ void decompress(char *infile, const char *outfile) {
read_file(in_file, [&](void *buf, size_t len) -> void { read_file(in_file, [&](void *buf, size_t len) -> void {
if (out_fd < 0) { if (out_fd < 0) {
format_t type = check_fmt(buf, len); format_t type = check_fmt(buf, len);
fprintf(stderr, "Detected format: [%s]\n", fmt2name[type]);
if (!COMPRESSED(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)); cmp.reset(get_decoder(type));
fprintf(stderr, "Detected format: [%s]\n", fmt2name[type]);
/* If user does not provide outfile, infile has to be either /* If user does not provide outfile, infile has to be either
* <path>.[ext], or '-'. Outfile will be either <path> or '-'. * <path>.[ext], or '-'. Outfile will be either <path> or '-'.

View File

@ -89,7 +89,7 @@ const char *Fmt2Ext::operator[](format_t fmt) {
case GZIP: case GZIP:
return ".gz"; return ".gz";
case LZOP: case LZOP:
return ".lzop"; return ".lzo";
case XZ: case XZ:
return ".xz"; return ".xz";
case LZMA: case LZMA:

View File

@ -17,8 +17,9 @@ typedef enum {
BZIP2, BZIP2,
LZ4, LZ4,
LZ4_LEGACY, LZ4_LEGACY,
/* Misc */ /* Unsupported compression */
LZOP, LZOP,
/* Misc */
MTK, MTK,
DTB, DTB,
} format_t; } format_t;