Use 32-bit binaries only

This commit is contained in:
topjohnwu 2018-04-22 14:13:27 +08:00
parent 3d865394d7
commit a2c1b024f3
6 changed files with 16 additions and 19 deletions

2
app

@ -1 +1 @@
Subproject commit 6764a98409fac8da30218ec87b7f7e6fcfcef4c9 Subproject commit 267395bfa2b5077717aadcc3cdd0634443fbad03

View File

@ -93,7 +93,7 @@ def build_binary(args):
error('Build Magisk binary failed!') error('Build Magisk binary failed!')
print('') print('')
for arch in ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']: for arch in ['armeabi-v7a', 'x86']:
mkdir_p(os.path.join('out', arch)) mkdir_p(os.path.join('out', arch))
with open(os.path.join('out', arch, 'dump.h'), 'w') as dump: with open(os.path.join('out', arch, 'dump.h'), 'w') as dump:
dump.write('#include "stdlib.h"\n') dump.write('#include "stdlib.h"\n')
@ -110,7 +110,7 @@ def build_binary(args):
error('Build Magisk binary failed!') error('Build Magisk binary failed!')
print('') print('')
for arch in ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']: for arch in ['armeabi-v7a', 'x86']:
for binary in ['magiskinit', 'magiskboot', 'b64xz', 'busybox']: for binary in ['magiskinit', 'magiskboot', 'b64xz', 'busybox']:
try: try:
mv(os.path.join('native', 'libs', arch, binary), os.path.join('out', arch, binary)) 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) zip_with_msg(zipf, source, target)
# Binaries # 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']: for binary in ['magiskinit', 'magiskboot']:
source = os.path.join('out', lib_dir, binary) source = os.path.join('out', lib_dir, binary)
target = os.path.join(zip_dir, binary) target = os.path.join(zip_dir, binary)
@ -261,7 +261,7 @@ def zip_main(args):
zipf.writestr(target, util_func) zipf.writestr(target, util_func)
# addon.d.sh # addon.d.sh
source = os.path.join('scripts', '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) zip_with_msg(zipf, source, target)
# Prebuilts # Prebuilts
@ -291,7 +291,7 @@ def zip_uninstaller(args):
zip_with_msg(zipf, source, target) zip_with_msg(zipf, source, target)
# Binaries # 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') source = os.path.join('out', lib_dir, 'magiskboot')
target = os.path.join(zip_dir, 'magiskboot') target = os.path.join(zip_dir, 'magiskboot')
zip_with_msg(zipf, source, target) zip_with_msg(zipf, source, target)

View File

@ -110,10 +110,8 @@ LOCAL_CFLAGS := -DXWRAP_EXIT
LOCAL_LDLIBS := -lz LOCAL_LDLIBS := -lz
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
# 32-bit static binaries # static binaries
ifndef GRADLE # Do not run gradle sync on these binaries ifndef GRADLE # Do not run gradle sync on these binaries
ifneq ($(TARGET_ARCH_ABI), x86_64)
ifneq ($(TARGET_ARCH_ABI), arm64-v8a)
# b64xz # b64xz
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := b64xz LOCAL_MODULE := b64xz
@ -125,8 +123,6 @@ include $(BUILD_EXECUTABLE)
# Busybox # Busybox
include jni/external/busybox/Android.mk include jni/external/busybox/Android.mk
endif endif
endif
endif
# Precompile # Precompile
endif endif

View File

@ -1,4 +1,4 @@
APP_ABI := x86 x86_64 armeabi-v7a arm64-v8a APP_ABI := x86 armeabi-v7a
APP_PLATFORM := android-21 APP_PLATFORM := android-21
APP_CFLAGS := $(MAGISK_FLAGS) -std=gnu99 APP_CFLAGS := $(MAGISK_FLAGS) -std=gnu99
APP_CPPFLAGS := -std=c++11 APP_CPPFLAGS := -std=c++11

View File

@ -69,7 +69,7 @@ api_level_arch_detect
ui_print "- Device platform: $ARCH" ui_print "- Device platform: $ARCH"
BINDIR=$INSTALLER/$ARCH BINDIR=$INSTALLER/$ARCH32
chmod -R 755 $CHROMEDIR $BINDIR chmod -R 755 $CHROMEDIR $BINDIR
# Check if system root is installed and remove # Check if system root is installed and remove
@ -105,7 +105,7 @@ chmod -R 755 $MAGISKBIN
if [ -d /system/addon.d ]; then if [ -d /system/addon.d ]; then
ui_print "- Adding addon.d survival script" ui_print "- Adding addon.d survival script"
mount -o rw,remount /system 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 chmod 755 /system/addon.d/99-magisk.sh
fi fi

View File

@ -266,11 +266,12 @@ api_level_arch_detect() {
ABILONG=`grep_prop ro.product.cpu.abi` ABILONG=`grep_prop ro.product.cpu.abi`
ARCH=arm ARCH=arm
ARCH32=arm
IS64BIT=false IS64BIT=false
if [ "$ABI" = "x86" ]; then ARCH=x86; fi; if [ "$ABI" = "x86" ]; then ARCH=x86; ARCH32=x86; fi;
if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; if [ "$ABI2" = "x86" ]; then ARCH=x86; ARCH32=x86; fi;
if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; IS64BIT=true; fi; if [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; ARCH32=arm; IS64BIT=true; fi;
if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; IS64BIT=true; fi; if [ "$ABILONG" = "x86_64" ]; then ARCH=x64; ARCH32=x86; IS64BIT=true; fi;
} }
boot_actions() { boot_actions() {
@ -297,7 +298,7 @@ recovery_actions() {
# Temporarily block out all custom recovery binaries/libs # Temporarily block out all custom recovery binaries/libs
mv /sbin /sbin_tmp mv /sbin /sbin_tmp
# Add all possible library paths # 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() { recovery_cleanup() {