Getting root on a UK T-Mobile Galaxy S

It’s a bit weird. The process was really easy, but none of the tutorials I found worked; each stopped working at one point or another. So, assuming other people will hit the same barriers and want a Just Works way to get root, I’ve gone through my terminal history for the bits that worked. Obviously, this is just what worked for me; I can’t guarantee it’ll work anywhere else though if you’re at all familiar with the process it’ll probably look right. The only real stumbling blocks I hit were getting a recovery menu (unfamiliarity with adb) and picking a ROM that I could trust. There was nowhere near enough diligence in that bit of the process, though. Bad Avi. Also, for those still expecting disclaimers, this voids warranties.

I can’t find a reboot-and-hold-down-X-key method of rebooting into recovery mode (the boot menu) that works, and it seems to be different for each variant of this device in any case. Using adb, the Android debugger, does work, and contrary to several scare stories doesn’t require proprietary Samsung drivers.

adb’s really easy to make work. First, install a jdk. You might do this differently if you’re not running Debian:

[email protected]:~# apt-get install sun-java6-jdk

While we’re here, if you want to suggest a more interesting hostname, go for it. I’m having a bit of an imagination failure in that department.

Next, you need to grab the tarball of the Android SDK, extract it somewhere and make its tools subdir part of your $PATH. You probably should do most of this as some user that isn’t root, but I was rather excited at the time:

[email protected]:~# mkdir adb && cd adb
[email protected]:~/#wget -q
[email protected]:~/# tar -xzf android-sdk_r07-linux_x86.tgz 
[email protected]:~/adb# ls android-sdk-linux_x86
add-ons  platforms  SDK Readme.txt  tools
[email protected]:~/adb# export PATH=${PATH}:/root/android-sdk-linux_x86/tools

Now (or perhaps while you’re waiting for the tarball to arrive), enable USB debugging on your phone. It’s under Settings -> Applications -> Development for some reason. Check the box next to “USB debugging”. You’ll need to have the USB cable unplugged. Plug it back in again, then, returning to your shell with adb in its path, check for the presence of your device:

[email protected]:~/adb# adb devices
List of devices attached 
90006e8ba84e    device

If yours doesn’t show up, I’m not really sure what to do. Google?

Now, you need to have the somewhere. I’ve uploaded the one I’ve used to here but this’ll work for any of them.

[email protected]~/adb# wget -q

If UMS works on yours, copy with your favourite file copying method. Mine didn’t, so I used adb. There are two sdcards in the Galaxy, an internal one and an external (removable) one. The internal one is mounted at /sdcard, the traditional location of removable ones, and the external one at /sdcard/sd. You want to put in /sdcard, not /sdcard/sd.

[email protected]:~/adb# adb push /sdcard/

You then use adb to reboot into the recovery menu:
[email protected]:~/adb# adb reboot recovery

Select “Apply” and wait while it installs it, then “reboot system now”. You now have root. The quickest way I can think to test it is to download and install the ‘superuser’ application from the market, then test it with adb:

[email protected]:~/adb# adb shell
$ su

You’ll get prompted (on the phone) to allow an unknown application root access, and then you’ll have root. Congratulations, your phone is now yours. :)

Now, I’m off to follow the rest of How to make the vibrant software not suck, ’cause it’s shocking out of the box.

Giving Android a swap file

I don’t know if it’s because I’m doing more with it than I used to, or the rose-tinted specs that come with the novelty value have worn off, or if the later updates have been designed for more powerful hardware, but my G1’s been lagging a bit recently, so I figured I’d have a look at what I can do to make it faster. Turns out it’s quite receptive to the idea of a swap file.
You’ll need root access for this – everything below is to be run as root. Following is how I did it on my cyanogen’d G1, but I don’t see why it wouldn’t work on anything else – it makes use of standard linux tools. This will likely advance the death of your sdcard – it increases the reads and writes by some large margin. I don’t know enough about sdcards to know how much quicker it will die, but modern ones will likely deal with it better than older ones.

Anyway, in your terminal emulator:

dd if=/dev/zero of=/sdcard/swap bs=1M count=100

You can call it whatever you like. The ‘count’ value (100 above) is how many MB of swap space you want. The above will create 100MB of swap.
This will take a few seconds (of the order of 50), so if it’s ‘hung’ it’s probably not crashed.

Then we make it into a swap file and activate it as swap space:

mkswap /sdcard/swap
swapon /sdcard/swap

Finally, we want to change the swappiness of the system. When the system memory is completely full, and more is requested, the kernel needs to work out how to create some space. It, generally, can do one of two things: drop some filesystem cache, or move some application memory to swap.
The swappiness value dictates the priority of either – a value of 0 means it will always try to drop fs cache rather than use swap, and a value of 100 means it will always try to use swap and preserve the fs cache. Only values between 0 and 100 inclusive are allowed, and neither guarantees any action – you can still find yourself swapping out at 0, for example – just the priority afforded each solution.
The default value for the Linux kernel is 60, which is generally not appropriate for something running completely from flash media (where the fs cache isn’t so important). So I’m dropping it to 20, which seems to work for me. If it doesn’t for you, try some other values, it’s an on-the-fly change.

echo 20 > /proc/sys/vm/swappiness

On rebooting the phone, the above settings wont hold. The swap file will still be available (assuming the SD card is still inserted), but on reboot you’ll need to run

swapon /sdcard/swap
echo 20 > /proc/sys/vm/swappiness 

On the plus side, you’ll be rebooting less.

Cyanogen on my G1

I’ve just upgraded to Cyanogen on my G1 and it’s lovely. Well, I got root, which is basically what I always wanted.

I basically followed the instructions on the Cyanogen wiki and everything worked exactly as described, I’ve nothing really to add here except to say it’s brilliantly easy and everyone should do it.
One small note, though, the final reboot into Cyanogen takes a long time. Mine took just shy of thirty minutes, and I’ve read of others taking anything above about 15.

The first obvious benefits are root access, exchange activesync support, five workspaces (as against the stock 3) and a bunch of useful apps already installed, including a nifty power control widget which replaces my collection of 5 distinct widgets. I’ll write more on it when I’ve used it more.
In case, as I did, you’ve been pondering this and wondering what the end result is like, it’s almost exactly as previously, but with some new features, there’s some screenshots on the webpage. I’ve not yet found anything to have been degraded by it, and it all looks and feels the same, but a bit more polished in areas. Though it only ships with one ringtone.

Android G1 factory reset

With the phone off and the battery in, press and hold <power>+<back> for 20 seconds or so. You’ll get the standard G1 splash screen, then a screen with an exclamation mark.

Press <alt>+<L> to get to the System Recovery screen. Here you’re presented with four options:

reboot system now [Home+Back]
apply [Alt+S]
wipe data/factory reset [Alt+W]
wipe cache partition

Which you should be able to choose from with the scrollball or use the key combinations for.

Android Issues

Some of this might well be rendered obsolete by the 1.6 update I’ve just received.

GMail Client
No bottom- or inline-posting, only top-posting. And, while you’re at it, there’s no way to read the quoted text while replying.
You have to read to the bottom of the email to get to the reply button, which is an odd move from someone who promotes top-posting. It’s not even in the Menu.
There’s no way of editing Labels or Filters.

This is very different to the GMail one, I don’t know why.
It also doesn’t honour read/unread flags in IMAP folders, and I continually get notifications that I’ve got new mail that arrived six months ago.

To set the date in the calendar you have three boxes, year, month and date1 which are adjusted by either entering in the date, or a + and – button on each. This is fine when you don’t go over a month boundary, at which point it gets confusing. Since nearly everything I plan is for ‘next wednesday’ or so, about one in four of my appointments require more thinking than I think they should.
There’s no way to add calendars that are not already available to the www version of your calendar.

Google Docs
Editing documents is possible, but creating for some reason isn’t. Also, no control over labels.
As in Mail and Calendar, there are web versions of these optimised for the Android screen, but they’re similarly crippled.

When viewing the contact, everything that has a number has a ‘call’ and a ‘text’ option, which fills the screen with never-used options.

When entering a name into the To: field, the first suggestion is as if you were writing a word with a keypad. For example, entering ‘mum’, the first option is ‘686’
Once you’ve scrolled past the useless entry and selected the one you want, the field is populated with name . Which is only an issue if you want send a message to more than about ten people, since you run out of characters in that field.
Enter is send. This is not a problem, but I _never_ remember and send multiple messages when I mean send.

Google Maps
When selecting start and end points for directions, recently chosen points are arranged alphabetically, not in the order in which you used them. And they’re not named by how you searched for them, but by what Google calls them.

Everything’s Massive
Google took a very straightforward approach to lists and fingers – make the buttons huge. I’d like more than two options per screen, though, and I think varying the length of the buttons would be a better approach.

  1. The order is configurable []