Download Heimdall on linux – Heimdall lets you flash partitions and their contents to an android device (an android device is made out of CPU, RAM, BATTERY, SCREEN, and what it has on its PARTITIONS, so if you change what it has on its PARTITIONS you can change everything from whta ROM it has to what KERNEL and MODEM and RECOVERY its running) – its either to work with than windows. Need to get libusb-1.0.0 (apt get it or yum it or compile it). Also download all of the needed flashing files such zImage, boot, pit,factoryfs,cache,dbdata,param,modem,sbl.(one click odin or heimdall files can be extracted with exodin). The more of those files that we have that pertain to a specific rom the better. Note that if your missing a PIT file you will be fine as most devices have a fine PIT (partition table layout) and if your PIT is messed up you can download one of the default PIT files & repartition the PIT at the same time that you flash your rom (stock rom or rooted rom).
Sidenote: I noticed that most of the time full odin/heiomdall 1 clicks are just for the stock. If you want a rooted or different rom then you will need to usually follow the default proceedure of (go to stock -> root your phone -> install a recovery such as clockworkmod or Teamwin recovery -> boot into recovery -> do a nandroid backup so that just incase you can restore back to this rooted stock rom situation -> wipe dalvik cache, cache, system and data -> flash the rom zip file -> flash gapps zip file if needed -> flash any other zip files that rom might of suggested –> boot up and setup up your new phone). Lots of singular heimdall flash files seem to be for singular things like recovery files and kernel files. Then again im new to this and also ive only messed around with heimdall on the Samsung I896 (and i897) captivate.
Good first read:
http://vincent.bernat.im/en/blog/2011-android-samsung-galaxy-s.html
Lets say you get it installed. How do we use it?
Note: if your using windows and get libusb errors then you should try other ports and also rebooting and also uninstalling any samsung/android drivers and running ccleaner. As that is a pain to do, I just use heimdall from linux.
Note: see if heimdall detects your phone using “heimdall detect” and finally “heimdall print-pit” after printing pit you will need to reboot the phone back to download mode. Unless you use “–no-reboot”… However I noticed that download mode (At least on my captivate) is one job per run, so even if you do no-reboot the next run of heimdall wont work and you will need to reboot it.
Note: also if heimdall doesnt work on 2nd or 3rd run (even if you didnt do a no-reboot) and you get weird usb errors or initialization errors then try unplugging the phone, turning it off (by taking out battery), wait 10 seconds, and put back to download mode. If that doesnt work reboot your linux PC (this shouldnt take much time on your linux server) as it might be hanging on to some libusb thing.
Note: if you downloaded an Odin One click root. That can be used with Heimdall just so that you know. Also if your odin pack came in an exe format, your linux heimdall wont understand it. You can extract it with exodin.
Downloads: https://github.com/h0tw1r3/exodin/downloads
Source code: https://github.com/h0tw1r3/exodin
More downloads: https://github.com/h0tw1r3/exodin/releases
For sake of example lets say you have these files:
# ls
– s1_odin_20100512.pit (by the way this is the default pit file for the Samsung Captivate)
– factoryfs.rfs
– cache.rfs
– dbdata.rfs
– param.lfs
– modem.bin
– zImage
– SBl.bin
Run heimdall like this:
$ ./heimdall # if your running it from a compiled folder
$ heimdall # if you installed it
The default command looks like this (if your repartitioning your pit – partition table):
$ heimdall flash –repartition –pit s1_odin_20100512.pit –factoryfs factoryfs.rfs –cache cache.rfs –dbdata dbdata.rfs –param param.lfs –modem modem.bin –kernel zImage –secondary-boot Sbl.bin
The default command looks like this (if your NOT repartitioning your pit – partition table):
$ heimdall flash –factoryfs factoryfs.rfs –cache cache.rfs –dbdata dbdata.rfs –param param.lfs –modem modem.bin –kernel zImage –secondary-boot Sbl.bin
Format of the command: heimdall flash [–repartition –pit PITFILE] [–PARTITIONNAME PARTITIONFILE]x(as many times as you want until you get as many files as you can)
However most likely your partition names arent “factoryfs” “cache” “dbdata” “param” “modem””secondary-boot” and “kernel” (order in which you feed the partitions doesnt matter, also the partition name must match, case and everything). Verify your partition names:
If you have good pit on your phone:
$ heimdall print-pit
or if your repartitioning with a pit:
$ heimdall print-pit –file s1_odin_20100512.pit
Now look for the enteries “Partition Name”
Might be easier to do this:
$ heimdall print-pit > pit-device.txt
or
$ heimdall print-pit –file s1_odin_20100512.pit > pit-512.txt
$ cat pit-device.txt | grep “Partition Name”
or
$ cat pit-512.txt | grep “Partition Name”
NOTE: if your on windows and following along you can use Notepad++ and use the Search and Find all in Current document and look for the word “Partition Name” or use grep for windows (there is a gui version).
NOTE: CONFIRMING DEVICE PIT with KNOWN GOOD PIT – your phones partition table might be good enough and you wont need to repartition your Pit. If your phone has a good pit table then you dont need to do “repartition and pit” check if your pit table is good by making sure its one of the default pit tables 512 513 or 803 (also there maybe others im just quoting samsung captivate pit tables I saw, even then the captivate only uses the 512)
$ heimdall print-pit > pit-device.txt
$ heimdall print-pit –file s1_odin_20100512.pit > pit-512.txt
$ diff -y pit-device.txt 512.txt
Repeat on the other pit-files as well
NOTE (PIT FILE DOWNLOAD): I have a copy of the 512 513 and 803 pit files and their text versions here 512 513 803. Also just so you know pit files are just compiled C code, compiled with ARM architecture go here. You can see how to make a pit file here – and essentially how these were made. Here is another look at the difference between the 3 pit files: http://forum.xda-developers.com/showthread.php?t=816449
NOTE: different PIT files can bring about different size of partitions different and partition names as well
Now back to the example (we grepped / looked for “Partition Name”), lets say we are not repartitioning the PIT – or we are – and we see that the final Partition names will be:
Partition Name: FACTORYFS, CACHE, DBDATAFS, MODEM, PARAM, KERNEL, SBL, SBL2
So now we have to change the heimdall flash command:
$ heimdall flash –repartition –pit s1_odin_20100512.pit –FACTORYFS factoryfs.rfs –CACHE cache.rfs –DBDATAFS dbdata.rfs –PARAM param.lfs –MODEM modem.bin –KERNEL zImage –SBL Sbl.bin –verbose
And if you didnt need to repartition your PIT (Because its good, either because you know its good, or you confirmed it with a known good PIT Table)
$ heimdall flash –FACTORYFS factoryfs.rfs –CACHE cache.rfs –DBDATAFS dbdata.rfs –PARAM param.lfs –MODEM modem.bin –KERNEL zImage –SBL Sbl.bin –verbose
Note that the SBL.bin is the 2ndary boot loader and it goes to SBL and not SBL2
Note adding verbose for extra onscreen output
Also if you want to keep safe you can first partition the PIT and then flash the files.
$ heimdall flash –FACTORYFS factoryfs.rfs –CACHE cache.rfs –DBDATAFS dbdata.rfs –PARAM param.lfs –MODEM modem.bin –KERNEL zImage –SBL Sbl.bin –verbose
Here is a list of the partition table names and their duties:
Below is From the source at the top of the page:
This will display the partition table of your phone. This is enlightening to know what it contains:
*IBL+PBL is the boot loader, be extra careful with it;
*PIT is the partition table;
*EFS contains some important data like IEMEI, be extra careful with it;
*SBL is the second boot loader;
*SBL2 is the backup of the second boot loader;
*PARAM contains some images used as various stage of the boot process;
*KERNEL is the kernel;
*RECOVERY is the backup of the kernel;
*FACTORYFS contains /system file system which is some kind of root file system;
*DBDATA contains /data file system which is the database to store application parameters;
*CACHE contains /cache file system which contains the Dalvik cache;
*MODEM contains the firmware for the modem.