Flashing ROM to Samsung Phone

On Linux there is a great Heimdall tool.  I used it recently to flash stock ROM and custom recovery (TWRP) to my old Samsung S3 mini. Best to be used from command line.

Heimdall is in Ubuntu repos (or build from source):

sudo apt-get install heimdall-flash

Steps to flash:

  1. Restart phone in download mode – push all tree button: Vol -, Home, Power
  2. Connect to USB
  3. sudo heimdall detect

    Heimdall must always run as root.
    If phone is not found try other USB ports ( worked only on one in my notebook).

  4. Get PIT in readable form:
    sudo heimdall print-pit >myphone_pit.txt
  5. Unzip, untar ROM archive
  6. Match file names to partition names – look into PIT dump:
    — Entry #21 —
    Binary Type: 0 (AP)
    Device Type: 2 (MMC)
    Identifier: 20
    Attributes: 5 (Read/Write)
    Update Attributes: 5 (FOTA)
    Partition Block Size/Offset: 524288
    Partition Block Count: 2457600
    File Offset (Obsolete): 0
    File Size (Obsolete): 0
    Partition Name: SYSTEM
    Flash Filename: system.img
    FOTA Filename:
  7. Flash partitions –  in case of stock ROM I did not have to flash all (probably because re-flashing same ROM back):
    sudo heimdall flash --Kernel boot.img --CACHEFS cache.img --Kernel2 recovery.img --SYSTEM system.img

    To flash custom recovery:

    sudo heimdall flash --Kernel2 ~/tmp/recovery.img

     

Leave a Reply

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