mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 14:58:29 +00:00
Remove compressed ramdisk support
It is causing more issues than it addresses
This commit is contained in:
parent
63a9a7d643
commit
4fd04e62af
@ -90,7 +90,8 @@ LOCAL_SRC_FILES := \
|
|||||||
magiskboot/format.cpp \
|
magiskboot/format.cpp \
|
||||||
magiskboot/dtb.cpp \
|
magiskboot/dtb.cpp \
|
||||||
magiskboot/ramdisk.cpp \
|
magiskboot/ramdisk.cpp \
|
||||||
magiskboot/pattern.cpp
|
magiskboot/pattern.cpp \
|
||||||
|
utils/cpio.cpp
|
||||||
|
|
||||||
LOCAL_LDLIBS := -lz
|
LOCAL_LDLIBS := -lz
|
||||||
LOCAL_LDFLAGS := -static
|
LOCAL_LDFLAGS := -static
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <xz.h>
|
#include <xz.h>
|
||||||
#include <magisk.hpp>
|
#include <magisk.hpp>
|
||||||
#include <cpio.hpp>
|
|
||||||
#include <utils.hpp>
|
#include <utils.hpp>
|
||||||
|
|
||||||
#include "binaries.h"
|
#include "binaries.h"
|
||||||
@ -102,25 +101,6 @@ static bool unxz(int fd, const uint8_t *buf, size_t size) {
|
|||||||
return true;
|
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 dump_magisk(const char *path, mode_t mode) {
|
||||||
int fd = xopen(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, mode);
|
int fd = xopen(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, mode);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -236,7 +216,6 @@ int main(int argc, char *argv[]) {
|
|||||||
else
|
else
|
||||||
init = new SARInit(argv, &cmd);
|
init = new SARInit(argv, &cmd);
|
||||||
} else {
|
} else {
|
||||||
decompress_ramdisk();
|
|
||||||
if (cmd.force_normal_boot)
|
if (cmd.force_normal_boot)
|
||||||
init = new FirstStageInit(argv, &cmd);
|
init = new FirstStageInit(argv, &cmd);
|
||||||
else if (access("/sbin/recovery", F_OK) == 0 || access("/system/bin/recovery", F_OK) == 0)
|
else if (access("/sbin/recovery", F_OK) == 0 || access("/system/bin/recovery", F_OK) == 0)
|
||||||
|
@ -11,7 +11,6 @@ LOCAL_SRC_FILES := \
|
|||||||
misc.cpp \
|
misc.cpp \
|
||||||
selinux.cpp \
|
selinux.cpp \
|
||||||
logging.cpp \
|
logging.cpp \
|
||||||
cpio.cpp \
|
|
||||||
xwrap.cpp \
|
xwrap.cpp \
|
||||||
stream.cpp
|
stream.cpp
|
||||||
|
|
||||||
|
@ -447,13 +447,7 @@ install_magisk() {
|
|||||||
|
|
||||||
# Restore the original boot partition path
|
# Restore the original boot partition path
|
||||||
[ "$BOOTNAND" ] && BOOTIMAGE=$BOOTNAND
|
[ "$BOOTNAND" ] && BOOTIMAGE=$BOOTNAND
|
||||||
|
flash_image new-boot.img "$BOOTIMAGE" || abort "! Insufficient partition size"
|
||||||
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
|
|
||||||
|
|
||||||
./magiskboot cleanup
|
./magiskboot cleanup
|
||||||
rm -f new-boot.img
|
rm -f new-boot.img
|
||||||
|
Loading…
x
Reference in New Issue
Block a user