12

I have downloaded .img file for TWRP recovery. How I should use it with Heimdall? It seems that Heimdall accepts .gz files (or .pit files in older versions), not .img!

I've tried opening an .img file and Heimdall complained

Tar header contained an invalid file size

Opening a .tar file led to

firmware.xml is missing from the package

Dan Dascalescu
  • 236
  • 1
  • 2
  • 13
PHP Learner
  • 549
  • 4
  • 10
  • 19

3 Answers3

16

Newer versions of Heimdall will accept a .img file for the --RECOVERY parameter and automatically download a PIT from the device to add the img contents to.

$ heimdall flash --RECOVERY recovery.img 
Heimdall v1.4.1

[trimmed some output here]

Session begun.

Downloading device's PIT file...
PIT file download successful.

Uploading RECOVERY
100%
RECOVERY upload successful

Ending session...
Rebooting device...
Releasing device interface...
Re-attaching kernel driver...
Sparr
  • 383
  • 3
  • 9
  • where do i fine that recovery.img file? Link please – Nabin May 24 '16 at 14:03
  • 1
    @NabinKhadka, you must find the right .img based on your phone. Try searching on XDA-Developers or google for the recovery image for your phone. – Matt May 25 '16 at 02:38
  • @Sparr Where did you get v.1.4.1 of Heimdall, please? V1.4.0 doesn't support flash --RECOVERY and there is no later version on https://bitbucket.org/benjamin_dobell/heimdall/downloads, except for Mac (which I don't have). – Mark Smith Oct 01 '16 at 11:50
  • I'm on Mac. And I don't remember, sorry. – Sparr Oct 01 '16 at 20:38
  • how to select slot on command line? – alecxs Feb 02 '20 at 17:46
6

If you use Linux - download heimdall-frontend so you can use GUI. It is much easier.

To flash using Heimdall you first need to specify .pit file.

.pit stands for Partitions Information Tables, so Heimdall knows where it need to flash it.


To flash TWRP using Heimdall follow this steps:

  1. Open Heimdall frontend.
  2. Go to Utilities tab.
  3. You will see Download PIT. Go Save As and save it on some location.
  4. Go to Flash tab.
  5. In PIT category, click Browse and select PIT file you downloaded from device in step 3.
  6. Click Add button.
  7. For partition name select where you want to flash it. BE CAREFUL! If you flash it on wrong partition you can perma-brick device. On my device for recovery it is Kernel2.
  8. Go Browse for file and select .img file.
  9. In Session let everything unchecked.
  10. Click Start.

Note1 : REPARTITION MUST STAY UNCHECKED!!!
Note2: This can brick device, be careful, here on site, we do NOT hold responsibility for your device.
Note3: If you're on Windows, just use Odin...

wadie
  • 105
  • 4
  • where do i fine that recovery.img file? Link please – Nabin May 24 '16 at 14:04
  • @NabinKhadka for example, inside a .tar file one can download (also called pda files). each of the contained files needs to be mapped to the exact parition name. – phil294 Aug 02 '17 at 21:45
1

A image file does not really need heimdall. Most devices that update via a .img file allow you to just put it on internal storage and rebpot to update. An alternative is to move it to your device, and install it via TWRP by loading the File in it.

Dan Brown
  • 1,731
  • 1
  • 16
  • 39