Month: November 2013
This is NOT an indepth look at Heimdall, nor is it a step by step tutorial. It’s an overview to try to give a basic understanding of the process – something I found to be missing elsewhere.
The Android ROM flashing and rooting process is confusing, and I think that’s because most of the people blogging about it have done it so many times they forget how confusing it was at first.
Even websites in this space make the assumption that everyone already knows everything. http://www.clockworkmod.com for example, is website for the popular clockworkmod tool, that when installs allows you to control the recovery process much better than the phone stock process. For some bizarre reason the website doesn’t tell you this!
The good news is, that once you get it, it’s easy. The bad news is, upfront it’s daunting, confusing, and there’s a real lack of “ROM Flashing for Dummies” information out there.
With that in mind, let’s start with Android phone hacking 101.
There are really two ways to get a custom ROM on a phone:
a) Flashing an entire ROM to a phone using something like Heimdall (or Odin on a PC)
b) Getting zip files onto a rooted phone, and installing them using a custom recovery tool like clockworkmod.
Option A is trivially easy after you’ve:
- found the right file to flash
- worked out how to use Heimdall
- done it once
Option B is so utterly trivially easy after you’ve:
- worked out how to root your phone
- worked out what ROM file you want
- worked out what the right “gapp” file is the right one for this ROM (you need to install the bare minimum of Google apps like Google Play, and these are not bundled with ROMS because Google doesn’t like that.)
- you’ve done it once
So – as you can see, the trick is getting it done once!
Which method should you use?
When choosing between A and B, my advice is go with B, but know that if things get messed up, you’re going to have to do A.
I’m not going to go into step B in detail, but what you need to know are:
- how to root your phone (increasingly easy)
- how to install a recovery manager like clockworkmod
- the key combinations to boot your phone in to recovery mode
- what “gapp” is, if you need it for your ROM and where to get the right one
- how to follow instructions for any given ROM which will be all or some of:
- – creating backups
- – clearing different kinds of caches
- – formatting partitions (sometimes)
- – installing zips from SD card
Heimdall for Ubuntu (and OSX)
Heimdall and Heimdall Frontend. What are they?
They are a command line tool, and an optional graphical user interface that are in many ways equivalent to Odin, a very popular PC based ROM flashing tool that I haven’t used.
How do you instal Heimdall on Ubuntu?
You can download the latest DEB files from https://github.com/Benjamin-Dobell/Heimdall/downloads
If you don’t know how to install them once you have them, then flashing ROMs might be a bit beyond you.
Heimdall Gotcha 1: Heimdall Package Files.
Heimdall-frontend is at first confusing because the focus / main screen is for uploading Heimdall Package Files.. and boy did I search the world for them. You probably won’t find for your phone and desired ROM.
Heimdall package files are a great idea by the developer of Heimdall. Instead of having to work out how to flash your phone, all of the ROM source files need for a specific ROM and phone specific partition information are bundled up with a configuration file that makes it “just work”. In one click, Heimdall flashes the phone. I couldn’t find any for the Samsung S3 which is a metiorically popular phone, so based on that I’m thinking they are rare.
That doesn’t mean you can’t use Heimdall – it just means you need to understand the process a little more.
Heimdall Gotcha 2: You should run Heimdall as root!
So to launch, open up a terminal and type <i>sudo heimdall-frontend</i>. Without doing this it’s very possible Heimdall won’t be able to access your phone at the level it needs to.
Heimdall Gotcha 3: Where is all the information about using Heimdall with Ubuntu??
Yes – there isn’t really much out there. Odin for Windows is the much more common tool, but good news, OS X people use Heimdall too – so you might have more luck with more OS X specific Google searches for your phone.
Heimdall Gotcha 4: What ROM files do you need???
This is personal opinion. Option (B) is the way to go, so think of Heimdall as a tool to use when things go horribly wrong.
With that in mind, all you really need is ONE ROM FILE for Heimdall, and it’s the one that will get your phone back to stock. Even finding that can be troublesome, but you are looking for, e.g. “Verizon Samsung S3 Stock ROM download” is the way to go.
You are likely to end up with a file with extension .tar.md5 (which you rename to .tar and extract) or just a .tar, or a zip and it’s going to be pretty big.. a solid Gig or so.
Bottom line you are looking for a big old file, which contain files like (Samsung S3 files here):
These are also pretty big (especially system).
These are images of what specific partitions on your phone would contain when stock.
Your phone has a partition called SYSTEM, and system.img.ext4 contains the data for that partition.
Your phone has a partition called TZ, and tz.mbn contains the data for that partition.
There are two odd-files-out here.
SS_DL.dll. This is I expect something that relates to using Odin (Windows) to flash.. ignore.
NON-HLOS.bin. This is a Samsung S3 ROM file, and not sure if this is a standard, but I’m using it to demonstrate that not all files match up with the partitions they are associated with nicely. This is for the MODEM on a samsung S3.
Flashing a phone using Ubuntu and Heimdall.
A) Extract the PIT file from the phone.
Bottom line, you need to pull information from the phone that relates to the file system – specifically what partitions the disk has.
1) Start Heimdall as root user (e.g. type sudo heimdall-frontend in a terminal window)
2) IGNORE the first page you see! Skip to the Utilities tab.
3) Get your phone in “Download Mode” (you might have to google the key combinations for that)
4) Connect it by USB
5) Click DETECT and hopefully it will find your phone
6) Use the “Download PIT” section to create a PIT file, and DOWNLOAD that to your Ubuntu PC.
If all goes well you now have part of the building blocks you need.
B) Configure which partitions are going to be flashed with which partition files
So at this stage, you have a PIT file containing all the partitions on the phone, and a bunch of .img / .mbn / .img.ext4 / .bin etc. files that are going to be loaded into those partitions.
1) Go to the FLASH tab in Heimdall.
2) Use the Options section to load the PIT file you just created
3) Make sure the “RE-PARTITION” check box is UNCHECKED.
4) You are now going to click the ADD button for every file that you got in that big old ROM file, and use the Partition Details section to map that to the appropriate partition on the phone.
That is the hard bit, and might need some googling. You might have some weird file name that doesn’t seem to map to one of the partitions in the “partition name” drop down.. Google is your friend. Also, not every partition on your phone will have a file associated with it.
When you have a match up for each file you have to one of the available partitions, you are good to go.
5) Click START and hold your breath.
6) If you get an error in the status screen it’s probably got something to do with the status of the connection to the phone. Disconnect and reconnect. Go to the Utilities tab and DETECT the phone again. It took me a few times before START actually did the flash, but once the flash started, it took about 10 minutes, and went smoothly.
After that, the phone was back to it’s stock self (with all that Verizon crapware all over it.)
Hope this helps, and at the very least provides the baseline understanding of the process to make other more in depth blog articles make sense!
Frequently Asked Questions.
Question: Does the phone have to be rooted to use Heimdall?
Answer: No.. but you have to be able to get your phone in to “Download” mode so that Heimdall can talk to it down a USB cable. Google it for your phone.. usually a combination of holding specific keys to start the phone.
Question: Is it better to have a rooted phone to use Heimdall?
Answer: If you are just using Heimdall to fix a trashed phone ROM and restore it to factory, then not so much, but if you are going to get into flashing ROMS then rooting is really the first step.. and the second step is installing something like <i>clockworkmod</i> so you have better control of recovery process. E.g. it lets you create full backup images of your current install before trying something new for easy restore.
Question: After flashing a custom ROM (or even rooting) what’s next?
- a) Install something like ROM Manager and play with performance settings, e.g. Performance: On Demand will change your life.
- b) Install Titanium Backup, and your phone has an SD card slot, regularily use it to back up “User installed apps” to somewhere on your external SD card. That allows you to flash a new ROM, and reinstall all your downloaded apps WITH SETTINGS to the new rom.
- c) Buy some NFC tags and use them places in your life where you can toggle on off things like wifi / bluetooth / cellular data and more, because you are going to need to cut back on battery usages where you can now that your phone is cranking full speed when in use (and they are cool).