Flashing an Android phone with Heimdall on a Mac

This blog is turning to be some sort of hacker den where I post successful, complicated operations for fear of not remembering again how I did it.

This time it is about flashing a new ROM into my Samsung Galaxy S2; Windows owners use a piece of software called Odin, which sadly does not exist on Mac; its multiplatform equivalent is called Heimdall.

Unfortunately none of the operations I am about to describe is stoopid (=me)-proof, so I will try to detail every step here.

  1. download and install Heimdall (easy enough !)
  2. look for the ROM you want – that took some searching, because it’s normally listed as “ODIN” software (because this is the program that the majority of users will use. Of course, if you, like me are simply looking to restore the phone, you should look for “stock” firmware; the good news is that once you find it, you can store it on your computer for a future re-use
  3. the software is a .TAR package which you can open with GUItar; if it is .TAR.MD5 simply remove the .MD5 extension (it’s only a checksum control). You need the individual files making up the package;
  4. turn phone off;
  5. turn phone back on in download mode (Volume Down until download dialog mode appears, answer Yes)
  6. connect USB cable to computer;
  7. launch Heimdall – on the Utilities panel, check that your device is detected; if not repeat #5 and #6 until it does;
  8. in the Flash panel first look for the .PIT (Partition Information Table) file (some here) – of course you need the one that’s right for your phone (search “Partition Information Table” and “phone make” e.g. “Samsung” or “HTC”);
  9. now you must fill in the Partitions segment; the button sequence is: ADD  – select Partition Name – BROWSE, and this is the list of partitions and the corresponding files for my Galaxy SII:
    1. BOOT – boot.bin
    2. SB1 – sbi.bin
    3. PARAM – param.ifs
    4. KERNEL – zimage
    5. CACHE – cache.img
    6. MODEM – modem.bin
    7. FACTORYFS – factoryfs.img
    8. DATAFS – data.img
    9. HIDDEN – hidden.img
  10. Press start – if you receive this error message:

Initialising connection…
Detecting device…
Claiming interface…
ERROR: Claiming interface failed!

it’s because you – like me – have used the Samsung Kies software, which you should uninstall at once, but as it adds some offending kernel extensions, you also must unload such extensions:

A. launch Terminal
B. get root and unload extensions:

sudo sh -
kextunload -b com.devguru.driver.SamsungComposite
kextunload -b com.devguru.driver.SamsungACMData
kextunload -b com.devguru.driver.SamsungACMControl

C. return to #10 above and try again

At this stage my phone is successfully flashed, but for the new firmware to take effect I must perform a factory reset, which you do in recovery mode: Volume Up + Power + Home (I had to try this several times, not quite sure what I was doing wrong) – Volume key navigates, Power key selects:

  1. wipe cache
  2. factory reset

At that point my phone is really like new; unfortunately it means redownloading all the apps, which however is quick & easy from my Google Play account – also a good chance for some spring cleaning !

2013 12 01 banner

13 thoughts on “Flashing an Android phone with Heimdall on a Mac

  1. Thanx a lot for the hint with the kies blocking usb!
    Like 3 years ago I owned a Samsung mobile for only 2 weeks before I got rid of it on ebay again and bought an htc. And of course I had forgotten completely about that samsung suite I installed. With unloading the kexts I was able to flash my galaxy tab.
    Best, Stephan

  2. I think I’ve got everything pretty much figured out, except . . . what is a .pit file? And where exactly can I find it? I’ve Googled it but can’t find anything that clearly answers! Thanks so much for your guide!

  3. Thanks so much for answering! I’m sorry to be such a pest, but I have another question. How do I get root in terminal? I tried manually typing in what you wrote, and it won’t work, then I tried copying and pasting. It asks for my password, but it won’t let me type. Thanks again for all your help!

  4. @ Jenn ~ When entering your password in Terminal when entering the root password, there is no characters shown when typing (not even a black box).

    Simply type your password then press enter to proceed: You can hit backspace the required times to undo an error.

  5. Hello, when i unzip the zip file that i downloaded on a mac i only get the FACTORYFS – factoryfs.img .The other files that you have listed above i can see them& also the Heimdall crashes unexpectedly on my OS YOSEMITE 10.10. Please help!

  6. Alright guys I have fixed the issue running a mac sierra. Download Heimdall 1.4.0 as 1.4.1 will know show up in applications. there will be a install error that occurs just click install anyways now you will see the Heimdall app in applications. To fix
    “Initialising connection…
    Detecting device…
    Claiming interface…
    ERROR: Claiming interface failed!”

    Please use the above fix mentioned running terminal app on the mac.
    A. launch Terminal
    B. get root and unload extensions:

    sudo sh –
    kextunload -b com.devguru.driver.SamsungComposite
    kextunload -b com.devguru.driver.SamsungACMData
    kextunload -b com.devguru.driver.SamsungACMControl

    after this you can run Heimdall and successfully retrieve your Pit file which I have saved on my desktop and it is correct and 8KB file.
    Next you will need Jodin3 the mac equivalent for Odin. Once device is in download mode Jodin will have a Pit search button find the Pit file and click on PDA same search add the stock firmware and run there you go completely flashed to stock rom and should take care any boot loop errors which i encountered on my S5.

    thanks

Leave a comment