From 44adccc147578d1042679485ee0f1974d44402ce Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 11 Aug 2017 17:14:55 +0800 Subject: [PATCH] Add magisk binary mirror --- jni/daemon/bootstages.c | 5 ++++- jni/include/magisk.h | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/jni/daemon/bootstages.c b/jni/daemon/bootstages.c index af2696959..3fdae8b62 100644 --- a/jni/daemon/bootstages.c +++ b/jni/daemon/bootstages.c @@ -396,14 +396,17 @@ static void mount_mirrors() { symlink(MIRRDIR "/system/vendor", MIRRDIR "/vendor"); LOGI("link: %s -> %s\n", MIRRDIR "/system/vendor", MIRRDIR "/vendor"); } + mkdir_p(MIRRDIR "/bin", 0755); + bind_mount(DATABIN, MIRRDIR "/bin"); } static void link_busybox() { mkdir_p(BBPATH, 0755); char *const command[] = { "busybox", "--install", "-s", BBPATH, NULL}; - int pid = run_command(0, NULL, NULL, BBBIN, command); + int pid = run_command(0, NULL, NULL, MIRRDIR "/bin/busybox", command); if (pid != -1) waitpid(pid, NULL, 0); + symlink(MIRRDIR "/bin/busybox", BBPATH "/busybox"); } /**************** diff --git a/jni/include/magisk.h b/jni/include/magisk.h index 821bbc8bb..6793e58bb 100644 --- a/jni/include/magisk.h +++ b/jni/include/magisk.h @@ -35,7 +35,6 @@ #define MAINIMG "/data/magisk.img" #define DATABIN "/data/magisk" #define MANAGERAPK DATABIN "/magisk.apk" -#define BBBIN DATABIN "/busybox" #define MAGISKTMP "/dev/magisk" #define MIRRDIR MAGISKTMP "/mirror" #define DUMMDIR MAGISKTMP "/dummy"