HOW TO ROOT Galaxy A51



  • Root
  • No bloatware
  • More space available
  • Battery drains slowly
  • Frequent updates
  • 178044 points in Antutu v8


  • YOUR WARRANTY IS NOW VOID and blablabla
  • Poor interface (it’s an Android 10 PURE system)
  • No Samsung’s facilitations/resources/beauty
  • Screen transitions are flickering (no big deal)


  • Unlocked bootloader
  • A full backup (you’ll lose everything stored in your phone)
    Both Windows AND Linux (I used Windows installed and Kalix Live USB) OR Windows with Linux Bash System ( -tip given by @ToddNachste
  • Patience (A LOT)
  • About 30 GB free

Files needed

  • Download with Frija or SamFirm THE SAME firmware you’re running now
  • Download a GSI Android 10 A/B Gapps arm64v8 from ( -I’m using AOSP 10 v215, but I believe it’s working with more GSI’s
  • LZ4 Extractor (
  • Simg2img (
  • LPunpack Tool (
  • Odin (
  • 7zip
  • Permissive kernel ( -thanks to map220v

In Windows

  • Extract the AP_file.tar.md5 from your file using 7zip
  • Extract the super.img.lz4 file from the AP_file.tar.md5 file using 7zip
  • Put super.img.lz4 file in LZ4 folder and run in CMD the command lz4.exe -d super.img.lz4 superLZ4.img
  • Put superLZ4.img file in Simg2img folder
  • and run in CMD the command simg2img.exe -i superLZ4.img -o superSIMG.img

In Linux OR Bash shell

  1. Put superSIMG.img in otatools/bin folder and extract it in Linux terminal using the command
    ./lpunpack --slot=0 superSIMG.img <destination dir> (I recommend you create a folder for this)
  2. Put, in the folder where you extracted superSIMG.img, the GSI file you downloaded and rename it to system.img. Now you should have odm.img, system.img, vendor.img and product.img files in the same folder. You may also need to delete/remane the original system.img file before renaming the GSI file.
  3. Now you’re going to make a brand new super.img file containing all 4 files of the previous step. This is a critical and tricky step. Run Linux terminal and type:
    ./lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:4294967296 --group main:4293513600 --partition system:readonly:1577095168:main --image system=./system.img --partition vendor:readonly:342155264:main --image vendor=./vendor.img --partition odm:readonly:643456:main --image odm=./odm.img --sparse --output ./super.img

Note that in this code, the numbers highlighted in bold are the sizes of the 3 .img files you extracted (odm, vendor and product) in step 2 plus system.img you downloaded/renamed, IN BYTES. Update the code with YOUR files’s sizes!

  • system:readonly:1577095168:main (size of unsparsed system.img in bytes)
  • vendor:readonly:342155264:main (size of vendor.img in bytes)
  • odm:readonly:643456:main (size of odm.img in bytes)
    as @phhusson stated (thanks!), no need sto use product.img, just supress it at all
  • –group main:4293513600 (main partition size 1577095168+342155264+643456=2776752512)
    *The size of main is the sum of the 4 .img files*

You may face two different problems here

  • Odm.img file requested a not avaliable space. Just sum and update main’s size.
  • System.img is larger than expected. Just sum and update main’s size again.
  • Your original super.img file is now created, like Samsung does. Congrats!

Back in Windows

  • Create, using 7zip, anyname.tar file cointaining just the super.img you created. Simple.
  • Open Odin, untick Auto Reboot, add anyname.tar file to AP, put your phone in Download Mode and flash it Flash boot(NoForcedEnforce).tar the same way.
  • Reboot your phone, do a Factory Reset in original recovery.

In Android:

  • Install terminal emulator and run the following commands:
  • su
  • setenforce 0
  • getenforce (it should show Permissive)

Job is done.

source credit to gabrielfrias for the tutor

Leave a Comment

Your email address will not be published. Required fields are marked *