[RECOVERY][OFFICIAL] TWRP for Galaxy A40 [A405FN]

Search This thread

ponces

Senior Member
Jun 9, 2011
196
130
Porto
github.com
Samsung Galaxy A40
Team Win Recovery Project 3.5.1
TWRP-Feature-Image-810x298_c.png


Special Notes:
  1. DON'T FORGET TO ENABLE "OEM UNLOCK" (located in Developers options)
  2. KNOX will be tripped once you flash custom binaries to your phone. Your warranty may be voided. However this may not affect you if your country forces Samsung to provide hardware warranty regardless of software status
  3. Samsung Firmware OTA (aka System Updates) will no longer work once you flash custom binaries. You can flash custom ROMs if you want to keep the OS up-to-date
  4. All apps that use KNOX like Samsung Pay, Secure Folder and maybe more will no longer work
Download:
Changelog:
  • 03.05.2020
    • Rebased kernel source to BTB8
  • 25.04.2020
    • Rebased kernel source to ATA4
    • MTP has been fixed!! Builds are now splitted into AOSP and Samsung. Choose yours based on the type of ROM you use for MTP to work properly
  • 07.12.2019
    • Initial Release
Guide:
  • If you already have a custom recovery installed:
    1. Boot to your custom recovery
    2. Flash the recovery image
  • If you are starting from scratch:
    1. Go to Developer Settings and enable "OEM Unlock" option
    2. Power off the device and boot in download mode
    3. In download mode, you will see the long press and volume up option to unlock the bootloader
    4. Unlock the bootloader. That will wipe your device so be sure you made a backup of your data
    5. After bootloader unlock, boot up the phone and make sure it is connected to the internet or it will trigger rmm prenormal
    6. Setup the phone without google account and others
    7. Reboot in download mode and flash the recovery and vbmeta images
    8. Boot to TWRP
    9. Format data in TWRP
    10. Flash the Multidisabler zip
    11. Now you can reboot
XDA:DevDB Information
Team Win Recovery Project, Tool/Utility for the Samsung Galaxy A Series

Contributors
ponces, geiti94, ianmacd
Source Code: https://github.com/TeamWin/android_device_samsung_a40
Kernel Source Code: https://github.com/ponces/android_kernel_samsung_universal7904

Version Information
Status:
Stable

Created 2019-12-26
Last Updated 2021-03-19
 
Last edited:

bishsop

New member
Dec 29, 2019
1
0
I'm really tempted to flash this TWRP and root my A40. Though I know Android 10 has been announced (at least in my region) for April 2020. Should I wait until then? My main concern is, if i flash it now, how easy will it be to upgrade to Android 10 then?
The only real thing I use root privileges for is to remove bloatware completely and edit the hosts file, so I can wait a few months. Also what about dm-verity? Are there any problems there?
 

ponces

Senior Member
Jun 9, 2011
196
130
Porto
github.com
Samsung Galaxy A40
I'm really tempted to flash this TWRP and root my A40. Though I know Android 10 has been announced (at least in my region) for April 2020. Should I wait until then? My main concern is, if i flash it now, how easy will it be to upgrade to Android 10 then?
The only real thing I use root privileges for is to remove bloatware completely and edit the hosts file, so I can wait a few months. Also what about dm-verity? Are there any problems there?

The choice of waiting is only yours.
In my case I need this as I'm using a custom Treble ROM and not Samsung's firmware.

The ease to upgrade to Android 10 relies only on the your expertise on how to flash the original firmware using ODIN.
At the time of the upgrade you need to use ODIN to flash an original firmware from Android 9 to be able to fully restore the original behavior and flash Android 10.

As far as I'm concerned, DM-Verity is related with both DT and DTBO partitions and those partitions are not even touched during this process.
The ones that are changed are BOOT, RECOVERY and VBMETA to disable a few security procedures from Samsung to be able to flash and boot custom binaries.
Because of this, take in consideration the "Special Notes" section in the first post.

Nevertheless, if the need of changing the hosts file is to block ads, you can reach the same goal by using the "Private DNS" feature introduced in Android 9 as explained here.
 

ponces

Senior Member
Jun 9, 2011
196
130
Porto
github.com
Samsung Galaxy A40
My question and can I use this recovery on ITV-A405FNXXU2ASK2-20191218161204?

As you can see in the first post, this TWRP version is for the firmware A405FNXXU2ASJ1 (October's update).
I am still waiting for Samsung to drop A405FNXXU2ASK2 (December's update) sources here to update TWRP.
I'll keep you posted when the sources drop and work on TWRP update begins.
 
  • Like
Reactions: costa11

costa11

Senior Member
Oct 4, 2013
61
3
As you can see in the first post, this TWRP version is for the firmware A405FNXXU2ASJ1 (October's update).
I am still waiting for Samsung to drop A405FNXXU2ASK2 (December's update) sources here to update TWRP.
I'll keep you posted when the sources drop and work on TWRP update begins.
So I tried to install this recovery on the ASK2 firmware and it worked, there is only one problem when it goes down the brightness does not return anymore remains low! Then another thing I rooted with Magisk is it's not working, come up with an error and then I'll try to take a screenshot!
 
Last edited:
  • Like
Reactions: ponces

fredapied

Senior Member
Sep 28, 2010
64
0
thank you again for your job
i just updated my rom to the SK2 (downloaded the rom, flashed it with Odin)
then installed you twrp (the SJ1 is OK)
then flashed with magisk manager the boot.img to Root the Rom
and then flashed the param.bin with a better boot logo

thank you so much for your job !!
 

ruffyrisco

Senior Member
Mar 16, 2018
52
13
Then another thing I rooted with Magisk is it's not working, come up with an error and then I'll try to take a screenshot!

Magisk-Root is working for me.

I did this:

  • [*]Backup of ASJ1 with TWRP
    [*]Complete odin flash of ASK1
    [*]TWRP - ASJ1 - Version
    [*]direct reboot into TWRP
    [*]Format Data
    [*]Flash Multidisabler
    [*]Full Boot
    [*]Install Magisk.APK from sd-card
    [*]Reboot into TWRP
    [*]Flash Magisk
    [*]Full boot to check of root access => ok
    [*]Reboot into TWRP
    [*]Restore of ASJ1-Data

Everything working!
:D
 
Last edited:
  • Like
Reactions: ponces

Leak.dll

New member
Aug 23, 2018
4
0
i have a big problem about twrp on my phone
I have followed this thread
But when i flash twrp (i have uncheck "reboot" on odin of course) i can't get access to the recovery mode, when i do power button + volume up it doesn't do nothing and show this :
https___i-postimg-cc_907fjwgk_booting-warning-jpg.5459

orig_svb_orange-jpg.5460

(I have already unlock my boot loader)
I think its DM VERITY who block the access to recovery mode but i can't disable this, cause i can't get access to twrp :/
Thanks for any answers c:
 

ruffyrisco

Senior Member
Mar 16, 2018
52
13
Thanks for the recovery, is working fine with latest ITV (Italian no brand) firmware, to have root is only simple necessary to flash latest Magisk ZIP via twrp (https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445) :)

Can confirm it works with ATA4 (region DBT). Same procedure my post above. With restoring Data as last step there isn't anything lost as well... :good:
Be sure to enable usb debugging after flash of new firmware. Otherwise TWRP flash would fail...

:good:
 

Kamikadse

New member
Feb 25, 2020
2
1
i have a big problem about twrp on my phone
I have followed this thread
But when i flash twrp (i have uncheck "reboot" on odin of course) i can't get access to the recovery mode, when i do power button + volume up it doesn't do nothing and show this :
...
(I have already unlock my boot loader)
I think its DM VERITY who block the access to recovery mode but i can't disable this, cause i can't get access to twrp :/
Thanks for any answers c:


I had some similar problem.
It was a wrong TWRP, I had to try 3 different ones until it finally worked (the one for AJ1 worked for me).
If you are in a bootloop you still can press Volume UP + DOWN and at the same time put the USB cable in when booting. This should set your phone into the download mode and you can flash TWRP or OS again.
 
  • Like
Reactions: fosfatina

xorly

New member
Sep 27, 2013
4
1
Has anyone tried this TWRP build with ATB1 February patch version? It has increased BL version (2->3) so it is not possible to roll back to any older FW...
 

ruffyrisco

Senior Member
Mar 16, 2018
52
13
From my information ATB1 is still the same security patch level as ATA4.

General question: How can I judge the BL version of the firmware?
 

xorly

New member
Sep 27, 2013
4
1
From my information ATB1 is still the same security patch level as ATA4.

General question: How can I judge the BL version of the firmware?

Well, my info comes from samfw.com/firmware/SM-A405FN/TMZ, not sure how do they extract it.

both ATB1 - samfw.com/firmware/SM-A405FN/TMZ/A405FNXXS3ATB1 and ATA4 - samfw.com/firmware/SM-A405FN/XEZ/A405FNXXU3ATA4 seems like BL (or some OTP bits, I am noob with android internals) bumped from 2 to 3.

(sorry about URL formatting, as a XDA newbie, I am no allowed to post URLs)
 

ruffyrisco

Senior Member
Mar 16, 2018
52
13
both ATB1 - samfw.com/firmware/SM-A405FN/TMZ/A405FNXXS3ATB1 and ATA4 - samfw.com/firmware/SM-A405FN/XEZ/A405FNXXU3ATA4 seems like BL (or some OTP bits, I am noob with android internals) bumped from 2 to 3.

As I mentioned earlier ATA4 firmware works fine with TRWP.
But I'm not sure if ATA4 has BL 3.

Does the digit 10 in the firmware number represents the BL?
 

xorly

New member
Sep 27, 2013
4
1
But I'm not sure if ATA4 has BL 3.
Then reboot into Download mode (you have to do it manually, not via ADB command) and look into top left corner. On ATB1, one of last lines says
Code:
AP SWREV B:3 K:3 S:3
I assume that some fo those numbers (B?) is OTP number set by BL version.


Does the digit 10 in the firmware number represents the BL?
I am not sure which *10* do you mean. It looks like version prefix is bootloader version, number 3 in A405FNXXS3ATB1 or number 2 in A405FNXXU2ASK2. It is the only number which seems to corellate with BL version.

Also, now I can confirm that that this TWRP build (based on A405FNXXU2ASJ1) works with ATB1 firmware! (february sec. patch) Successfuly tested with Phhussons Android 10 GSI quack v213.
 
  • Like
Reactions: Val3r10

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    Team Win Recovery Project 3.5.1
    TWRP-Feature-Image-810x298_c.png


    Special Notes:
    1. DON'T FORGET TO ENABLE "OEM UNLOCK" (located in Developers options)
    2. KNOX will be tripped once you flash custom binaries to your phone. Your warranty may be voided. However this may not affect you if your country forces Samsung to provide hardware warranty regardless of software status
    3. Samsung Firmware OTA (aka System Updates) will no longer work once you flash custom binaries. You can flash custom ROMs if you want to keep the OS up-to-date
    4. All apps that use KNOX like Samsung Pay, Secure Folder and maybe more will no longer work
    Download:
    Changelog:
    • 03.05.2020
      • Rebased kernel source to BTB8
    • 25.04.2020
      • Rebased kernel source to ATA4
      • MTP has been fixed!! Builds are now splitted into AOSP and Samsung. Choose yours based on the type of ROM you use for MTP to work properly
    • 07.12.2019
      • Initial Release
    Guide:
    • If you already have a custom recovery installed:
      1. Boot to your custom recovery
      2. Flash the recovery image
    • If you are starting from scratch:
      1. Go to Developer Settings and enable "OEM Unlock" option
      2. Power off the device and boot in download mode
      3. In download mode, you will see the long press and volume up option to unlock the bootloader
      4. Unlock the bootloader. That will wipe your device so be sure you made a backup of your data
      5. After bootloader unlock, boot up the phone and make sure it is connected to the internet or it will trigger rmm prenormal
      6. Setup the phone without google account and others
      7. Reboot in download mode and flash the recovery and vbmeta images
      8. Boot to TWRP
      9. Format data in TWRP
      10. Flash the Multidisabler zip
      11. Now you can reboot
    XDA:DevDB Information
    Team Win Recovery Project, Tool/Utility for the Samsung Galaxy A Series

    Contributors
    ponces, geiti94, ianmacd
    Source Code: https://github.com/TeamWin/android_device_samsung_a40
    Kernel Source Code: https://github.com/ponces/android_kernel_samsung_universal7904

    Version Information
    Status:
    Stable

    Created 2019-12-26
    Last Updated 2021-03-19
    5
    Good news everyone!
    I finally have a working build with a proper fix!

    I was so wrong and this all hapened because Samsung has decided to finally fix in their firmware files the name of the SoC that our devices has. So, due to this, exynos7885 is no longer mentioned but instead it is exynos7904. This name change affected some filenames in the kernel, boot and recovery. One of the examples is the fstab as @tys0n correctly mentioned. The file that exports the ANDROID_ROOT variable was also affected and this was the main problem.

    Go grab the new builds in the OP! The Multidisabler zip is also fixed as now we will be using ianmacd's version.
    3
    Just to let you all know that we now have official builds of TWRP !! :D
    2
    I'm really tempted to flash this TWRP and root my A40. Though I know Android 10 has been announced (at least in my region) for April 2020. Should I wait until then? My main concern is, if i flash it now, how easy will it be to upgrade to Android 10 then?
    The only real thing I use root privileges for is to remove bloatware completely and edit the hosts file, so I can wait a few months. Also what about dm-verity? Are there any problems there?

    The choice of waiting is only yours.
    In my case I need this as I'm using a custom Treble ROM and not Samsung's firmware.

    The ease to upgrade to Android 10 relies only on the your expertise on how to flash the original firmware using ODIN.
    At the time of the upgrade you need to use ODIN to flash an original firmware from Android 9 to be able to fully restore the original behavior and flash Android 10.

    As far as I'm concerned, DM-Verity is related with both DT and DTBO partitions and those partitions are not even touched during this process.
    The ones that are changed are BOOT, RECOVERY and VBMETA to disable a few security procedures from Samsung to be able to flash and boot custom binaries.
    Because of this, take in consideration the "Special Notes" section in the first post.

    Nevertheless, if the need of changing the hosts file is to block ads, you can reach the same goal by using the "Private DNS" feature introduced in Android 9 as explained here.
    2
    I'm stuck in this mode too! I unlocked the bootloader and then flashed TWRP without reboot in Odin.
    After that, I tried to start the phone in recovery mode but it's stuck in that mode, just rebooting.
    I didn't know that TWRP doesn't support the *3BTC4 firmware. I've downloaded the *3BTB7 firmware, but I can't get the phone in download mode.

    What to do? I had to wait 'til the battery ran out, I then tried to enter download mode with volume up but nothing! Volume up + down doesn't do anything either.

    usb cable must be connected to PC (not to A40)
    then hold vol up, vol down and power button for 10sec
    when display turns into black you have to be fast:
    leave power button, hold vol up and vol down again
    and put usb cable into your A40
    you must do this in 1-2 seconds!
    that brings you back to download mode

    greetings