Slay Odin With The Mighty Heimdall

heimdall_feat

This weekend I took on the project of getting Ice Cream Sandwich installed onto a Samsung Galaxy S phone, the Verizon branded Fascinate. Getting the Fascinate to comply with what I believed to be a reasonable request was made difficult by some annoying traits of the hardware itself, but that is a story for another time. The real hero of the day was Benjamin Dobell’s Heimdall, without which I would have been completely lost.

Mythological Software

If you’ve ever worked with the Samsung Galaxy S line of phones, you are probably aware of the Norse theme the recovery method and software employs. The software which runs on the phone itself and receives the firmware images to flash is known as Loke, and the software you run on the computer is called Odin.

Odin is, as its name suggests, a very powerful piece of software. It allows the user to flash new ROMs or individual partitions to their Galaxy S device, even if it’s not otherwise bootable. This recovery capability is used by Samsung and its authorized parties to update and repair Galaxy S devices, though it’s equally useful to those of us who wish to modify our phones. Odin makes it possible to recover your device in even the most dire of software situations, meaning it’s nearly impossible to damage a Galaxy S device to the point it can’t be repaired (outside of physically smashing it, at least).

But Odin has a serious problem, and it’s not Ice Giants; Odin is leaked software from Samsung, and can’t be legally distributed. The only versions of Odin you are going to find online were stolen from Samsung and have been floating around on random shady sites for untold amounts of time. This is about the worse source of software you can possibly use, and in fact, many of the Galaxy S guides will actually tell you to turn off your anti-virus software before downloading and running Odin due to “false positives”. Yeah…I’m good.

Though even if Odin was freely available, I don’t own the prerequisite Windows computer to run it on in the first place. Software which has the capability of easily destroying my hardware is not the kind of thing I like to run in WINE or even a VM either. So what is a non-Windows having, software license obeying, guy supposed to do?

Enter Heimdall

Heimdall is a fully open source and portable replacement for Odin, with binaries available for Windows, Linux, and Mac OS. Heimdall is a command line tool, easily integrated into scripts, but also includes a GUI front-end designed to make the task a bit easier for the less technically inclined.

Flashing partitions with Heimdall-frontend

Heimdall simultaneously solves all of the problems with Odin (well, maybe not the Ice Giants). It’s open source, so the community can be sure it’s not a virus or malicious software out to destroy phones, it’s cross-platform so those of us without Windows don’t have to suffer, and you never have to worry about tracking down a leak of the latest version because you can just grab it from the site.

Bifrost must be installed separately.

Using Heimdall

If there was any downside I found of Heimdall, its that nearly every guide or forum post you find online about recovering or working with a Galaxy S device will be focused on Odin. This can be a bit confusing, as the interface of Heimdall-frontend (assuming you even installed it) doesn’t match up with the instructions given for the Odin interface.

Moreover, it doesn’t appear that Heimdall can directly handle the types of firmware image files that seem to be commonly posted online. Firmware images for the Galaxy S devices, including the stock images, are distributed with the extension .tar.md5, which Heimdall completely chokes on no matter where you attempt to load it within the frontend. The secret is to extract the .tar.md5 image into its principle parts, and load that into Heimdall. For example, you can see the files contained within one of the stock firmware images for the Fascinate here:

bash$ tar tvf CI500_VZW_EH03_GB_CM.tar.md5
-rwxr--r-- cw50_jung/cw50_jung 765952 2011-11-02 21:45 param.lfs
-rwxr--r-- cw50_jung/cw50_jung 1310720 2011-05-19 00:43 Sbl.bin
-rwxr--r-- cw50_jung/cw50_jung  262144 2011-05-19 00:42 boot.bin
-rwxr--r-- cw50_jung/cw50_jung 5411928 2011-11-02 21:45 recovery.bin
-rwxr--r-- cw50_jung/cw50_jung 5411928 2011-11-02 21:45 zImage
-rwxr--r-- cw50_jung/cw50_jung 325054464 2011-11-02 11:39 factoryfs.rfs
-rwxr--r-- cw50_jung/cw50_jung   1376256 2011-11-02 11:39 dbdata.rfs
-rwxr--r-- cw50_jung/cw50_jung   1245184 2011-11-02 11:39 cache.rfs
-rwxr--r-- cw50_jung/cw50_jung 113998336 2011-10-31 08:32 movinand.bin
-rwxr--r-- cw50_jung/cw50_jung  16252928 2011-10-29 00:45 modem.bin

These individual files can then be loaded up into Heimdall-frontend’s “Flash” tab (as the previous image showed), or flashed with Heimdall right on the command line with the following syntax,  substituting the appropriate partition switch and filename as needed:

bash$ heimdall flash --recovery recovery.bin

It’s important to realize that not all of the individual partition image files are required for the flashing operation. The previous command could be used with a .bin file for the latest ClockWorkMod Recovery to install everyone’s favorite recovery without needing root (or even having to boot the phone up). In fact, that’s exactly how I got the process of installing ICS started on the Fascinate. You could also flash just the radio baseband, or only the kernel; whatever the recovery situation requires.

Odinsleep

After using Heimdall to great effect over the last few days, from getting ClockWorkMod installed to recovering the phone to stock when I had trouble provisioning it on Verizon once ICS was installed. It’s an excellent recovery tool, and completely fills the role of Odin without any of the logical problems.

What I’d love to see now is more people embrace Heimdall, and start including it in their guides and tutorials. If more people are instructed in how to properly use Heimdall, the community could start weaning itself off of shady illegal software. I would also like to see more people make firmware images available in Heimdall’s particular package format. This capability is a real boon to ROM developers, but I’ve seen very few of them actually making use of the function.

With the release of Heimdall 1.3.2 just a few days ago, now is a great time to give this excellent piece of software a shot and put Odin to sleep, for good.


Tom Nardi

Tom is a Network Engineer with focus on GNU/Linux and open source software. He is a frequent submitter to "2600", and maintains a personal site of his projects and areas of research at: www.digifail.com .

Related posts

  • http://alaninkenya.org Alan Orth

    Yes! I can’t stress this enough. Odin is a proprietary, leaked, closed-source software! Heimdall is open and cross platform!

    I maintain a list of Heimdall packages for various Samsung stock ROMs on XDA. Spread the word!

    Galaxy S (GT-I9000): http://forum.xda-developers.com/showthread.php?t=1196179
    Galaxy Tab 7 Plus (GT-P6200): http://forum.xda-developers.com/showthread.php?t=1517934

    • http://www.digifail.com/ Tom Nardi

      Alan,

      That’s definitely what we need more of. I’d love to see some kind of central repository of Heimdall packages for various ROMs, stock and otherwise.

      Perhaps better yet, a tool to convert Odin-style ROMs to Heimdall. Ideally, Heimdall would include this function, but I get the impression Benjamin might be intentionally avoiding supporting the Odin format to avoid any possible connections with Odin and draw the attention of Samsung.

    • dorianm

      Hello! Can you tell me if you have an Heimdall package for Galaxy S2? I’m in trouble, I used Heimdal but the cache, factoryfs and hidden images from all the Roms I used doesn’t work 100%, so the instal is aborted. Thank you in advance if you can help me, even with an idea… my S2 now show me the Download and Recovery mode, but Recovery doesn’t work either. Thank you again!

  • https://launchpad.net/~pefi Przemo

    Thanks for the article – I did’t know that there is a GUI frontend. The best way to boost interest in using Heimdall is ta make CM9 for samsung S2 in heimdall package format.

  • Pingback: rooting a S2 from linux/ubuntu? - Android Forums

  • Krish Nagarajan

    Many thaaanks for this article;

  • Tony Clulow

    For me, heimdall only ever gets one command to work and then has a “protocol error” and nothing works. Needs a re-boot of the phone (to download mode) and re-start heimdall.

  • macnair

    been trying heimdall on mac Mountain lion (both 1.3 and 1.32) but when I connect my P6200 in download mode, heimdal does not detect it….can anyone pls help?

  • William

    I can’t seem to load the stock SAMSUNG ROM on my S3 with Odin (“dev-type unsupport” error) so was trying to use Heimdall. I can guess how to map most of the files in the tar.md5 to the command line args, but not sure about 3 of them… any suggestions? The files in question are called: BcmCP.img, dt-blob and vc-firmware.img. Thanks.

Top