mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-23 06:51:33 +00:00
Support patching AVD with release builds
This commit is contained in:
parent
b496923cbb
commit
d17ed2b979
18
build.py
18
build.py
@ -460,14 +460,17 @@ def setup_ndk(args):
|
|||||||
|
|
||||||
def setup_avd(args):
|
def setup_avd(args):
|
||||||
if not args.skip:
|
if not args.skip:
|
||||||
args.release = False
|
|
||||||
build_all(args)
|
build_all(args)
|
||||||
|
|
||||||
header('* Setting up emulator')
|
header('* Setting up emulator')
|
||||||
|
|
||||||
abi = cmd_out([adb_path, 'shell', 'getprop', 'ro.product.cpu.abi'])
|
abi = cmd_out([adb_path, 'shell', 'getprop', 'ro.product.cpu.abi'])
|
||||||
proc = execv([adb_path, 'push', f'native/out/{abi}/busybox', 'out/app-debug.apk',
|
proc = execv([adb_path, 'push', f'native/out/{abi}/busybox', 'scripts/avd_magisk.sh', '/data/local/tmp'])
|
||||||
'scripts/avd_magisk.sh', '/data/local/tmp'])
|
if proc.returncode != 0:
|
||||||
|
error('adb push failed!')
|
||||||
|
|
||||||
|
apk = 'out/app-release.apk' if args.release else 'out/app-debug.apk'
|
||||||
|
proc = execv([adb_path, 'push', apk, '/data/local/tmp/magisk.apk'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('adb push failed!')
|
error('adb push failed!')
|
||||||
|
|
||||||
@ -501,10 +504,15 @@ def patch_avd_ramdisk(args):
|
|||||||
f.write(adv_ft)
|
f.write(adv_ft)
|
||||||
|
|
||||||
abi = cmd_out([adb_path, 'shell', 'getprop', 'ro.product.cpu.abi'])
|
abi = cmd_out([adb_path, 'shell', 'getprop', 'ro.product.cpu.abi'])
|
||||||
proc = execv([adb_path, 'push', f'native/out/{abi}/busybox', 'out/app-debug.apk',
|
proc = execv([adb_path, 'push', f'native/out/{abi}/busybox', 'scripts/avd_patch.sh', '/data/local/tmp'])
|
||||||
'scripts/avd_patch.sh', '/data/local/tmp'])
|
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('adb push failed!')
|
error('adb push failed!')
|
||||||
|
|
||||||
|
apk = 'out/app-release.apk' if args.release else 'out/app-debug.apk'
|
||||||
|
proc = execv([adb_path, 'push', apk, '/data/local/tmp/magisk.apk'])
|
||||||
|
if proc.returncode != 0:
|
||||||
|
error('adb push failed!')
|
||||||
|
|
||||||
proc = execv([adb_path, 'push', backup, '/data/local/tmp/ramdisk.cpio.tmp'])
|
proc = execv([adb_path, 'push', backup, '/data/local/tmp/ramdisk.cpio.tmp'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('adb push failed!')
|
error('adb push failed!')
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
# AVD Magisk Setup
|
# AVD Magisk Setup
|
||||||
#####################################################################
|
#####################################################################
|
||||||
#
|
#
|
||||||
# Support emulator ABI: ALL
|
# Support API level: 21 - 33
|
||||||
# Support API level: 23 - 31 (21 and 22 images do not have SELinux)
|
|
||||||
#
|
#
|
||||||
# With an emulator booted and accessible via ADB, usage:
|
# With an emulator booted and accessible via ADB, usage:
|
||||||
# ./build.py emulator
|
# ./build.py emulator
|
||||||
@ -46,15 +45,15 @@ if [ -z "$FIRST_STAGE" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pm install -r $(pwd)/app-debug.apk
|
pm install -r $(pwd)/magisk.apk
|
||||||
|
|
||||||
# Extract files from APK
|
# Extract files from APK
|
||||||
unzip -oj app-debug.apk 'assets/util_functions.sh'
|
unzip -oj magisk.apk 'assets/util_functions.sh'
|
||||||
. ./util_functions.sh
|
. ./util_functions.sh
|
||||||
|
|
||||||
api_level_arch_detect
|
api_level_arch_detect
|
||||||
|
|
||||||
unzip -oj app-debug.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
|
unzip -oj magisk.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
|
||||||
for file in lib*.so; do
|
for file in lib*.so; do
|
||||||
chmod 755 $file
|
chmod 755 $file
|
||||||
mv "$file" "${file:3:${#file}-6}"
|
mv "$file" "${file:3:${#file}-6}"
|
||||||
@ -120,8 +119,7 @@ fi
|
|||||||
|
|
||||||
# Magisk stuff
|
# Magisk stuff
|
||||||
mkdir -p $MAGISKBIN 2>/dev/null
|
mkdir -p $MAGISKBIN 2>/dev/null
|
||||||
unzip -oj app-debug.apk 'assets/*' -x 'assets/chromeos/*' \
|
unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN
|
||||||
-x 'assets/bootctl' -x 'assets/main.jar' -d $MAGISKBIN
|
|
||||||
mkdir $NVBASE/modules 2>/dev/null
|
mkdir $NVBASE/modules 2>/dev/null
|
||||||
mkdir $POSTFSDATAD 2>/dev/null
|
mkdir $POSTFSDATAD 2>/dev/null
|
||||||
mkdir $SERVICED 2>/dev/null
|
mkdir $SERVICED 2>/dev/null
|
||||||
@ -135,7 +133,7 @@ cp -af ./magiskboot $MAGISKBIN/magiskboot
|
|||||||
cp -af ./magiskinit $MAGISKBIN/magiskinit
|
cp -af ./magiskinit $MAGISKBIN/magiskinit
|
||||||
cp -af ./busybox $MAGISKBIN/busybox
|
cp -af ./busybox $MAGISKBIN/busybox
|
||||||
|
|
||||||
if [ "$IS64BIT" = "true" ]; then
|
if $IS64BIT; then
|
||||||
ln -s ./magisk64 $MAGISKTMP/magisk
|
ln -s ./magisk64 $MAGISKTMP/magisk
|
||||||
else
|
else
|
||||||
ln -s ./magisk32 $MAGISKTMP/magisk
|
ln -s ./magisk32 $MAGISKTMP/magisk
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
# AVD MagiskInit Setup
|
# AVD MagiskInit Setup
|
||||||
#####################################################################
|
#####################################################################
|
||||||
#
|
#
|
||||||
# Support emulator ABI: x86_64 and arm64
|
# Support API level: 23 - 33 (21 and 22 images do not have SELinux)
|
||||||
# Support API level: 23 - 31 (21 and 22 images do not have SELinux)
|
|
||||||
#
|
#
|
||||||
# With an emulator booted and accessible via ADB, usage:
|
# With an emulator booted and accessible via ADB, usage:
|
||||||
# ./build.py avd_patch path/to/booted/avd-image/ramdisk.img
|
# ./build.py avd_patch path/to/booted/avd-image/ramdisk.img
|
||||||
@ -24,7 +23,7 @@
|
|||||||
# rootfs w/o early mount: API 23 - 25
|
# rootfs w/o early mount: API 23 - 25
|
||||||
# rootfs with early mount: API 26 - 27
|
# rootfs with early mount: API 26 - 27
|
||||||
# Legacy system-as-root: API 28
|
# Legacy system-as-root: API 28
|
||||||
# 2 stage init: API 29 - 31
|
# 2 stage init: API 29 - 33
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
if [ ! -f /system/build.prop ]; then
|
if [ ! -f /system/build.prop ]; then
|
||||||
@ -44,12 +43,12 @@ if [ -z "$FIRST_STAGE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract files from APK
|
# Extract files from APK
|
||||||
unzip -oj app-debug.apk 'assets/util_functions.sh'
|
unzip -oj magisk.apk 'assets/util_functions.sh'
|
||||||
. ./util_functions.sh
|
. ./util_functions.sh
|
||||||
|
|
||||||
api_level_arch_detect
|
api_level_arch_detect
|
||||||
|
|
||||||
unzip -oj app-debug.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
|
unzip -oj magisk.apk "lib/$ABI/*" "lib/$ABI32/libmagisk32.so" -x "lib/$ABI/libbusybox.so"
|
||||||
for file in lib*.so; do
|
for file in lib*.so; do
|
||||||
chmod 755 $file
|
chmod 755 $file
|
||||||
mv "$file" "${file:3:${#file}-6}"
|
mv "$file" "${file:3:${#file}-6}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user