Update for LineageOS 19.1 and Magisk 25.2

This commit is contained in:
Jordan ERNST 2022-08-25 13:07:40 +02:00
parent 033eece53d
commit ad1115640f
12 changed files with 38 additions and 21 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -111,7 +111,7 @@ if [ -e ramdisk.cpio ]; then
./magiskboot cpio ramdisk.cpio test
STATUS=$?
else
# Stock A only system-as-root
# Stock A only legacy SAR, or some Android 13 GKIs
STATUS=0
fi
case $((STATUS & 3)) in
@ -183,7 +183,15 @@ rm -f ramdisk.cpio.orig config magisk*.xz
#################
for dt in dtb kernel_dtb extra; do
[ -f $dt ] && ./magiskboot dtb $dt patch && ui_print "- Patch fstab in $dt"
if [ -f $dt ]; then
if ! ./magiskboot dtb $dt test; then
ui_print "! Boot image $dt was patched by old (unsupported) Magisk"
abort "! Please try again with *unpatched* boot image"
fi
if ./magiskboot dtb $dt patch; then
ui_print "- Patch fstab in boot image $dt"
fi
fi
done
if [ -f kernel ]; then

BIN
Magisk-v25.2/magisk32 Executable file

Binary file not shown.

BIN
Magisk-v25.2/magisk64 Executable file

Binary file not shown.

BIN
Magisk-v25.2/magiskboot Executable file

Binary file not shown.

BIN
Magisk-v25.2/magiskinit Executable file

Binary file not shown.

View File

@ -2,8 +2,8 @@
# Magisk General Utility Functions
############################################
MAGISK_VER='24.3'
MAGISK_VER_CODE=24300
MAGISK_VER='25.2'
MAGISK_VER_CODE=25200
###################
# Helper Functions
@ -292,6 +292,13 @@ mount_partitions() {
# Allow /system/bin commands (dalvikvm) on Android 10+ in recovery
$BOOTMODE || mount_apex
# Mount sepolicy rules dir locations in recovery (best effort)
if ! $BOOTMODE; then
mount_name "cache cac" /cache
mount_name metadata /metadata
mount_name persist /persist
fi
}
# loop_setup <ext4_img>, sets LOOPDEV
@ -410,7 +417,7 @@ get_flags() {
PATCHVBMETAFLAG=false
else
PATCHVBMETAFLAG=true
ui_print "- Cannot find vbmeta partition, patch vbmeta in boot image"
ui_print "- No vbmeta partition, patch vbmeta in boot image"
fi
fi
[ -z $RECOVERYMODE ] && RECOVERYMODE=false
@ -574,16 +581,13 @@ check_data() {
find_magisk_apk() {
local DBAPK
[ -z $APK ] && APK=$NVBASE/magisk.apk
[ -f $APK ] || APK=$MAGISKBIN/magisk.apk
[ -f $APK ] || APK=/data/app/com.topjohnwu.magisk*/*.apk
[ -f $APK ] || APK=/data/app/*/com.topjohnwu.magisk*/*.apk
[ -z $APK ] && APK=/data/app/com.topjohnwu.magisk*/base.apk
[ -f $APK ] || APK=/data/app/*/com.topjohnwu.magisk*/base.apk
if [ ! -f $APK ]; then
DBAPK=$(magisk --sqlite "SELECT value FROM strings WHERE key='requester'" 2>/dev/null | cut -d= -f2)
[ -z $DBAPK ] && DBAPK=$(strings $NVBASE/magisk.db | grep -oE 'requester..*' | cut -c10-)
[ -z $DBAPK ] || APK=/data/user_de/*/$DBAPK/dyn/*.apk
[ -f $APK ] || [ -z $DBAPK ] || APK=/data/app/$DBAPK*/*.apk
[ -f $APK ] || [ -z $DBAPK ] || APK=/data/app/*/$DBAPK*/*.apk
[ -z $DBAPK ] || APK=/data/user_de/0/$DBAPK/dyn/current.apk
[ -f $APK ] || [ -z $DBAPK ] || APK=/data/data/$DBAPK/dyn/current.apk
fi
[ -f $APK ] || ui_print "! Unable to detect Magisk app APK for BootSigner"
}
@ -651,9 +655,9 @@ copy_sepolicy_rules() {
fi
if [ -d ${RULESDIR%/magisk} ]; then
ui_print "- Sepolicy rules dir is ${RULESDIR%/magisk}"
echo "RULESDIR=$RULESDIR" >&2
else
ui_print "- Sepolicy rules dir ${RULESDIR%/magisk} not found"
ui_print "- Unable to find sepolicy rules dir ${RULESDIR%/magisk}"
return 1
fi
@ -716,6 +720,7 @@ is_legacy_script() {
install_module() {
rm -rf $TMPDIR
mkdir -p $TMPDIR
chcon u:object_r:system_file:s0 $TMPDIR
cd $TMPDIR
setup_flashable
@ -810,7 +815,7 @@ install_module() {
rm -rf \
$MODPATH/system/placeholder $MODPATH/customize.sh \
$MODPATH/README.md $MODPATH/.git*
rmdir -p $MODPATH
rmdir -p $MODPATH 2>/dev/null
cd /
$BOOTMODE || recovery_cleanup
@ -832,7 +837,7 @@ NVBASE=/data/adb
TMPDIR=/dev/tmp
# Bootsigner related stuff
BOOTSIGNERCLASS=com.topjohnwu.signing.SignBoot
BOOTSIGNERCLASS=com.topjohnwu.magisk.signing.SignBoot
BOOTSIGNER='/system/bin/dalvikvm -Xnoimage-dex2oat -cp $APK $BOOTSIGNERCLASS'
BOOTSIGNED=false

View File

@ -6,7 +6,7 @@ It has been made to run on Linux x86 or x64 and patch a boot image for an ARM de
It detects LineageOS **for microG** version via adb, download the ROM, extracts `payload.bin` and dumps `boot.img`, patches it with Magisk, and flashes it.
:warning: **This has only been tested on a FP3 device, at the time of writing with LineageOS for microG 18.1 (March 17, 2022 build) Magisk v24.3** :warning:
:warning: **This has only been tested on a FP3 device, at the time of writing with LineageOS for microG 19.1 (August 23, 2022 build) Magisk v25.2** :warning:
## Run on an other device
@ -55,7 +55,7 @@ Run `python magisk_boot_flasher.py`.
That's how we can run Magisk's `boot_patch.sh` on Linux x86 or x64 and patch a boot image for an ARM device
> Tested with Magisk v24.3 with FP3
> Tested with Magisk v25.2 with FP3
* Get Magisk `.apk`
* Extract it
@ -78,4 +78,3 @@ You can now run:
`sh boot_patch.sh boot.img`
The outpout file `new-boot.img` has the exact same sha256 hash as the `magisk_patched-*.img`, so we can consider it works :)

View File

@ -7,7 +7,7 @@ import subprocess
import time
device = 'FP3'
magiskdir = 'Magisk-v24.3'
magiskdir = 'Magisk-v25.2'
def yes_or_no(question, default=None):
@ -119,10 +119,15 @@ def rebootToBootloader():
def flashBoot():
'''
currentSlot = getCurrentSlot()
cmd = ['fastboot', 'flash', f'boot_{currentSlot}',
f'{magiskdir}/new-boot.img']
subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
'''
for slot in 'ab':
cmd = ['fastboot', 'flash', f'boot_{slot}',
f'{magiskdir}/new-boot.img']
subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
def getCurrentSlot():