Samsung A51

Unlocking the bootloader.

  1. Just in case activate Google Account and Samsung Accounts in the phone in case unlocking failure
  2. In Settings -> Phone info -> Software information -> Build number: press 7 times the option to activate Developer mode
  3. In Settings -> Developer mode:enable OEM Unlock/Desbloqueo OEM and USB Debug/Depuracion USB
  4. Shutdown phone by pressing Power and volume Down, and after that select Power off option.
  5. Press simultaneously volume down and up and then plug usb cable.
  6. Release buttons when Samsung screen apears.
  7. Press short volume up to go into download mode.
  8. Reconfigure and enable again developer mode (1 and 2).
  9. Verify OEM Unlock OEM its grayed out.

Rooting

  1. Install Magisk Manager:
    adb install MagiskManager-v8.0.2.apk
    
  2. Install Samloader
    pip install git+https://github.com/nlscc/samloader.git
    
  3. Get samsung last update. At the time of this writing it works to me with this one. Unpack Firmware -> AP_* -> boot.img
    samloader -m SM-A515F -r PSN checkupdate
    A515FXXU3BTI2/A515FOWB3BTH3/A515FXXU3BTH5/A515FXXU3BTI2
    samloader -m SM-A515F -r PSN download -v A515FXXU3BTI2/A515FOWB3BTH3/A515FXXU3BTH5/A515FXXU3BTI2 -O .
    samloader -m SM-A515F -r PSN decrypt  -v A515FXXU3BTI2/A515FOWB3BTH3/A515FXXU3BTH5/A515FXXU3BTI2 -i SM-A515F_1_20200910175004_86a4taxqdz_fac.zip.enc4 -o SM-A515F_1_20200910175004_86a4taxqdz_fac.zip
    unzip SM-A515F_1_20200910175004_86a4taxqdz_fac.zip -d SM-A515F_1_20200910175004_86a4taxqdz_fac
    cd SM-A515F_1_20200910175004_86a4taxqdz_fac
    mkdir -p AP_A515FXXU3BTI2_CL19494987_QB34065784_REV00_user_low_ship_meta_OS10
    cd AP_A515FXXU3BTI2_CL19494987_QB34065784_REV00_user_low_ship_meta_OS10
    tar -xf ../AP_A515FXXU3BTI2_CL19494987_QB34065784_REV00_user_low_ship_meta_OS10.tar.md5
    unlz4 boot.img.lz4
    cp boot.img boot-orig.img
    adb push boot.img /sdcard/Download
    
  4. From Magisk Manager, select Magisk -> Install -> “Select and Patch a File” and select the boot.img file and then tap on Start
  5. Copy patched file to PC
    adb pull /sdcard/Download/magisk_patched.tar
    mv magisk_pathched.img boot.img
    tar -H ustar -c boot.img > boot.tar
    adb reboot bootloader
    
  6. Flash boot.tar with Odin in option AP. Auto Reboot must be off. I had some problems with Heimdal and my device.
  7. Enter recovery and Wipe Data (Factory Reset)
  8. Phone does one boot loop, and one slow boot

MITM Proxy certificate (Burp)

  1. Download last version of MagiskTrustUserCerts and copy to sdcard/Download (https://github.com/NVISO-BE/MagiskTrustUserCerts). At the tie of writing 0.4.1 is the last one.
    wget https://github.com/NVISO-BE/MagiskTrustUserCerts/releases/download/v0.4.1/AlwaysTrustUserCerts.zip
    adb push AlwaysTrustUserCerts.zip /sdcard/Download/
    
  2. Enter Magisk Manager, on the module tap install AlwaysTrustUserCerts.zip and reboot
  3. Configure Burp to listen to your ip address with conectivity to wifi network. Ensure your firewall is enabled for incoming connectiosn in the port configured.
  4. Save cacert of Burp and copy to phone
    adb push cacert.der /sdcard/Download/cacert.crt
    
  5. Open Download folder with My Files app or the file manager you are using and open certificate and install it as VPN/Applications certificate.
  6. Reboot phone to leave AlwaysTrustUserCerts copy the certificate to system store
  7. Configure Wifi using PC Host IP address/Port as proxy

Flashear TWRP (NOT WORKING YET, waiting new version of TWRP)

  1. Download TWRP not oficial https://droidfilehost.com/download/download-unofficial-twrp-recovery-3-4-0-for-galaxy-a51/
  2. Press simultaneously volume down and up and then plug usb cable.
  3. Use heimdall-frontend:
    1. Tab Utilities, Download archivo PIT
    2. Tab Flash, seleccionar archivo PIT.
    3. Add particion
    4. Select Recovery
    5. Choose recovery.img
    6. Click Start