mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 13:17:39 +02:00
magiskboot: allow forcing no recompression on ramdisk.cpio
- when input image had a compressed ramdisk magiskboot had no way to force the repack with the uncompressed ramdisk.cpio since it does not formally recognize cpio as its own format, so add a switch to support forcing repacking to any possible ramdisk format regardless of input image
This commit is contained in:
@ -340,7 +340,7 @@ int unpack(const char *image, bool hdr) {
|
||||
}
|
||||
|
||||
#define file_align() write_zero(fd, align_off(lseek(fd, 0, SEEK_CUR) - header_off, boot.hdr.page_size()))
|
||||
void repack(const char* orig_image, const char* out_image) {
|
||||
void repack(const char* orig_image, const char* out_image, bool force_nocomp) {
|
||||
boot_img boot {};
|
||||
|
||||
off_t header_off, kernel_off, ramdisk_off, second_off, extra_off, dtb_off;
|
||||
@ -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_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt)) {
|
||||
if (!COMPRESSED_ANY(check_fmt(raw_buf, raw_size)) && COMPRESSED(boot.r_fmt) && !force_nocomp) {
|
||||
boot.hdr->ramdisk_size = compress(boot.r_fmt, fd, raw_buf, raw_size);
|
||||
} else {
|
||||
boot.hdr->ramdisk_size = write(fd, raw_buf, raw_size);
|
||||
|
Reference in New Issue
Block a user