mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 03:20:46 -05:00
Add support for patching boot images directly via adb with the build.py script.
38 lines
940 B
Bash
38 lines
940 B
Bash
#####################################################################
|
|
# 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
|