[RECOVERY][UNOFFICIAL][3.5.2] TWRP for Galaxy M31

Search This thread

soulr344

Senior Member
Apr 4, 2019
61
580
Ae08b8N.png
Disclaimer:
I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed.
Please do some research if you have any concerns about features included in this recovery before flashing it!
YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
Kernel Features:
  • latest kernel source release
  • disabled security stuff/knox/proca/logging/audit/useless features
Recovery Features:
  • TWRP 3.5.2, Android 10
  • Built in 64-bit mode
  • Super partition support
  • Added custom super binary to help with managing super partitions ( more on that in post #3 )
  • Native rw mount dynamic partitions
  • Native GSI flashing
  • Native dynamic partitions resize/wipe/backup/restore
  • Working MTP and ADB only!
How to install?
Prerequisites: Samsung USB drivers, Odin v3.14.1
  1. Make sure OEM Unlock is ON in developer settings;
  2. Turn off the phone;
  3. Press the volume down + volume up button whilst the phone is connected to a pc to boot in download mode;;
  4. Long press vol up then confirm you want to unlock bootloader (this is needed one time only);
    * Please be aware all your data will be erased including internal storage and phone will reboot!!
  5. Let the phone boot normally, pass the setup and connect to internet (wireless or mobile data) in order to unlock RMM;
  6. Make sure OEM Unlock is ON in developer settings;
  7. Turn off the phone;
  8. Use vol down + bixby key + usb cable plugged to a pc to start the phone in download mode, short press vol up to confirm you want to go to download mode;
    * If by any chance you see RMM state=Prenormal or KG state=Prenormal, factory reset data and redo from step 5!
  9. Download TWRP.tar from download link below;
  10. Open odin and place the TWRP.tar file in AP slot and press start. Once you press start, keep holding power and volume up button and the device will reboot to recovery mode.
  11. * If you're coming from stock, go to "Wipe" > ""Format Data" > type "yes" to format data. If you skip this Internal storage won't work in TWRP
  12. Flash the encryption_disabler.zip from the link below to disable internal storage encryption and patch stock recovery restoration.
  13. Additionally, flash TWRP_Bootlogo_patcher to patch warning screens when booting the device.
  14. If you want to root, flash Magisk.
  • If you're coming from other TWRP versions, download TWRP.img, reboot to recovery, tap Install > Install Image > Navigate to downloads folder > select TWRP.img > Select Recovery and swipe to confirm flash. Go to reboot and reboot to recovery and the changes will have taken place.

Downloads:

Sources:
Device Tree: https://github.com/soulr344/android_device_samsung_m31
Kernel Source: https://github.com/soulr344/android_kernel_samsung_m21nsxx/tree/prebuilt
TWRP Source: https://github.com/soulr344/android_bootable_recovery/commits/android-10.0

Credits:
  • TeamWin, corsicanu, ananjaser1211, jesec, epicX67, exynos-nigg, testers and anyone else who made this possible.
 
Last edited:

soulr344

Senior Member
Apr 4, 2019
61
580
FAQ
Q: TWRP can't mount data partition, what to do?
A: Make sure you formatted data partition.

Q: Phone is not booting even after 20 minutes
A: Try to reboot. If still not booting, make sure you flashed encryption disabler zip / formatted data partition.

Q: How to format data partition?
A:

ymlnQUE.jpg




Q: Phone is showing only Samsung logo
A: Try to reboot. If still not booting, consider installing a more recent firmware. If you still don't succeed, post here some details about your device and previous firmware and we might be able to help.

Q: Why do i need to format data partition?
A: Because old firmware encrypted your data partition and new rom can't decrypt and use that content / root needs access to data partition to place misc files / phone not booting after flashing root until data partition gets formatted.

Q: I can't flash anything with TWRP. Internal Storage has some random folders with weird name.
A: Format Data and flash encryption disabler.
 

soulr344

Senior Member
Apr 4, 2019
61
580
Info about custom super partition helper binary. (Irrelevant because of native logical partitions but yeah, its present)

It's meant to help with managing partitions inside the super partition itself. It has some functions built in like mount, unmount, flash and format. Here is a brief rundown on what each of them do.

Partitions that are supported are:
system, system_root, vendor, odm, product
Please note that system_root is an alias of system and umount is an alias of unmount.
All of these commands are runnable through TWRP Terminal ONLY!

Code:
 super mount partition

This will mount partition in rw mode in mountpoint in fstab.

Code:
 super unmount[or umount] partition

This command will unmount given partition and make it read only.

Code:
 super format partition
This command will format given partition as ext4 inside super partition.

Code:
 super flash partition /path/to/image.img
Flashes image.img to partition.
You can also flash GSI (Generic System Image) using this command. Simply run:
Code:
super flash system /path/to/gsi.img


For Custom ROM Developers:

You can use this as an alternative to mount/format/unmount partitions that are inside super partition normally.
Code:
run_program("/sbin/super", "format", "system");  # formats system
run_program("/sbin/super", "mount", "system");   # mounts system as rw
run_program("/sbin/super", "unmount", "system"); # unmounts system and makes it ro
 

Karen3443

New member
Apr 10, 2021
1
1
Hello there,
I followed all steps and in the end ended up having with the device only showing the Samsung logo after I flashed magisk (magisk version here: https://magisk.me/zip/). I had a 64gb version of the SM-M315 running the latest android 11 version provided by samsung (current date: 10.04.2021). I have not yet managed to escape the bootloop, veen when trying to restart the warnings appear and then the samsung logo displays. I have made a pre-root version backup, but have not yet managed to return to the recovery.

Edit: I am aware that I have might bricked my device and just wanted to ask if there is anything that I could do just in the case that my assumption is wrong.
 
Last edited:
  • Like
Reactions: Al765436

soulr344

Senior Member
Apr 4, 2019
61
580
Hello there,
I followed all steps and in the end ended up having with the device only showing the Samsung logo after I flashed magisk (magisk version here: https://magisk.me/zip/). I had a 64gb version of the SM-M315 running the latest android 11 version provided by samsung (current date: 10.04.2021). I have not yet managed to escape the bootloop, veen when trying to restart the warnings appear and then the samsung logo displays. I have made a pre-root version backup, but have not yet managed to return to the recovery.

Edit: I am aware that I have might bricked my device and just wanted to ask if there is anything that I could do just in the case that my assumption is wrong.

nope, you havent bricked. start by flashing stock rom again, the flash twrp, AND BE SURE to flash encryption disabler and format data. thats all and it should boot. if you skip encryption dissabler, then the stock recovery will auto restore itself(which seems your case)
 

drcarlox

Member
Apr 16, 2021
8
2
if i do this:
11* If you're coming from stock, go to "Wipe" > ""Format Data" > type "yes" to format data. If you skip this Internal storage won't work in TWRP
will i lose my data? because i dont have sd card so if i lose my data i wont be able to do the next steps.
 
  • Like
Reactions: Al765436

Ahamadmusa

Member
Sep 21, 2014
9
0
Thanks. I successfully installed twrp and rooted my phone. I also successfully installed Encryption Disabler. But, unfortunately couldn't install TWRP_Bootlogo_patcher. Every time I try to flash it, it always ended with Error: 1, showing “device is not compatible.”
I am on latest one UI 3.1, which released just yesterday. Is this happening as my rom is too latest for ur supplied zip file? Hope, u will answer soon. Thanks again.

NB: I already formatted data by typing “yes”.
 
Last edited:

soulr344

Senior Member
Apr 4, 2019
61
580
Thanks. I successfully installed twrp and rooted my phone. I also successfully installed Encryption Disabler. But, unfortunately couldn't install TWRP_Bootlogo_patcher. Every time I try to flash it, it always ended with Error: 1, showing “device is not compatible.”
I am on latest one UI 3.1, which released just yesterday. Is this happening as my rom is too latest for ur supplied zip file? Hope, u will answer soon. Thanks again.

NB: I already formatted data by typing “yes”.
tap tag on the github page of bootlogo patcher and download the latest version
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 104
    Ae08b8N.png
    Disclaimer:
    I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed.
    Please do some research if you have any concerns about features included in this recovery before flashing it!
    YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
    Kernel Features:
    • latest kernel source release
    • disabled security stuff/knox/proca/logging/audit/useless features
    Recovery Features:
    • TWRP 3.5.2, Android 10
    • Built in 64-bit mode
    • Super partition support
    • Added custom super binary to help with managing super partitions ( more on that in post #3 )
    • Native rw mount dynamic partitions
    • Native GSI flashing
    • Native dynamic partitions resize/wipe/backup/restore
    • Working MTP and ADB only!
    How to install?
    Prerequisites: Samsung USB drivers, Odin v3.14.1
    1. Make sure OEM Unlock is ON in developer settings;
    2. Turn off the phone;
    3. Press the volume down + volume up button whilst the phone is connected to a pc to boot in download mode;;
    4. Long press vol up then confirm you want to unlock bootloader (this is needed one time only);
      * Please be aware all your data will be erased including internal storage and phone will reboot!!
    5. Let the phone boot normally, pass the setup and connect to internet (wireless or mobile data) in order to unlock RMM;
    6. Make sure OEM Unlock is ON in developer settings;
    7. Turn off the phone;
    8. Use vol down + bixby key + usb cable plugged to a pc to start the phone in download mode, short press vol up to confirm you want to go to download mode;
      * If by any chance you see RMM state=Prenormal or KG state=Prenormal, factory reset data and redo from step 5!
    9. Download TWRP.tar from download link below;
    10. Open odin and place the TWRP.tar file in AP slot and press start. Once you press start, keep holding power and volume up button and the device will reboot to recovery mode.
    11. * If you're coming from stock, go to "Wipe" > ""Format Data" > type "yes" to format data. If you skip this Internal storage won't work in TWRP
    12. Flash the encryption_disabler.zip from the link below to disable internal storage encryption and patch stock recovery restoration.
    13. Additionally, flash TWRP_Bootlogo_patcher to patch warning screens when booting the device.
    14. If you want to root, flash Magisk.
    • If you're coming from other TWRP versions, download TWRP.img, reboot to recovery, tap Install > Install Image > Navigate to downloads folder > select TWRP.img > Select Recovery and swipe to confirm flash. Go to reboot and reboot to recovery and the changes will have taken place.

    Downloads:

    Sources:
    Device Tree: https://github.com/soulr344/android_device_samsung_m31
    Kernel Source: https://github.com/soulr344/android_kernel_samsung_m21nsxx/tree/prebuilt
    TWRP Source: https://github.com/soulr344/android_bootable_recovery/commits/android-10.0

    Credits:
    • TeamWin, corsicanu, ananjaser1211, jesec, epicX67, exynos-nigg, testers and anyone else who made this possible.
    8
    Info about custom super partition helper binary. (Irrelevant because of native logical partitions but yeah, its present)

    It's meant to help with managing partitions inside the super partition itself. It has some functions built in like mount, unmount, flash and format. Here is a brief rundown on what each of them do.

    Partitions that are supported are:
    system, system_root, vendor, odm, product
    Please note that system_root is an alias of system and umount is an alias of unmount.
    All of these commands are runnable through TWRP Terminal ONLY!

    Code:
     super mount partition

    This will mount partition in rw mode in mountpoint in fstab.

    Code:
     super unmount[or umount] partition

    This command will unmount given partition and make it read only.

    Code:
     super format partition
    This command will format given partition as ext4 inside super partition.

    Code:
     super flash partition /path/to/image.img
    Flashes image.img to partition.
    You can also flash GSI (Generic System Image) using this command. Simply run:
    Code:
    super flash system /path/to/gsi.img


    For Custom ROM Developers:

    You can use this as an alternative to mount/format/unmount partitions that are inside super partition normally.
    Code:
    run_program("/sbin/super", "format", "system");  # formats system
    run_program("/sbin/super", "mount", "system");   # mounts system as rw
    run_program("/sbin/super", "unmount", "system"); # unmounts system and makes it ro
    7
    Changelog:
    v1.0
    • Initial Release
    More in github release page

    MISC LINKS
    Telegram Channel
    Telegram Group
    TeamWin Official Website
    7
    FAQ
    Q: TWRP can't mount data partition, what to do?
    A: Make sure you formatted data partition.

    Q: Phone is not booting even after 20 minutes
    A: Try to reboot. If still not booting, make sure you flashed encryption disabler zip / formatted data partition.

    Q: How to format data partition?
    A:

    ymlnQUE.jpg




    Q: Phone is showing only Samsung logo
    A: Try to reboot. If still not booting, consider installing a more recent firmware. If you still don't succeed, post here some details about your device and previous firmware and we might be able to help.

    Q: Why do i need to format data partition?
    A: Because old firmware encrypted your data partition and new rom can't decrypt and use that content / root needs access to data partition to place misc files / phone not booting after flashing root until data partition gets formatted.

    Q: I can't flash anything with TWRP. Internal Storage has some random folders with weird name.
    A: Format Data and flash encryption disabler.
    3
    Hello there,
    I followed all steps and in the end ended up having with the device only showing the Samsung logo after I flashed magisk (magisk version here: https://magisk.me/zip/). I had a 64gb version of the SM-M315 running the latest android 11 version provided by samsung (current date: 10.04.2021). I have not yet managed to escape the bootloop, veen when trying to restart the warnings appear and then the samsung logo displays. I have made a pre-root version backup, but have not yet managed to return to the recovery.

    Edit: I am aware that I have might bricked my device and just wanted to ask if there is anything that I could do just in the case that my assumption is wrong.

    nope, you havent bricked. start by flashing stock rom again, the flash twrp, AND BE SURE to flash encryption disabler and format data. thats all and it should boot. if you skip encryption dissabler, then the stock recovery will auto restore itself(which seems your case)