Flashing Android on Galaxy S using Linux
My Samsung Galaxy S is doing relatively well. I’ve found some amazing apps for it and it is both productive and fun, though it is probably in for another update. Like I said, I wasn’t planning on doing anything funky with it at first, but Sohaib convinced me to work on it to get the most out of it.
The first thing I was advised to do was to update the phone to a newer version of Google’s Android mobile operating system. Sounded simple enough, but as I later discovered, it was a little confusing and tricky. Especially since I wasn’t using a Windows system to do this. It can be a pain, even on a MacOS laptop/PC.
There is a chance that you might end up bricking your shiny new phone so just to give you an idea of what you might be getting into, read this forum thread first. The worst case scenario is where your phone fails to even turn on. Even in that case, there is a way to reset it using a custom connector which you can purchase or make yourself.
You should also familiarize yourself with the XDA Developers forum. It has lots of useful information on everything Android.
With that out of the way, here are the details of what I did and how you can flash your Galaxy S:
(Note: These methods were tested and worked on Ubuntu Maverick 10.10 and Ubuntu Lucid 10.04. They may differ slightly for other Linux systems)
1. Get the Android SDK Platform Tools
There is a chance you might not need this package, but most probably, you do. Even if you don’t, the tools within are very useful to have around.
Download the SDK from here. The Linux package contains a folder by the name of android-sdk-linux_x86. Go into this folder and run the SDK Manager, like this:
Now from the “Available Packages” menu, install the Android Platform Tools. This contains adb, a small utility you can use to control a number of low-level functions on your Android phone.
If the above step works ok, you should have adb installed in the platform-tools folder under android-sdk-linux_x86. Add it to your path to avoid having to re-type the full path every time.
2. Get Heimdall
Heimdall is an awesome piece of open source software that allows you to flash ROMs or firmware onto your Galaxy S smart phone. Some say it’s a lot better than Samsung’s own software or the one most Windows users use, Odin. Get Heimdall here:
I’d suggest getting both the graphical tool, as well as the command line (if you’re comfortable with it). I got the latest version (1.1.1, at the time of this writing).
3. Get Download Mode working
You normally do this by holding down the Volume Down, Home and Power buttons. Flashing your device without this is a little risky, but no matter what I tried, it didn’t work. Seemed that my phone wasn’t configured for the 3-button Download Mode and I had to install a fix to get it to work.
More details can be found here, but I got it to work like this:
Download RAZ_P-SBL_SGS.tar and run this:
tar xf RAZ_P-SBL_SGS.tar
(this will extract the files boot.bin and Sbl.bin to the current directory)
Use adb to reboot the phone into download mode:
./platform-tools/adb reboot download
You should see the phone reboot and the appearance of the distinct “android at work” logo, like the one in the above photo.
Now, you can use Heimdall to update the boot loaders:
heimdall flash --primary-boot boot.bin --secondary-boot Sbl.bin
This should take a couple seconds, but once done, you’ll be able to go into Download Mode using the 3-buttons (Vol Down + Home + Power).
4. Decide on the version and type of Android ROM
Once that step is complete, you can move onto flashing the ROM/firmware of your choice. It seems that there are various types of ROMs availabe. Leaked ROMs, official ROMs, custom ROMs etc.
If you’re like me, you can go with an official or Stock ROM. This XDA thread has a whole list of stock firmwares for the i9000.
However, you may want to look around and pick a custom ROM that suits you. There are ROMs which are greatly trimmed down to the essentials so you get a bare-bones phone on top of which you can install what you like. Or you can get a feature-rich one. Here is a site with a good collection of custom firmwares.
5. Prepare the necessary files
In any case, pick one and download it. These are often packaged as self-extracting Windows executables. I thought this may be a hurdle on Linux, but running the exe file with wine extracted the files just fine.
I got the I9000XWJS7.exe file (Android version 2.3.2, codename Gingerbread) and simply running
wine I9000XWJS7.exe extracted it into it’s own folder. Inside, there were these three files:
These are standard tar files and you can extract them using the tar command:
for a in CSC_XEE_JS1.tar.md5 PDA_JS7.tar.md5 PHONE_JPY.tar.md5;do tar xf $a;done
Search and download the appropriate .pit file for your phone. I needed the 512 version which can be downloaded here.
Now you should have the following files (depending on the ROM you downloaded):
6. Start the flash
--repartition flag will destroy any data you might have on your phone. Save it to your PC or to your SD card if it is worth saving, or run this command without the “–repartition” and “–pit ….” flags.
heimdall flash --repartition --pit s1_odin_20100512.pit --factoryfs factoryfs.rfs --cache cache.rfs --dbdata dbdata.rfs --param param.lfs --kernel zImage --modem modem.bin
Once this command completes, the phone should automatically boot into the new system. That should be all and you should have an updated mobile. I updated my phone from Android 2.1 to Android 2.3.2 and it felt more colorful, a little faster and even the battery life had improved.
I am however having some issues with the phone. It sometimes shuts down or reboots after a long call and running a few different apps together also causes it to hang, slow down or power off. There is an Android 2.3.3 update available which will probably help with these, but I’ll save that for some other day.
One Response to “Flashing Android on Galaxy S using Linux”