Support extract boot image from payload.bin

This commit is contained in:
LoveSy
2022-12-13 11:33:16 +08:00
committed by John Wu
parent b136aba1e2
commit 7bf2e3875f
8 changed files with 5152 additions and 0 deletions
+19
View File
@@ -290,6 +290,8 @@ private:
}
if (!bwrite(outbuf, sizeof(outbuf) - strm.avail_out))
return false;
if (code == BZ_STREAM_END)
return true;
} while (strm.avail_out == 0);
return true;
}
@@ -723,3 +725,20 @@ void compress(const char *method, const char *infile, const char *outfile) {
if (rm_in)
unlink(infile);
}
namespace rust {
bool decompress(const unsigned char *in, uint64_t in_size, int fd) {
format_t type = check_fmt(in, in_size);
if (!COMPRESSED(type)) {
LOGE("Input file is not a supported compressed type!\n");
return false;
}
auto strm = get_decoder(type, make_unique<fd_stream>(fd));
if (!strm->write(in, in_size)) {
return false;
}
return true;
}
}