[Galaxy S 4 i9505 Original Android Development] haoyangw:
Since Magisk has already been updated to v15.3, but the previous guide on patching Magisk for DualBoot Patcher has not been updated yet(quite a few changes has been made from my observations), here's an updated guide on how to manually patch Magisk zips to support DualBoot Patcher! I've tested the patched Magisk v15.3 on Android 8.1 and root at least works properly(not sure about modules, didn't have time to test that).

diff -bur Magisk-v15.3_data-slot-1/META-INF/com/google/android/updater-script DBP_Magisk-v15.3_data-slot-1/META-INF/com/google/android/updater-script
--- Magisk-v15.3_data-slot-1/META-INF/com/google/android/updater-script	2018-01-18 20:22:58.000000000 +0800
+++ DBP_Magisk-v15.3_data-slot-1/META-INF/com/google/android/updater-script	2018-01-18 20:07:28.000000000 +0800
@@ -45,7 +45,7 @@
ui_print "* Magisk v$MAGISK_VER Installer"
ui_print "************************"

-is_mounted /data || mount /data || is_mounted /cache || mount /cache || abort "! Unable to mount partitions"
+is_mounted /data || /update-binary-tool mount /data || is_mounted /cache || /update-binary-tool mount /cache || abort "! Unable to mount partitions"
mount_partitions

# read override variables
@@ -93,7 +93,7 @@
# addon.d
if [ -d /system/addon.d ]; then
ui_print "- Adding addon.d survival script"
- mount -o rw,remount /system
+ #mount -o rw,remount /system
cp -af $INSTALLER/addon.d/99-magisk.sh /system/addon.d/99-magisk.sh
chmod 755 /system/addon.d/99-magisk.sh
fi
diff -bur Magisk-v15.3_data-slot-1/common/util_functions.sh DBP_Magisk-v15.3_data-slot-1/common/util_functions.sh
--- Magisk-v15.3_data-slot-1/common/util_functions.sh	2008-02-29 10:33:46.000000000 +0800
+++ DBP_Magisk-v15.3_data-slot-1/common/util_functions.sh	2018-01-18 19:34:55.000000000 +0800
@@ -60,10 +60,12 @@
[ -z $SLOT ] || ui_print "- A/B partition detected, current slot: $SLOT"

ui_print "- Mounting /system, /vendor"
- is_mounted /system || [ -f /system/build.prop ] || mount -o ro /system 2>/dev/null
+ #is_mounted /system || [ -f /system/build.prop ] || mount -o ro /system 2>/dev/null
+ is_mounted /system || [ -f /system/build.prop ] || /update-binary-tool mount /system 2>/dev/null
if ! is_mounted /system && ! [ -f /system/build.prop ]; then
SYSTEMBLOCK=`find /dev/block -iname system$SLOT | head -n 1`
- mount -t ext4 -o ro $SYSTEMBLOCK /system
+ #mount -t ext4 -o ro $SYSTEMBLOCK /system
+	/update-binary-tool mount /system
fi
is_mounted /system || [ -f /system/build.prop ] || abort "! Cannot mount /system"
cat /proc/mounts | grep -E '/dev/root|/system_root' >/dev/null && SKIP_INITRAMFS=true || SKIP_INITRAMFS=false
@@ -241,7 +243,7 @@
remove_system_su() {
if [ -f /system/bin/su -o -f /system/xbin/su ] && [ ! -f /su/bin/su ]; then
ui_print "! System installed root detected, mount rw :("
- mount -o rw,remount /system
+ #mount -o rw,remount /system
# SuperSU
if [ -e /system/bin/.ext/.su ]; then
mv -f /system/bin/app_process32_original /system/bin/app_process32 2>/dev/null
@@ -309,10 +311,12 @@
export LD_LIBRARY_PATH=$OLD_LD_PATH
[ -z $OLD_PATH ] || export PATH=$OLD_PATH
ui_print "- Unmounting partitions"
- umount -l /system_root 2>/dev/null
- umount -l /system 2>/dev/null
+ #umount -l /system_root 2>/dev/null
+ #umount -l /system 2>/dev/null
umount -l /vendor 2>/dev/null
umount -l /dev/random 2>/dev/null
+ /update-binary-tool unmount /system_root 2>/dev/null
+ /update-binary-tool unmount /system 2>/dev/null
}

abort() {

Alternatively, if you don't wish to do the editing yourself, I've patched Magisk v15.3 to support DBP! I've attached it below. Don't worry, I assure I only made changes necessary for DBP, and didn't inject any malicious code. Happy flashing :)

Note: The patched Magisk v15.3 zip attached below has been patched for Axon 7 use, please patch it again using DBP so that you can flash it on your device. Don't worry, there's nothing wrong with re-patching a zip with DBP, I've tried before and haven't seen any bugs/issues.