Ahmed Sajjad Zaidi

Entrepreneur, trekker, and photographer based in Pakistan
Archive for 2011

Android 2.3.2 Swype fix for Galaxy S

Swype doesn’t quite work with Gingerbread (Android 2.3.2) on Galaxy S GT-I9000 due to a small, silly bug. If you attempt to select Swype as the input method, it gives the following error:
The Swype package you installed is configured for another device and will operate with limited functionality. Please contact Swype about this issue.

After much searching, I finally found a fix by Rawat, available here. In the device’s build.prop file, you’ll need to change this line:
ro.product.board=GT-I9000
to this line:
ro.product.board=herring
Here’s how to do this:

Prerequisites:

  • rooted device (I used the fix given here)
  • adb (can be installed from here)
  • USB cable

Steps:

These are the steps I followed to make it work (it’s simpler than it looks):

  1. Connect the device to your system via USB. Make sure USB debugging is on
  2. Copy /system/build.prop to your local system (I copied it in /tmp, using adb):
    adb pull /system/build.prop /tmp/
  3. Open the file in a good text editor (use one that doesn’t mess up the newlines, like vim). Search for ro.product.board=GT-I9000 and replace it with ro.product.board=herring
  4. Copy build.prop to sdcard:
    adb push /tmp/rom/build.prop /sdcard/
  5. Now you need to be able to write to the /system partition. Using adb shell, type su. At the # prompt, type:
    mount -o remount,rw /dev/block/stl9 /system
  6. If there weren’t any errors, copy the updated build.prop file to /system:
    dd if=/sdcard/build.prop of=/system/build.prop
  7. Reboot device:
    adb reboot

That should keep you Swyping until they issue an official fix. Hopefully, it is already fixed in Android 2.3.3.

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:

pushd android-sdk-linux_x86
./tools/android

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:

http://www.glassechidna.com.au/products/heimdall/

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


I must have spent hours trying to figure out why I couldn’t get my phone to go into Download Mode, a state where the phone isn’t running anything else and is ready to accept updates.

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 kill-server
./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:

  • CSC_XEE_JS1.tar.md5
  • PDA_JS7.tar.md5
  • PHONE_JPY.tar.md5

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):

  • s1_odin_20100512.pit
  • factoryfs.rfs
  • cache.rfs
  • dbdata.rfs
  • param.lfs
  • zImage
  • modem.bin

6. Start the flash

Warning! The --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.

Protest against dissolution of HEC

I have often argued that the root cause of the problems we are facing in Pakistan is the lack of education. Without proper education, we are unable to elect competent leaders or make any rational decisions as a nation. If almost half of our population is unable to read and write a single word, extremism easily flourishes and there is no way we can have a stable and performing economy.

This already desperate situation was dealt another blow this week after the government announced its plans to dissolve the HEC or Higher Education Commission. This federal body was one of the best performing organizations in the country (until its funding was drastically slashed) and oversaw some of Pakistan’s universities rise to worldwide prominence.

It’s hard to imagine what logical reasoning could have driven our glorious leaders to take such a catastrophic step. It makes no sense to hand over such a critical role to the corrupt and incompetent provinces. On this issue, I’d have to agree with the conspiracy theorists and also add a few theories of my own.

The HEC takes a strong stand against fake degrees and has had an exceptionally clean record. Once disbanded, our dirty politicians, many of whom hold fake degrees, would be completely free to run amock. Most likely, this was the main motivation behind the move.

It could also be a conspiracy to ensure that our future will remain in the hands of the corrupt few while most of our populations remains illiterate and powerless. How medieval is that?

Here is a message from Dr. Atta-ur-Rahman, one of the most respected men in the country and the man who can be credited with jump-starting the IT and Telecom sector in Pakistan. He had been heading the HEC during its best performing years.

A demonstration in protest of the dissolution of HEC is being held tomorrow (Tuesday, April 5th). You can join in through the Facebook event Defending HEC.

Samsung Galaxy S

I’m writing this from my new Samsung Galaxy S, my first ever Android phone. I was considering buying the Tab instead, but lots of bad reviews put me off it (size is not much of an issue, especially if you use it with a Bluetooth device).

It took a lot of sweat and tears, but I now have it pretty much the way I want it. Wasn’t planning on getting into the nitty gritty this time, but ended up hacking it to pieces.

More on the surgery i did later.