[Samsung Galaxy M40 Guides, News, & Discussion] rohitrss:
We got our first recovery for Samsung M40 (SM-M405F). This one is ported using Samsung Auto TWRP recovery porter by Team Hovatek

Please try and let everyone know if it works for you or not.

(If you want to do it yourself for any other Android OS version, you can refer to the original Hovatek post.)

You must disable dm_verity before flashing TWRP.

TWRP based on version: 3.5.*

Details of base recovery used for porting:

Source: Extracted from downloaded firmware

Version: Android 11

Build Date: Mon, 12 Apr 2021 07:54:43 +0000

Security Patch Level: 2021-04-01

Product code: INS

PDA: M405FDDU2CUD2

CSC: M405FODM2CUD2

If this works for you, please post here so everyone will know.

If something goes wrong you need and any stock img/file let me know, I will share that too.

Update 1 =>

NOTE: Unfortunately, I can not test this recovery for few more days as this M40 is the only device that I have and it is also source of internet access for me and my laptop. If this mobile is turned off for any reason I wont have internet access so looking for fixes would be difficult.

But I have rooted some devices before and know how things work so I will help in every possible way if someone stuck at any place while trying this recovery.

Also, if someone confirms this recovery does not work, I am planning to port TWRP from scratch.

Update 2 =>

Instructions for NON-Rooted and Bootloader locked device-

Unlocking Bootloader:

Allow bootloader unlocking in Developer options → OEM unlocking

Reboot to download mode: power off your device and press Volume Up + Volume Down and plug in your device to a PC to boot into download mode.

Long press volume up to unlock the bootloader. This will wipe your data and automatically reboot.

Go through the initial setup. Skip through all the steps since data will be wiped again in later steps. Connect the device to Internet during the setup.

Enable developer options, and confirm that the OEM unlocking option exists and is grayed out. This means the VaultKeeper service has unleashed the bootloader.

Your bootloader now accepts unofficial images in download mode

Disable DM_Verity (Android Verified Boot):

Copy the vbmeta.img (download from attachments) into your adb and fastboot folder

You can now flash the vbmeta.img using fastboot to remove dm_verity from your device

// Enable USB Debugging and enter following commands in CMD/Terminal after connecting device to computer.

adb devices

// You should see your device listed

adb reboot-bootloader

// Device should reboot to bootloader

fastboot devices

// You should see your device listed

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

// OR if the command above doesn't work, try below

fastboot flash vbmeta vbmeta.img

// DONE

////////////////////////////////++++++++++++++++++++++++++////////////////////////////////

Note: For Magisk Rooted devices above steps are not required, as Magisk already patches vbmeta.img and disabled dm_verity (Android Verified Boot)

Flash TWRP with/without Root using Odin

1. Download and install Odin on your PC

2. Download the attached recovery.img, convert it into .tar

3. Reboot to download mode: power off your device and press Volume Up + Volume Down and plug in your device to a PC to boot into download mode.

4. Select recovery.tar under AP_ and Uncheck “Auto Reboot” in Options!

5. Flash the device

6. Now do not power on to System, enter into Recovery/TWRP mode using key combination.

Once TWRP is booted, TWRP will patch the stock ROM to prevent the stock ROM from replacing TWRP. If you don't follow this step, you will have to repeat the install.

*DONE*

Enjoy TWRP!