mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 11:30:47 -05:00
Refactor adb patching and emulator setup
Add support for patching boot images directly via adb with the build.py script.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#####################################################################
|
||||
# ADB Magisk Boot Image Patcher
|
||||
#####################################################################
|
||||
#
|
||||
# With a device accessible via ADB, usage:
|
||||
# ./build.py patch path/to/boot.img
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
if [ ! -f /system/build.prop ]; then
|
||||
# Running on PC
|
||||
echo 'Please run `./build.py patch` instead of directly executing the script!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /data/local/tmp
|
||||
chmod 755 busybox magisk*
|
||||
|
||||
if [ -z "$FIRST_STAGE" ]; then
|
||||
export FIRST_STAGE=1
|
||||
export ASH_STANDALONE=1
|
||||
# Re-exec script with busybox
|
||||
exec ./busybox sh $0 "$@"
|
||||
fi
|
||||
|
||||
TARGET_FILE="$1"
|
||||
OUTPUT_FILE="$1.magisk"
|
||||
|
||||
# Fetch env flags using non-root functions in app_functions
|
||||
. ./app_functions.sh
|
||||
mount_partitions
|
||||
get_flags
|
||||
|
||||
# Patch the boot image to the target path
|
||||
sh boot_patch.sh $TARGET_FILE
|
||||
mv new-boot.img $OUTPUT_FILE
|
||||
./magiskboot cleanup
|
||||
Reference in New Issue
Block a user