[PROGRAM] Heimdall - Open-Source Cross-Platform Flashing Suite (1.4.0 Now Available)

bernabap

Senior Member
Jul 25, 2009
217
16
0
Benjamin,

after I tried CM7 on my I9000B and get back to a stock rom with Odin I always get "Handshaking with Loke... Failed!" cant flash anything with Heimdall anymore! :( only with Odin. This is a know problem? Is there a way to use Heimdall again?
 

braschlosan

Senior Member
Sep 11, 2009
326
67
58
Verified that Heimdall flashes the Samsung Galaxy Indulge SCH-R910 kernel correctly.

Bricked my phone with a bad kernel written with DD and was able to fix it with Heimdall and the original kernel :)
 

Benjamin Dobell

Inactive Recognized Developer
Jul 1, 2010
843
596
0
Melbourne
www.glassechidna.com.au
Hey everyone,

Sorry for disappearing for a little while, I've been quite busy. However the good news is that I just managed to set aside some time to work on an update to Heimdall!

The update will be command line only (for now) and adds the following functionality:
- Support for the Galaxy S II! (Hopefully, keep reading.)
- Support for SHW-M110S (Korean Galaxy S).
- Improved support for Galaxy Tab, Captivate and Vibrants (see below).
- No reboot option.
- Dump the devices PIT file and print the information in a human readable format.
- Support for more named partition parameters i.e. --hidden, --movinand.
- One more major feature (read below).

However the biggest change is probably the proper support for PIT files. This means that less things are hard-coded. Instead Heimdall will be grabbing data from your device's PIT file or the PIT file you specify when repartitioning. This may seem like it has minor impact on the usefulness of Heimdall but it actually allowed me to add a second method of specifying files to be flashed to your phone.

You can now type
heimdall --<partition identifier> <filename>
i.e.
heimdall --6 zImage
This essentially means you can flash any file your device supports as long as you know the partition identifier. Of course I don't expect you to know them off the top of your head. This is where the PIT file dumping functionality comes in.
heimdall print-pit
Walah! You now have a complete list of all the files your device supports.

Another minor change is that I've removed the restriction on needing to specify bootloaders (or any files in particular) when repartitioning. However, this was in place as a safety feature. I honestly have no idea whether repartitioning without certain files is safe, and I have no immediate plans to find out, so please be careful!

Back to the Galaxy S II. I don't own a Galaxy S II, so I'm unable to test any changes at present. However I very much would like to own a Galaxy S II! I'm certainly not one to hold out on releasing open-source software until a certain amount of donations have been received. I don't particularly agree with that. However let's just say that I'd very much like to be able to develop (and test) for the Galaxy S II and your donations would be very much appreciated! Again, a very big thanks to those of you who have donated!!!

Donate Link: http://www.glassechidna.com.au/donate/

Source Code ETA: < 24 hours
Platform-specific binaries might take a little while longer to churn out.
 

maedox

Senior Member
Nov 14, 2008
759
54
0
Oslo
Source for 1.2.0 (beta) Heimdall command line tool has been pushed to Github. I'm going to get some sleep, when I wake up I'll start posting binaries.

Galaxy S II users, let me know if it works.
Hi, thanks for this. As an avid flasher and Linux user I'm eager to try it. One question first; Is there any risk in flashing with this on Galaxy S II? I read your warnings about params etc., do they apply to S2 too? I guess the chance of something happening is always there, but it's <= than every other method anyway.
 

Benjamin Dobell

Inactive Recognized Developer
Jul 1, 2010
843
596
0
Melbourne
www.glassechidna.com.au
Heimdall 1.2.0 command line binaries are now available. Debian 32-bit, Debian 64-bit, Windows and OS X (universal) are all available.

It took me a good 5 hours to remember how I got those damn universal binaries compiling and linking with libusb-1.0. So OS X users need to be especially grateful! :p On the plus side the package should now be installable on OS X 10.4.

Hi, thanks for this. As an avid flasher and Linux user I'm eager to try it. One question first; Is there any risk in flashing with this on Galaxy S II? I read your warnings about params etc., do they apply to S2 too? I guess the chance of something happening is always there, but it's <= than every other method anyway.
As you seem to know, there's always some degree of risk.

I think in general we should be good to go. Some users had made quick modifications Heimdall 1.1.1 to get the kernel flashing on the SGS2 which worked fine, so the protocol should be the same. The main difference between the SGS2 and other devices are the partition identifiers. However the new PIT file reading functionality should take care of that.

is this something like EZBase ?
Short answer, no.
 

sptorrent

Senior Member
Sep 26, 2009
194
24
48
Thanks ever so much for this piece of kit! No more need to exit Linux!!!
Heimdall 1.1.1-1 has been working perfectly for me (flashed quite a number of times, either kernel or total repartition).
 

distortedloop

Senior Member
Feb 14, 2010
3,199
335
0
Los Angeles, CA
Hi Benjamin.

Posted the same info in the Droid Charge forum, but not sure how often you frequent there.

Tried 1.2.0 command line on my MacBook Pro and the Droid Charge. I get a "claiming interface....Failed!" message.

With 1.1.1 I would get a "no compatible device" type message.

I am able to do a succesful heimdall dump command on this machine and my i9000 if that provides any helpful information.


Code:
            length: 18
      device class: 2
               S/N: 0
           VID:PID: 04E8:68C3
         bcdDevice: 021B
   iMan:iProd:iSer: 1:2:0
          nb confs: 1

interface[0].altsetting[0]: num endpoints = 1
   Class.SubClass.Protocol: 02.02.01
       endpoint[0].address: 83
           max packet size: 0010
          polling interval: 09

interface[1].altsetting[0]: num endpoints = 2
   Class.SubClass.Protocol: 0A.00.00
       endpoint[0].address: 81
           max packet size: 0200
          polling interval: 00
       endpoint[1].address: 02
           max packet size: 0200
          polling interval: 00

Claiming interface...   Failed!
 
Last edited:

distortedloop

Senior Member
Feb 14, 2010
3,199
335
0
Los Angeles, CA
tried it on XP

Tried 1.2.0 command line on WinXP box.

Can download PIT info and close-pc-screen with heimdall and the Droid Charge, but any attempt to flash either a kernal zImage or recovery file results in a failure and a soft-brick that requires close-pc-screen to be ran to get a normal boot again.

Here's the output for a kernel flash that failed; the recovery file failed with same errors:

Code:
C:\Software from Dave>heimdall flash --kernel zImage

Heimdall v1.0.2b, Copyright (c) 2010-2011, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/


Claiming interface...   Success
Setting up interface...   Success
Beginning session...
Handshaking with Loke...   Success

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

Uploading KERNEL
0%
ERROR: Expected file part index: 0 Received: 1
KERNEL upload failed!
Ending session...
Failed to receive session end confirmation!
I'm kind of screwed with this phone, heimdall won't work on either of my Macs, and Odin on the WinXP machine doesn't see the phone even though heimdall does.
 

Benjamin Dobell

Inactive Recognized Developer
Jul 1, 2010
843
596
0
Melbourne
www.glassechidna.com.au
distortedloop, ah I just realised what I did wrong with the Mac release that's preventing the interface being claimed, I'll release an update ASAP.

However the failure during flashing is odd, especially since all the other functionality is working. It seems as though Samsung have intentionally changed the flashing protocol.

I'm not sure if it's really the best idea ever. However if you're capable of compiling from source, you could try change BridgeManager.cpp line 806, from:
Code:
for (int filePartIndex = 0; filePartIndex < sequenceSize; filePartIndex++)
to
Code:
for (int filePartIndex = 1; filePartIndex <= sequenceSize; filePartIndex++)
 
Last edited:

distortedloop

Senior Member
Feb 14, 2010
3,199
335
0
Los Angeles, CA
The updated OS X package is now available. The binaries are the same, the .kext has just been updated for Galaxy S II and Droid Charge phones.

Does the update still show as the 1.2.0 package?

I just reinstalled, rebooted, tried to flash recovery. Didn't work. Slightly different output this time:

Code:
MBP1:~ dave$ heimdall flash --recovery /Volumes/SSD2/Android/Droid\ Charge/recovery.bin 

Heimdall v1.0.2b, Copyright (c) 2010-2011, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/


Claiming interface...   Success
Setting up interface...   Success
Beginning session...
Handshaking with Loke...   Success

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

Uploading RECOVERY
0%
ERROR: Expected file part index: 0 Received: 2
RECOVERY upload failed!
Ending session...
Failed to receive session end confirmation!
Also, a red-lettered "RX_TIMEOUT" gets put in the top left corner of the Charge's screen. Have to kill power at that point.

What's really ticking me off is that there's a guy in the Charge forums who says he uses heimdall successfully with 1.1.1. Odd, huh?

Not sure if this will help you, but here's the print-pit output:

Code:
MBP1:~ dave$ heimdall print-pit

Heimdall v1.0.2b, Copyright (c) 2010-2011, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/


Claiming interface...   Success
Setting up interface...   Success
Beginning session...
Handshaking with Loke...   Success

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

Entry Count: 14
Unknown 1: 16898048
Unknown 2: 1
Unknown 3: 0
Unknown 4: 0
Unknown 5: 7703
Unknown 6: 255
Unknown 7: 62464
Unknown 8: 22


--- Entry #0 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 0
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 1
Unknown 3: 6684783
Unknown 4: 2097268
Partition Name: IBL+PBL
Filename: boot.bin


--- Entry #1 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 1
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 1
Unknown 3: 0
Unknown 4: 0
Partition Name: PIT
Filename: 


--- Entry #2 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 20
Partition Flags: 2 (R/W)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 40
Unknown 3: 0
Unknown 4: 0
Partition Name: EFS
Filename: efs.rfs


--- Entry #3 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 13
Partition Flags: 1 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 12
Unknown 3: 0
Unknown 4: 0
Partition Name: EFS2
Filename: nvblock.bin


--- Entry #4 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 3
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 5
Unknown 3: 0
Unknown 4: 0
Partition Name: SBL
Filename: sbl.bin


--- Entry #5 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 4
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 5
Unknown 3: 0
Unknown 4: 0
Partition Name: SBL2
Filename: sbl.bin


--- Entry #6 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 21
Partition Flags: 2 (R/W)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 20
Unknown 3: 0
Unknown 4: 0
Partition Name: PARAM
Filename: param.lfs


--- Entry #7 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 6
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 30
Unknown 3: 0
Unknown 4: 0
Partition Name: KERNEL
Filename: zImage


--- Entry #8 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 7
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 30
Unknown 3: 0
Unknown 4: 0
Partition Name: RECOVERY
Filename: recovery.bin


--- Entry #9 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 22
Partition Flags: 2 (R/W)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 1380
Unknown 3: 0
Unknown 4: 0
Partition Name: FACTORYFS
Filename: factoryfs.rfs


--- Entry #10 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 23
Partition Flags: 2 (R/W)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 430
Unknown 3: 0
Unknown 4: 0
Partition Name: DBDATAFS
Filename: dbdata.rfs


--- Entry #11 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 11
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 48
Unknown 3: 0
Unknown 4: 0
Partition Name: LTEMODEM
Filename: lte_modem.bin


--- Entry #12 ---
Unused: No
Partition Type: 0 (RFS)
Partition Identifier: 12
Partition Flags: 0 (R)
Unknown 2: 0
Partition Block Size: 256
Partition Block Count: 2
Unknown 3: 0
Unknown 4: 0
Partition Name: CPMODEM
Filename: cp_modem.bin


--- Entry #13 ---
Unused: No
Partition Type: 2 (EXT4)
Partition Identifier: 0
Partition Flags: 1 (R)
Unknown 2: 0
Partition Block Size: 0
Partition Block Count: 0
Unknown 3: 7602273
Unknown 4: 7274601
Partition Name: MOVINAND
Filename: movinand.bin

Ending session...
Rebooting device...
 

MoxFulder_CH

Senior Member
Sep 13, 2009
131
1
0
I have an issue on OSX 10.5.8

mac:~ David$ heimdall close-pc-screen
dyld: unknown required load command 0x80000022
Trace/BPT trap

I have the same dyld issue from the frontend too. Any idea ?
 

Benjamin Dobell

Inactive Recognized Developer
Jul 1, 2010
843
596
0
Melbourne
www.glassechidna.com.au
I have an issue on OSX 10.5.8

mac:~ David$ heimdall close-pc-screen
dyld: unknown required load command 0x80000022
Trace/BPT trap

I have the same dyld issue from the frontend too. Any idea ?
Damn ye, OS X. Although I'd included a universal binary for heimdall I forgot to include a universal version of the libusb-1.0 library.

Anyway, new OS X binaries are now available. You only need them if you're on a x86 or PPC architecture.
 

distortedloop

Senior Member
Feb 14, 2010
3,199
335
0
Los Angeles, CA
Damn ye, OS X. Although I'd included a universal binary for heimdall I forgot to include a universal version of the libusb-1.0 library.

Anyway, new OS X binaries are now available. You only need them if you're on a x86 or PPC architecture.
Where are the new binaries? The ones at Heimdall – Glass Echidna still show as 1.2.0 and the one I downloaded just now has the exact same MD5 checksum as the one I downloaded yesterday.
 

Benjamin Dobell

Inactive Recognized Developer
Jul 1, 2010
843
596
0
Melbourne
www.glassechidna.com.au
Where are the new binaries? The ones at Heimdall – Glass Echidna still show as 1.2.0 and the one I downloaded just now has the exact same MD5 checksum as the one I downloaded yesterday.
It's still version 1.2.0 but the checksum definitely shouldn't be the same. You'll be able to tell if it's new because the new DMG doesn't include the README where as the old one did. The installer also no longer says "(beta)" anywhere.