Installing a custom ROM on the SGH-I727R

I’m a fan of running customized ROMs on my phone. There are three reasons: a) I like to tinker b) It provides added capability and longer currency for my phone c) I can get source for most of the code running on my phone. In this post I’ll talk about installing CyanogenMod 10, but a good part of this will be applicable to any after market ROM.

First I like to gather data about the state of the phone as it came to me. These details can all be found in the “About Phone” screen.

SGH-I727R
Android 2.3.5
baseband I727RUXKJ7
Kernel 2.6.35.11
Gingerbread.RUXKJ7
IMEI XXXXXXXXXXXXXXX
IMEI SV XX

I’ve omitted my actual IMEI, but you’ll want to record that as it is possible to accidentally wipe it out on some phones. Fortunately as this phone came to me in the actual retail box, the sticker on the box matched the details here too.

The next step is to spend some time reading up on how to modify the firmware (ROM) and how to restore to stock. I’ve said this before, but it’s worth saying again: there is a lot of mis-information out there about how to go about this. Primarily this is because people don’t really understand what they are doing and simply provide instructions that seemed to work for them, voodoo magic included. An example is this youtube video I came across – well, it does give you confidence that it can be done, but there is no need to root your phone before installing a custom recovery.

If you’ve done any searching at all, you’ll have come across the XDA Forums, I do recommend signing up and reading through the relevant forums. Learn to search for answers, and share what you do know with folks who don’t. The newb starting guide is a good place to start. Also since my primary target is CyanogenMod, usually a good place to start is with their wiki – however, in this case it wasn’t.

The first step is to get a custom recovery image installed. ClockWorkMod (CWM) is the preferred solution for CyanogenMod and I’m familiar with it. To install it we need a tool that will talk to the download mode of our phone, and we need to get our phone into download mode. The tool I prefer to use is heimdall, it worked well with my i9000 and it’s also friendly to Linux. The other option is Odin (download link), a Windows only tool.

To enter download mode, the Rogers version is slightly different than the AT&T version – only volume down needs to be held with power (not volume up & volume down).

If you are successful you should be greeted by a screen as per above. Now assuming the USB cable is attached we can start the tool to send down the custom recovery image.

Sadly this is where I went off the rails a little, it turns out the version of heimdall (1.3.1) I had didn’t quite support the protocol being used by this phone. Upgrading to a newer version did fix the connection problem, but then it failed in another way I can only assume is also related to the protocol.

$ sudo ../Heimdall/heimdall/heimdall flash --recovery recovery.img
Heimdall v1.4 RC1

Copyright (c) 2010-2012, Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/

This software is provided free of charge. Copying and redistribution is
encouraged.

If you appreciate this software and you would like to support future
development please consider donating:
http://www.glassechidna.com.au/donate/

Initialising connection...
Detecting device...
Claiming interface...
Setting up interface...

Checking if protocol is initialised...
Protocol is initialised.

Beginning session...
Session begun.

In certain situations this device may take up to 2 minutes to respond.
Please be patient!

Releasing device interface...

And that was it, my phone was busted.

I did try several times to recover using heimdall and failed. So it was off to Windows to use the Odin tool to fix things.

I initially tried to simply install a version of CWM and then proceed from there, but I made a few mistakes. 1) I didn’t have the right version of CWM, I can’t explain this but I do admit I was thrashing a little here. 2) I did have some partial successes which probably left things in a somewhat dubious state causing my grief later when I was doing the right things (see log below).

E:Can't open /cache/recovery/log
E:Can't open /cache/recovery/log
E:Can't open /cache/recovery/last_log
E:Can't open /cache/recovery/last_log

The solution is to return to stock and start fresh. Thankfully Odin was quite happy to flash the stock version I got via XDA.

I did locate the correct version of CWM via the CM10 thread on XDA, I found the TeamChopsticks install guide quite helpful. Once I had the right mojo, things went smoothly.

Starting from stock
Install recovery via Odin, boot into recovery
Wipe & factory reset
Format /system
Flash CM10 nightly zip
Flash google apps zip (optional)
Reboot

I like to have SSHD running on my phone along with rsync to allow for nightly backups to happen. Unfortunately CM10 isn’t yet shipping with dropbear pre-installed, and the CM7 version doesn’t seem to be happy anymore. I’ve switched to using the DropBear SSH Server app, the one downside is that it doesn’t auto-start on boot. I’ve been in touch with the author and this is on his future feature list.

A few notes on setting up DropBear SSH Server. The very first run will ask you to grant it super user privileges, it needs these so you need to say yes. Once the first screen is all green, you can test the server – the default root password is 42. Once you’ve verified it’s working, we want to fix the password under settings. I use keyed logins, and the app does support importing keys from files – but only one key per file. Once you’ve setup some keys, you can disable password logins entirely.

In CM10 you’ll probably want to enable USB Storage under Settings->Storage, then press menu to bring up ‘USB computer connection’ where you can opt in for USB storage (it is off by default).

Somewhere during the set of events I managed to end up in a state where the Radio version reported in About Phone was ‘unknown’. Phone calls worked fine, and I ran a couple of days without noticing this. I did later reboot into recovery and install a more up to date radio/modem firmware (I727RUXLF3). While I was in recovery I initiated a backup which I can return to if things get really messed up, this is handy as it is stored on the external SD card and is available even if I’m not somewhere with a computer and need to fix the phone.

CM10 has a new over the air (OTA) update system, I used it for the first time tonight to move to the latest nightly. Very slick, but there didn’t seem to be an option to back-up my existing state.

So aside from a few heart stopping moments where my brand new phone was totally fubar‘d, this was overall a pretty typical experience with a new device. Plenty of little details to figure out, a few new tools to install/configure/learn and the excitement of new hardware (and software). I’m really pleased with the i727, the screen still feels really big (but not too big). It’s fast and the battery life is very good. Google Now also recently added the ability to enter calendar events, resolving one of the few things I found it couldn’t do – and yes, Google Now is pretty darn cool.

Restore Rogers Galaxy Tab 7 to stock

When I got my Galaxy Tab 7″ one of the first things I did was to see if I could collect the stock firmware in a format that was useful in case I ever wanted to restore the tablet back to it’s stock form. It turned out that the 2.2 based firmware was not easily available on the net, and neither was the 2.3 version.

The results of my work are captured in an XDA thread, but restoring from those captures was an exercise left to the reader. The 2.2 (froyo) image is captured directly from the device, I first rooted the tablet with SuperOneClick then used rotobackup to capture a heimdall friendly set of files for flashing. The original work was tracked in another XDA thread where you can read the blow by blow if you’re interested. For 2.3 (gingerbread) I was able to grab the intermediate files from Kies during the normal upgrade process – the rest of this post will talk about how to use those files to restore the P1000R to a stock 2.3 state.

I’m using heimdall version 1.3.1 on Linux, but other versions and platforms should work fine. I particularly like using Linux to flash the GalaxyTab as it doesn’t suffer the same driver madness that Windows seems to have, USB devices just work. I’ll assume you can find the download and extract the files.

You’ll want to specify the PIT file – gt-p1000_mr.pit, it’s safe to select the repartition box as we’ll be doing the full monty here [sharp eyed readers will notice that the picture at the top of this post doesn’t have the box checked, that’s a mistake on my part – go ahead and check it]. The files map to the heimdall partition names as follows:

MODEM -> modem.bin
CACHE -> cache.rfs
KERNEL -> zImage
FACTORYFS -> factoryfs.rfs
PARAM -> param.lfs
IBL+PBL -> boot.bin
SBL -> sbl.bin

So click on the Add button and specify the partition type and files from the downloaded and extracted ROM.

Next you need to get your device into download mode. My preferred approach is to hold the power+volume down buttons until the download screen appears (yellow triangle with android digging). Now you can click start on heimdall.

Under Linux at least , this will hit 100% and then fail to reboot. That’s ok. Wait a minute or two to make sure it’s really done, then force it to reboot into recovery mode by holding power+volume up until you see the recovery screen.

Assuming the flash has gone well, the stock recovery will start up and automatically try to install some updates. You should see:

-- Updating filesystem...
E:failed to mount /dbdata (Invalid argument)
E:discard_filesystem_for_rfs:Can't mount /dbdata

-- Wiping cache...
Formatting /cache
Cache wipe failed.

Don’t panic. Remember that this update was expecting to have come from a properly installed 2.2 stock, we’re leaping into the middle of the process.

Using the recovery menus, select ‘factory reset + wipe data’ followed by ‘wipe cache’. One hint for those not used to the stock recovery image, the capacitive home button is used to select entries and volume up/down for navigation.

Now you can reboot. The first boot will take a while as it sorts things out and rebuilds the cache(s).  All should go well and you’ll be greeted by the stock home screen.

 

i9000 ICS – CyanogenMod 9 Alpha

One of the things that I look for in a phone is community support. For me there are two main reasons this is important: 1) It’s nice to have a large group of people you can ask questions of, or an active forum you can search for answers on 2) When later versions of Android are released, that community will hopefully build a version for your phone.

If you’ve been watching the tech news, there have been rumors that Samsung will support Ice Cream Sandwich (ICS) on the Samsung Galaxy S (SGS) and claims that it won’t. The latest news appears to be that they will not upgrade the device, a bit sad as it was only released 18 months ago. So not even kept current through the length of most cell company contracts. This is one area where the iPhone has done right for the consumer.

If you’re interested in getting ICS for your i9000 (or in my case the i9000m) skip over to the XDA Forum and read through the huge thread. The team behind it are the same folk who helped bring CyanogenMod to the SGS originally and are now working on CM9. This is an alpha, there will be rough edges and I don’t suggest people leap in unless they are very brave.

I originally tried Build 11 and that didn’t work well enough for me to switch from the 7.1 stable I was on but it was close. Build 12 appears to be quite good, with a few changes I needed to make for my usage, specifically adding dropbear (SSHD) and rsync so I can do nightly backups (which I’ll talk about at the end of this post).

The forum thread has these instructions for people coming from CM7

 Upgrading from CM7?

  1. Do a Nandroid Backup!
  2. WIPE (wipe data/factory reset + wipe cache partition)
  3. Install the ROM from internal sdcard using ClockworkMod (CWM) Recovery
  4. Optionally install the Google Addon

I would recommend that you consider getting CM7 first, it’s a good base to work from and there will be better how to and help to get it working. Experience there will translate over to working with the ICS Alpha.

Here are my steps I used when moving to ICS .

  • Do some backups of your application data
    Backup SMS using SMS Backup+
    Backup Plume settings (and any other apps that support backup)
  • Take some screenshots of your home screens, nice reference to what you have. Also consider grabbing a list of the apps you have installed
  • Reboot into recovery – perform a backup in CWM
    “backup and restore -> Backup”
  • Mount USB mode in CWM
    ” mounts and storage -> mount USB storage”
  • Copy backup to PC (just in case something really bad happens)
  • Copy new ICS Alpha files to phone
    teamhacksung_galaxysmtd-ota-eng.BUILD12.zip
    gappsv7.1.zip
  • Now wipe from CWM
    “wipe data/factory reset”
    “wipe cache partition”
  • Install the two .zip files we copied above, build12 first.
    At this point my heart always stops, as during the install of the firmware, the phone will reboot suddenly. Do. Not. Panic.
    It will automatically boot into ICS after the install. Now optionally reboot into recovery to install gapps.

There is a list of known issues in the main thread, you can post bug reports there but please search the thread so you don’t ask something obvious. There is another thread for discussion (ie: anything that is not a bug report).

Each time I’ve done this type of upgrade I seem to get burned by the Android Market treating the new ROM as if it were a new device, thus it doesn’t restore any of my apps. Good thing I had taken a backup of the list above. Having done this a few times, using a desktop web browser to the Market and installing from there to my phone is much faster.

My experience so far

The good stuff:

  • ICS is very, very pretty
  • Recent applications with preview is cool
  • Quick access to camera on lock screen is nice
  • Web browser handling of multiple windows more like iOS Safari
  • Calendar is a big improvement, phone interface much nicer too
  • It has USB mode instead of MTP

Why it’s still an alpha

  • I was unlucky and had a sync problem with the calendar
    This is a known problem with a solution – flash the gapps_fixer.zip
  • Every once in a while the lock screen has no touch response, lock/unlock again with power button fixes
  • I had mapped long press menu to search, that CM feature isn’t supported (yet?)
  • I miss “quiet times” from CM – using Sound Manager v2 to get same function
  • Power-off sound comes a while after screen is dark – I disabled the sound to resolve

So far no major issues. Only 1 of the ~50 apps I use indicated it wasn’t compatible – and I’m sure that’s just how they’ve tagged it in the market. The battery life appears to be about the same as CM 7.1.

One observation was my modem didn’t change from KG3 unlike my experience flashing CM7 where the modem did change, it seems my understanding of how the modem is updated (or not) is flawed.

I also briefly tried out a pure AOSP from Onecosmic and while it seems a bit more mature than the CM9 Alpha, it didn’t fit what I wanted (personal taste).

Getting SSHD and rsync working

I had previously written about getting SSHD working on CM7.1 and that I used rsnapshot to do incremental nightly backups of my phone. This has saved me at least once when my phone got very sick and needed to be wipe and freshly installed, having a day old backup was nice. Also when going from version to version I’m able to grab configuration details like the dropbear configuration – this allows me to reuse the same keyed ssh login without having to repeat the entire setup.

The ICS Alpha was missing dropbear. It turns out that the version from CM7.1 can be used – I specifically picked the ones from nightly build 181.

First you need to remount the /system filesystem to be read-write.

mount -o remount,rw /dev/block/mtdblock2 /system

Grab dropbear, dropbearkey and rsync and put them in /system/xbin. Make sure to use chmod 755 on them to make them executable. Probably a good idea to reboot after this.

As I’m going to re-use my configuration files from my backup, I don’t need to use the setup steps from my blog post – I just use the abbreviated version below, but if you’re doing this clean follow the original write up.

# mkdir /data/dropbear
# mkdir /data/dropbear/.ssh

Copy the following files from backup to the phone

/data/dropbear/.ssh
/data/dropbear/.ssh/authorized_keys
/data/dropbear/dropbear_rsa_host_key
/data/dropbear/dropbear_dss_host_key

Then just fix the permissions

# chmod 755 /data/dropbear /data/dropbear/.ssh
# chmod 644 /data/dropbear/dropbear*host_key
# chmod 600 /data/dropbear/.ssh/authorized_keys

The ICS Alpha is also missing the ability to set the hostname, you can hack around it by using the following command.

# setprop net.hostname yourhostname

And of course, we need to launch dropbear

# dropbear -s -g

I still need to figure out how to get these into a script that will run on reboot, for now I’m just doing the last two command manually after every reboot.