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 ./magiskboot cpio ramdisk.cpio test
STATUS=$? STATUS=$?
else else
# Stock A only system-as-root # Stock A only legacy SAR, or some Android 13 GKIs
STATUS=0 STATUS=0
fi fi
case $((STATUS & 3)) in case $((STATUS & 3)) in
@ -183,7 +183,15 @@ rm -f ramdisk.cpio.orig config magisk*.xz
################# #################
for dt in dtb kernel_dtb extra; do 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 done
if [ -f kernel ]; then 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 General Utility Functions
############################################ ############################################
MAGISK_VER='24.3' MAGISK_VER='25.2'
MAGISK_VER_CODE=24300 MAGISK_VER_CODE=25200
################### ###################
# Helper Functions # Helper Functions
@ -292,6 +292,13 @@ mount_partitions() {
# Allow /system/bin commands (dalvikvm) on Android 10+ in recovery # Allow /system/bin commands (dalvikvm) on Android 10+ in recovery
$BOOTMODE || mount_apex $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 # loop_setup <ext4_img>, sets LOOPDEV
@ -410,7 +417,7 @@ get_flags() {
PATCHVBMETAFLAG=false PATCHVBMETAFLAG=false
else else
PATCHVBMETAFLAG=true 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
fi fi
[ -z $RECOVERYMODE ] && RECOVERYMODE=false [ -z $RECOVERYMODE ] && RECOVERYMODE=false
@ -574,16 +581,13 @@ check_data() {
find_magisk_apk() { find_magisk_apk() {
local DBAPK local DBAPK
[ -z $APK ] && APK=$NVBASE/magisk.apk [ -z $APK ] && APK=/data/app/com.topjohnwu.magisk*/base.apk
[ -f $APK ] || APK=$MAGISKBIN/magisk.apk [ -f $APK ] || APK=/data/app/*/com.topjohnwu.magisk*/base.apk
[ -f $APK ] || APK=/data/app/com.topjohnwu.magisk*/*.apk
[ -f $APK ] || APK=/data/app/*/com.topjohnwu.magisk*/*.apk
if [ ! -f $APK ]; then if [ ! -f $APK ]; then
DBAPK=$(magisk --sqlite "SELECT value FROM strings WHERE key='requester'" 2>/dev/null | cut -d= -f2) 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 ] && DBAPK=$(strings $NVBASE/magisk.db | grep -oE 'requester..*' | cut -c10-)
[ -z $DBAPK ] || APK=/data/user_de/*/$DBAPK/dyn/*.apk [ -z $DBAPK ] || APK=/data/user_de/0/$DBAPK/dyn/current.apk
[ -f $APK ] || [ -z $DBAPK ] || APK=/data/app/$DBAPK*/*.apk [ -f $APK ] || [ -z $DBAPK ] || APK=/data/data/$DBAPK/dyn/current.apk
[ -f $APK ] || [ -z $DBAPK ] || APK=/data/app/*/$DBAPK*/*.apk
fi fi
[ -f $APK ] || ui_print "! Unable to detect Magisk app APK for BootSigner" [ -f $APK ] || ui_print "! Unable to detect Magisk app APK for BootSigner"
} }
@ -651,9 +655,9 @@ copy_sepolicy_rules() {
fi fi
if [ -d ${RULESDIR%/magisk} ]; then if [ -d ${RULESDIR%/magisk} ]; then
ui_print "- Sepolicy rules dir is ${RULESDIR%/magisk}" echo "RULESDIR=$RULESDIR" >&2
else else
ui_print "- Sepolicy rules dir ${RULESDIR%/magisk} not found" ui_print "- Unable to find sepolicy rules dir ${RULESDIR%/magisk}"
return 1 return 1
fi fi
@ -716,6 +720,7 @@ is_legacy_script() {
install_module() { install_module() {
rm -rf $TMPDIR rm -rf $TMPDIR
mkdir -p $TMPDIR mkdir -p $TMPDIR
chcon u:object_r:system_file:s0 $TMPDIR
cd $TMPDIR cd $TMPDIR
setup_flashable setup_flashable
@ -810,7 +815,7 @@ install_module() {
rm -rf \ rm -rf \
$MODPATH/system/placeholder $MODPATH/customize.sh \ $MODPATH/system/placeholder $MODPATH/customize.sh \
$MODPATH/README.md $MODPATH/.git* $MODPATH/README.md $MODPATH/.git*
rmdir -p $MODPATH rmdir -p $MODPATH 2>/dev/null
cd / cd /
$BOOTMODE || recovery_cleanup $BOOTMODE || recovery_cleanup
@ -832,7 +837,7 @@ NVBASE=/data/adb
TMPDIR=/dev/tmp TMPDIR=/dev/tmp
# Bootsigner related stuff # Bootsigner related stuff
BOOTSIGNERCLASS=com.topjohnwu.signing.SignBoot BOOTSIGNERCLASS=com.topjohnwu.magisk.signing.SignBoot
BOOTSIGNER='/system/bin/dalvikvm -Xnoimage-dex2oat -cp $APK $BOOTSIGNERCLASS' BOOTSIGNER='/system/bin/dalvikvm -Xnoimage-dex2oat -cp $APK $BOOTSIGNERCLASS'
BOOTSIGNED=false 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. 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 ## 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 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` * Get Magisk `.apk`
* Extract it * Extract it
@ -78,4 +78,3 @@ You can now run:
`sh boot_patch.sh boot.img` `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 :) 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 import time
device = 'FP3' device = 'FP3'
magiskdir = 'Magisk-v24.3' magiskdir = 'Magisk-v25.2'
def yes_or_no(question, default=None): def yes_or_no(question, default=None):
@ -119,9 +119,14 @@ def rebootToBootloader():
def flashBoot(): def flashBoot():
'''
currentSlot = getCurrentSlot() currentSlot = getCurrentSlot()
cmd = ['fastboot', 'flash', f'boot_{currentSlot}', cmd = ['fastboot', 'flash', f'boot_{currentSlot}',
f'{magiskdir}/new-boot.img'] f'{magiskdir}/new-boot.img']
'''
for slot in 'ab':
cmd = ['fastboot', 'flash', f'boot_{slot}',
f'{magiskdir}/new-boot.img']
subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)