Rooting my Android phone

This morning I rooted my android G2x. The main motivation was curiosity, but there were a few things that I wanted to improve about my phone. T-Mobile didn’t pre-load too much junk onto the phone, but there was the T-Mobile app-pack and Mall, Nova and Tegra game stores, and the lite version of TeleNav. Also, to get a good ad-blocker you need to have root access.

So I took the plunge and rooted the phone. There was a point when I thought the phone was bricked, but it all worked out in the end.

Even without the mistakes that I made, I would say that the benefits do not justify the effort (at least for my phone). I am glad that I did it, but more for the experience than the end result.

I picked the CyanogenMod ROM to replace my stock ROM since it seemed like the most popular and best supported ROM. Their web page even had step-by-step instructions for rooting the phone, installing a ROM manager, backing up the phone and installing their latest ROM.

I first wanted to try out the built in backup/restore capability. It is accessed by holding volume-down while turning on the phone. This was supposed to bring up a GUI where I could backup my current setup. Instead, this just did a factory reset and deleted all my apps. I had backed up the SD card and I use Google for all my contacts/calendar/mail, so all of that was safe, but settings and apps were lost.

The first step to installing a new ROM is to root the phone. The cyanogen page had instructions, but I had read about a simpler way with unlockroot.com. This is a windows application that roots a wide variety of phones. The G2X is supported and I already have the phone drivers installed, so it was just a matter of running the program.

The second step is to replace the default boot loader. This is the risky part of the procedure since the boot loader is used to recover the phone if the ROM doesn’t load. I followed the cyanogen instructions and downloaded ROM manager from the app store. It needed root permissions and successfully replaced the boot loader.

The third step is to download the ROM that you want and put in on the SD card. The ROM manager can do this step for you, but I did it manually so that I could get the version that I wanted.

Finally you use the ROM manager to load the new ROM. I did this from the ROM manager app on the phone which was a mistake. It seemed to be working: after rebooting, the boot loader came up, made a backup of the existing ROM, installed the Cyanogen ROM and rebooted. However, the new ROM didn’t work. I still don’t know why it didn’t work since I did get that same ROM to successfully load eventually.

Now that the main ROM didn’t load, I needed to use the boot loader to restore the backup. I could get the boot loader to come up, and I could move the cursor with the volume buttons. But I couldn’t select anything. It is supposed to use the power button, but apparently that doesn’t work with the G2. At this point I thought that the phone was bricked. The main ROM wouldn’t load and the boot loader was unusable. Lesson learned: Try out the boot loader first.

After doing some internet research, I found out that the G2x has an APX mode that you can use to load a boot loader. I also found a boot loader called NVFlash that works with the G2x. The APX mode is very strange. You have to take out the battery, press volume up and down, then plug in the usb cable. Windows sees the APX device and you can install the drivers. Then you run the NVFlash “OneClickRecoveryFlasher” which will load a variety of boot loaders.

With that boot loader I was able to use the phone controls to make selections and loaded the Cyanogen ROM again. This time it worked and the phone booted to Cyanogen MOD.

After that there were two major problems. One was that the phone wasn’t treating the internal SD card and memory the same way that it did before. I wasn’t able to plug the phone into the computer and see the files. This had to be fixed by changing where the phone mounted the internal SD card. To do this I had to remount the file system as read-write, change the permissions on two files and edit them with a downloaded text editor app.

The second problem was that I couldn’t get Swype. I’ve gotten very used to it and it is far superior to the stock android keyboard. I went through Swype’s system and signed up for their beta, downloaded their installer app which then couldn’t download the actual app. I couldn’t figure out what was wrong with that, but I did find instructions for pulling the version of Swype that came with the G2x and reinstalling it.

So, if I were doing it all over from scratch again here are the steps needed:

  1. Install the windows LG drivers
  2. Download the ROM and copy it to the root directory on the sd card.
  3. Download and run the unlockroot application from unlockroot.com
  4. Download the APX driver and NVFlash app from djmcnz.batteryboss.org
  5. Remove phone battery, hold vol up and vol down, plug in USB
  6. Install the APX driver for the unrecognized APX device. Unplug the USB
  7. Remove phone battery, hold vol up and vol down, plug in USB, run the NVFlash app, install a boot loader, release vol-up and vol-down, unplug USB.
  8. Replace the batter, hold vol-down and turn on phone.
  9. Backup up the existing ROM and install the new ROM with the boot loader
  10. Reboot.
  11. Go to the android-sdk/platform-tools and run adb shell
  12. su and then re-mount the /system partition with read-write (mount -o remount,rw -t xxx /dev/xxx /system)
  13. Change permissions on /etc/vold.fstab and /system/build.prop
  14. Edit these two files to mount emmc to /mnt/sdcard and sdcard to /mnt/sdcard/external_sd
  15. Extract the Swype.apx and .so from the old /system and /system/lib directories.
  16. Put Swype.apx in /system and /sdcard. Put the library in /system/lib
  17. Run the Swype.apx off the sdcard to install it
  18. Download AdAway from the market and run. It updates the hosts file to remove ad servers.

There are some good instructions at http://theunlockr.com/2011/05/03/how-to-flash-a-custom-recovery-image-on-the-t-mobile-g2x/ and http://forum.xda-developers.com/showthread.php?t=1049154

Leave a Reply