Magisk: Certain MTK devices not supported

Created on 4 Jun 2017  路  5Comments  路  Source: topjohnwu/Magisk

Hello, I'd like to request support for another type of MTK boot.img path. The older MTK(MT6572/82/92 MT8127) devices uses /dev/bootimg as the boot path while the newer devices (MT67xx and MT6580) use /dev/block/platform/mtk-msdc.0/11120000.msdc0/by-name/boot

@osm0sis had previously fixed that for me in his AK2 script here : https://github.com/osm0sis/AnyKernel2/commit/c13647eb2ea9cdc46a51e27a74a58b8271edbc6b

It might help in someway.

Below is the scatter file for the device which shows the partitions and mount points.

block

And here is the boot.img: https://www.androidfilehost.com/?fid=673368273298960836

Most helpful comment

I didn't realize people were still looking into this. I will check this out when I have time. Thanks for your efforts.

All 5 comments

The only MTK I've seen that doesn't work with my borrowed omni code is the terrifying implementation in the hongyu72 device. I can't even begin to explain what's going on there. 馃槣

Ok, ignore my previous comment about not being simple xD. I'll check this out (Y). Thanks.

On MT6582 what mitigates the issue is something like this:

--- a/scripts/boot_patch.sh
+++ b/scripts/boot_patch.sh
@@ -50,6 +50,13 @@ fi
 BOOTIMAGE="$1"
 [ -e "$BOOTIMAGE" ] || abort "$BOOTIMAGE does not exist!"

+if [ ! -b "$BOOTIMAGE" ] && which nanddump nandwrite >/dev/null 2>&1; then
+  BOOTIMAGE_FILE="$TMPDIR/boot.img"
+  nanddump -f "$BOOTIMAGE_FILE" "$BOOTIMAGE"
+else
+  BOOTIMAGE_FILE="$BOOTIMAGE"
+fi
+
 # Flags
 [ -z $KEEPVERITY ] && KEEPVERITY=false
 [ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false
@@ -69,7 +76,7 @@ chmod -R 755 .
 CHROMEOS=false

 ui_print "- Unpacking boot image"
-./magiskboot unpack "$BOOTIMAGE"
+./magiskboot unpack "$BOOTIMAGE_FILE"

 case $? in
   1 )
@@ -99,8 +106,8 @@ fi
 case $((STATUS & 3)) in
   0 )  # Stock boot
     ui_print "- Stock boot image detected"
-    SHA1=`./magiskboot sha1 "$BOOTIMAGE" 2>/dev/null`
-    cat $BOOTIMAGE > stock_boot.img
+    SHA1=`./magiskboot sha1 "$BOOTIMAGE_FILE" 2>/dev/null`
+    cat "$BOOTIMAGE_FILE" > stock_boot.img
     cp -af ramdisk.cpio ramdisk.cpio.orig 2>/dev/null
     ;;
   1 )  # Magisk patched
@@ -177,7 +184,7 @@ fi
 ##########################################################################################

 ui_print "- Repacking boot image"
-./magiskboot repack "$BOOTIMAGE" || abort "! Unable to repack boot image!"
+./magiskboot repack "$BOOTIMAGE_FILE" || abort "! Unable to repack boot image!"

 # Sign chromeos boot
 $CHROMEOS && sign_chromeos
--- b/scripts/util_functions.sh
+++ a/scripts/util_functions.sh
@@ -264,7 +264,11 @@ flash_image() {
   else
     CMD2="cat -"
   fi
-  if [ -b "$2" ]; then
+  if [ ! -b "$2" ] && which nanddump nandwrite >/dev/null 2>&1; then
+    nandwrite -p "$2" /dev/zero >/dev/null 2>&1
+    eval $CMD1 | eval $CMD2 | nandwrite -p "$2" >/dev/null
+    [ $? != 0 ] && return 1
+  elif [ -b "$2" ]; then
     local img_sz=`stat -c '%s' "$1"`
     local blk_sz=`blockdev --getsize64 "$2"`
     [ $img_sz -gt $blk_sz ] && return 1

Possibly related: #24, #75, #190, #227.

I didn't realize people were still looking into this. I will check this out when I have time. Thanks for your efforts.

Was this page helpful?
0 / 5 - 0 ratings