Add busybox to source

This commit is contained in:
topjohnwu 2017-07-30 20:14:12 +08:00
parent 9fca7011aa
commit 24164c8580
7 changed files with 25 additions and 15 deletions

3
.gitmodules vendored
View File

@ -13,3 +13,6 @@
[submodule "MagiskManager"]
path = MagiskManager
url = https://github.com/topjohnwu/MagiskManager.git
[submodule "jni/busybox"]
path = jni/busybox
url = https://github.com/topjohnwu/ndk-busybox.git

View File

@ -58,7 +58,7 @@ def build_binary(args):
header('* Building Magisk binaries')
ndk_build = os.path.join(os.environ['ANDROID_HOME'], 'ndk-bundle', 'ndk-build')
debug_flag = '' if args.release else '-DDEBUG'
debug_flag = '' if args.release else '-DMAGISK_DEBUG'
proc = subprocess.run('{} APP_CFLAGS=\"-DMAGISK_VERSION=\\\"{}\\\" -DMAGISK_VER_CODE={} {}\" -j{}'.format(
ndk_build, args.versionString, args.versionCode, debug_flag, multiprocessing.cpu_count()), shell=True)
if proc.returncode != 0:

View File

@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
su/su_socket.c
LOCAL_CFLAGS := -Wno-implicit-exception-spec-mismatch
LOCAL_CPPFLAGS := -std=c++11
LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
@ -51,3 +52,10 @@ include jni/selinux/libsepol/Android.mk
# Build magiskboot
include jni/magiskboot/Android.mk
# Build busybox (32-bit only)
ifneq ($(TARGET_ARCH_ABI), x86_64)
ifneq ($(TARGET_ARCH_ABI), arm64-v8a)
include jni/busybox/Android.mk
endif
endif

View File

@ -1,4 +1,2 @@
APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a
APP_PLATFORM := android-21
APP_UNIFIED_HEADERS := true
APP_CPPFLAGS += -std=c++11

1
jni/busybox Submodule

@ -0,0 +1 @@
Subproject commit 2178671c6ef5322f2695cb0ee56df4195d8218ae

View File

@ -25,7 +25,7 @@
static char *buf, *buf2;
static struct vector module_list;
#ifdef DEBUG
#ifdef MAGISK_DEBUG
static int debug_log_pid, debug_log_fd;
#endif
@ -484,7 +484,7 @@ void post_fs_data(int client) {
if (!check_data())
goto unblock;
#ifdef DEBUG
#ifdef MAGISK_DEBUG
// Start debug logs in new process
debug_log_fd = xopen(DEBUG_LOG, O_WRONLY | O_CREAT | O_CLOEXEC | O_TRUNC, 0644);
char *const command[] = { "logcat", "-v", "brief", NULL };
@ -773,7 +773,7 @@ void late_start(int client) {
buf = buf2 = NULL;
vec_deep_destroy(&module_list);
#ifdef DEBUG
#ifdef MAGISK_DEBUG
// Stop recording the boot logcat after every boot task is done
kill(debug_log_pid, SIGTERM);
waitpid(debug_log_pid, NULL, 0);

View File

@ -58,7 +58,7 @@ static inline void do_nothing() {}
// Dummy function to depress debug message
static inline void stub(const char *fmt, ...) {}
#ifdef DEBUG
#ifdef MAGISK_DEBUG
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#else
#define LOGD(...) stub(__VA_ARGS__)