I have a samsung SMG531f Grand Prime. I accidentially deleted my OS in Team Win by selecting the System option coming under Wipe option in the main menu. Now when I switch on the phone it will show only the startup screen. I can only go to the TeamWin by pressing Volume up Home and power button. But when I try to go to odin mode by clicking on volume down power and home button it doesn't work. How can I overcome this problem and reinstall os to this phone.

Volume up key doesn't work in this phone.

Prefer a solution which can be configured in Windows environment as I don't have access to an open source OS.

  • 1
    on newer samsung devices system.img is lz4 compressed. yours should be simg2img sparse image
    – alecxs
    Jan 22, 2022 at 21:17
  • @alecxs Could you elaborate on how can I do it step by step? Jan 22, 2022 at 21:24
  • this is the origin of simg2img.exe but I recommend more recent version for linux forum.xda-developers.com/showthread.php?t=1054836&page=3
    – alecxs
    Feb 22, 2022 at 21:46

1 Answer 1

  1. download and extract ROM from samloader

    cd /media/xubuntu/1234567890ABCDEF
    sudo apt update
    sudo apt install android-sdk-ext4-utils android-sdk-libsparse-utils android-sdk-platform-tools-common android-tools-adb android-tools-fastboot f2fs-tools git python3.8 python3-pip
    git clone https://github.com/nlscc/samloader
    cd samloader
    pip3 install .
    cd ..
    sudo cp -av ~/.local/bin/samloader /usr/local/bin
    mkdir Android
    cd Android
    samloader -m SM-G531F -r SLK checkupdate
    samloader -m SM-G531F -r SLK download -v G531FDDU1APJ2/G531FODD1APJ2/G531FDDU1APJ2/G531FDDU1APJ2 -O .
    samloader -m SM-G531F -r SLK decrypt -v G531FDDU1APJ2/G531FODD1APJ2/G531FDDU1APJ2/G531FDDU1APJ2 -V 4 -i SM-G531F_1_20161116150254_w0xdzpk60j_fac.zip.enc4 -o SM-G531F_1_20161116150254_w0xdzpk60j_fac.zip
    unzip SM-G531F*.zip
    tar -vxf AP_G531F*.tar*
  2. convert system.img into mountable disk image

    mv -v system.img system.sparse.img
    file system.sparse.img
    simg2img system.sparse.img system.img
    file system.img

    (optional) check if mountable

    mkdir system
    sudo mount -vo loop,ro,noexec,noload,noatime -t ext4 system.img system
    ls -a system
    sudo umount -v system
  3. copy file to MicroSD Card

    adb push system.img /external_sd

    (optional) compare digest

    md5sum system.img
    adb shell md5sum /external_sd/system.img
  4. write disk image from terminal dd

    adb shell
    find /dev/block -name by-name
    ls -l /dev/block/bootdevice/by-name/system
    dd if=/external_sd/system.img of=/dev/block/bootdevice/by-name/system
    reboot recovery
  5. disable dm-verity and recovery-from-boot.p (necessary for TWRP)

    adb disable-verity
    adb shell
    mount -w /system
    mv -v /system/recovery-from-boot.p /system/recovery-from-boot.bak
  • How can I do this in Windows? Feb 12, 2022 at 11:38
  • Can you explain how can I do the whole process in Windows? Feb 12, 2022 at 20:21
  • EVERYTHING in the above answer, most of the commands are to run in Linux environment when I Googled. Could you please give me a way how on doing these in Windows? Feb 13, 2022 at 1:54
  • @alexcs I tried those before too. It shows downloading in MINGW64 but it never shows whether the download succeeded or not. And I have no idea about how can I find the downloaded file. Please understand how a person who has never used Linux feels like executing your commands and translating those to Windows environment. Feb 13, 2022 at 11:12
  • I am sorry with the resources I have moving to Linux is not an option for me. Feb 13, 2022 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .