From a2c1b024f32ae0f66246a037c7d79627ddfda5e6 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 22 Apr 2018 14:13:27 +0800 Subject: [PATCH] Use 32-bit binaries only --- app | 2 +- build.py | 10 +++++----- native/jni/Android.mk | 6 +----- native/jni/Application.mk | 2 +- scripts/flash_script.sh | 4 ++-- scripts/util_functions.sh | 11 ++++++----- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/app b/app index 6764a9840..267395bfa 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 6764a98409fac8da30218ec87b7f7e6fcfcef4c9 +Subproject commit 267395bfa2b5077717aadcc3cdd0634443fbad03 diff --git a/build.py b/build.py index 1392421c0..b0eaceb3c 100755 --- a/build.py +++ b/build.py @@ -93,7 +93,7 @@ def build_binary(args): error('Build Magisk binary failed!') print('') - for arch in ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']: + for arch in ['armeabi-v7a', 'x86']: mkdir_p(os.path.join('out', arch)) with open(os.path.join('out', arch, 'dump.h'), 'w') as dump: dump.write('#include "stdlib.h"\n') @@ -110,7 +110,7 @@ def build_binary(args): error('Build Magisk binary failed!') print('') - for arch in ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']: + for arch in ['armeabi-v7a', 'x86']: for binary in ['magiskinit', 'magiskboot', 'b64xz', 'busybox']: try: mv(os.path.join('native', 'libs', arch, binary), os.path.join('out', arch, binary)) @@ -234,7 +234,7 @@ def zip_main(args): zip_with_msg(zipf, source, target) # Binaries - for lib_dir, zip_dir in [('arm64-v8a', 'arm64'), ('armeabi-v7a', 'arm'), ('x86', 'x86'), ('x86_64', 'x64')]: + for lib_dir, zip_dir in [('armeabi-v7a', 'arm'), ('x86', 'x86')]: for binary in ['magiskinit', 'magiskboot']: source = os.path.join('out', lib_dir, binary) target = os.path.join(zip_dir, binary) @@ -261,7 +261,7 @@ def zip_main(args): zipf.writestr(target, util_func) # addon.d.sh source = os.path.join('scripts', 'addon.d.sh') - target = os.path.join('addon.d', '99-magisk.sh') + target = os.path.join('common', '99-magisk.sh') zip_with_msg(zipf, source, target) # Prebuilts @@ -291,7 +291,7 @@ def zip_uninstaller(args): zip_with_msg(zipf, source, target) # Binaries - for lib_dir, zip_dir in [('arm64-v8a', 'arm64'), ('armeabi-v7a', 'arm'), ('x86', 'x86'), ('x86_64', 'x64')]: + for lib_dir, zip_dir in [('armeabi-v7a', 'arm'), ('x86', 'x86')]: source = os.path.join('out', lib_dir, 'magiskboot') target = os.path.join(zip_dir, 'magiskboot') zip_with_msg(zipf, source, target) diff --git a/native/jni/Android.mk b/native/jni/Android.mk index 8b54020aa..143d6ec39 100644 --- a/native/jni/Android.mk +++ b/native/jni/Android.mk @@ -110,10 +110,8 @@ LOCAL_CFLAGS := -DXWRAP_EXIT LOCAL_LDLIBS := -lz include $(BUILD_EXECUTABLE) -# 32-bit static binaries +# static binaries ifndef GRADLE # Do not run gradle sync on these binaries -ifneq ($(TARGET_ARCH_ABI), x86_64) -ifneq ($(TARGET_ARCH_ABI), arm64-v8a) # b64xz include $(CLEAR_VARS) LOCAL_MODULE := b64xz @@ -125,8 +123,6 @@ include $(BUILD_EXECUTABLE) # Busybox include jni/external/busybox/Android.mk endif -endif -endif # Precompile endif diff --git a/native/jni/Application.mk b/native/jni/Application.mk index 85929786f..e4ce43dae 100644 --- a/native/jni/Application.mk +++ b/native/jni/Application.mk @@ -1,4 +1,4 @@ -APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a +APP_ABI := x86 armeabi-v7a APP_PLATFORM := android-21 APP_CFLAGS := $(MAGISK_FLAGS) -std=gnu99 APP_CPPFLAGS := -std=c++11 diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 92d138562..37b85e960 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -69,7 +69,7 @@ api_level_arch_detect ui_print "- Device platform: $ARCH" -BINDIR=$INSTALLER/$ARCH +BINDIR=$INSTALLER/$ARCH32 chmod -R 755 $CHROMEDIR $BINDIR # Check if system root is installed and remove @@ -105,7 +105,7 @@ chmod -R 755 $MAGISKBIN if [ -d /system/addon.d ]; then ui_print "- Adding addon.d survival script" mount -o rw,remount /system - cp -af $INSTALLER/addon.d/99-magisk.sh /system/addon.d/99-magisk.sh + cp -af $INSTALLER/common/99-magisk.sh /system/addon.d/99-magisk.sh chmod 755 /system/addon.d/99-magisk.sh fi diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index 07a0bd9a5..ac5fb0eb3 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -266,11 +266,12 @@ api_level_arch_detect() { ABILONG=`grep_prop ro.product.cpu.abi` ARCH=arm + ARCH32=arm IS64BIT=false - if [ "$ABI" = "x86" ]; then ARCH=x86; fi; - if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; - if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; IS64BIT=true; fi; - if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; IS64BIT=true; fi; + if [ "$ABI" = "x86" ]; then ARCH=x86; ARCH32=x86; fi; + if [ "$ABI2" = "x86" ]; then ARCH=x86; ARCH32=x86; fi; + if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; ARCH32=arm; IS64BIT=true; fi; + if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; ARCH32=x86; IS64BIT=true; fi; } boot_actions() { @@ -297,7 +298,7 @@ recovery_actions() { # Temporarily block out all custom recovery binaries/libs mv /sbin /sbin_tmp # Add all possible library paths - $IS64BIT && export LD_LIBRARY_PATH=/system/lib64:/system/vendor/lib64 || export LD_LIBRARY_PATH=/system/lib:/system/vendor/lib + export LD_LIBRARY_PATH=/system/lib:/system/vendor/lib } recovery_cleanup() {