Remove compressed ramdisk support

It is causing more issues than it addresses
This commit is contained in:
topjohnwu 2020-09-24 02:49:09 -07:00
parent 63a9a7d643
commit 4fd04e62af
4 changed files with 3 additions and 30 deletions

View File

@ -90,7 +90,8 @@ LOCAL_SRC_FILES := \
magiskboot/format.cpp \
magiskboot/dtb.cpp \
magiskboot/ramdisk.cpp \
magiskboot/pattern.cpp
magiskboot/pattern.cpp \
utils/cpio.cpp
LOCAL_LDLIBS := -lz
LOCAL_LDFLAGS := -static

View File

@ -7,7 +7,6 @@
#include <xz.h>
#include <magisk.hpp>
#include <cpio.hpp>
#include <utils.hpp>
#include "binaries.h"
@ -102,25 +101,6 @@ static bool unxz(int fd, const uint8_t *buf, size_t size) {
return true;
}
static void decompress_ramdisk() {
constexpr char tmp[] = "tmp.cpio";
constexpr char ramdisk_xz[] = "ramdisk.cpio.xz";
if (access(ramdisk_xz, F_OK))
return;
LOGD("Decompressing ramdisk from %s\n", ramdisk_xz);
uint8_t *buf;
size_t sz;
mmap_ro(ramdisk_xz, buf, sz);
int fd = xopen(tmp, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
unxz(fd, buf, sz);
munmap(buf, sz);
close(fd);
cpio_mmap cpio(tmp);
cpio.extract();
unlink(tmp);
unlink(ramdisk_xz);
}
int dump_magisk(const char *path, mode_t mode) {
int fd = xopen(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, mode);
if (fd < 0)
@ -236,7 +216,6 @@ int main(int argc, char *argv[]) {
else
init = new SARInit(argv, &cmd);
} else {
decompress_ramdisk();
if (cmd.force_normal_boot)
init = new FirstStageInit(argv, &cmd);
else if (access("/sbin/recovery", F_OK) == 0 || access("/system/bin/recovery", F_OK) == 0)

View File

@ -11,7 +11,6 @@ LOCAL_SRC_FILES := \
misc.cpp \
selinux.cpp \
logging.cpp \
cpio.cpp \
xwrap.cpp \
stream.cpp

View File

@ -447,13 +447,7 @@ install_magisk() {
# Restore the original boot partition path
[ "$BOOTNAND" ] && BOOTIMAGE=$BOOTNAND
if ! flash_image new-boot.img "$BOOTIMAGE"; then
ui_print "- Compressing ramdisk to fit in partition"
./magiskboot cpio ramdisk.cpio compress
./magiskboot repack "$BOOTIMAGE"
flash_image new-boot.img "$BOOTIMAGE" || abort "! Insufficient partition size"
fi
flash_image new-boot.img "$BOOTIMAGE" || abort "! Insufficient partition size"
./magiskboot cleanup
rm -f new-boot.img