Saturday, February 16, 2013

How to Install CyanogenMod on an Android Phone

http://www.linux.com/learn/tutorials/698725-how-to-install-cyanogenmod-on-an-android-phone


CyanogenMod offers a customised open-source firmware version of Android for a variety of phone and tablet hardware. It provides some features not available in the vendor-supplied firmwares, it's more customisable (if you want, you can build CyanogenMod for yourself), and it allows you to avoid the bloatware that comes with vendor firmware. It also tends to give quicker access to updates. There are a few more reasons, too, why you might want to try CyanogenMod; for me, the opportunity to lose a particularly annoying piece of proprietory software on my Galaxy S2 was a big gain. Read on for my experience installing CM on a Galaxy SII.
As per CyanogenMod's general disclaimer, you mod your phone at your own risk!
cyanogenmod boot screen
The CyanogenMod boot-up screen.

Getting started

If you have any irreplacable data on your phone that's not already backed up elsewhere, now is a good time to back it up. (Discovering that my phone was refusing to connect correctly to my laptop to do this further encouraged my modding efforts.) User data stored on the SD card should not be lost, but this sort of process is always a bit risky (and not all apps obey correct data storage expectations).
The details of install will vary between devices. The list of supported devices links to an install guide (to install a pre-built image) and a build guide (if you want to build your own image). I'll look here at the install process, but if you're interested in building your own version, the CM docs are pretty helpful. Unless you're experienced, it's best to try out a pre-built release first before starting down the DIY route.
In my case (with a Galaxy SII), I downloaded the Heimdall Suite and ClockworkModRecovery to my laptop to get started. I then followed the wiki instructions to boot the phone into download mode and used Heimdall to push ClockworkModRecovery onto it. (A note: I was using my Mac laptop to do this rather than a Linux box, and ran into problems with an "ERROR: Claiming interface failed!" error. This page (including the comments) got me sorted.) At this point, I had a custom recovery image on my device, which would allow me to install the CyanogenMod firmware.

Installing the firmware

Next step was to download the relevant build for my device (again, note that this is device-specific! Check the location of the files for your own device on the wiki.). To push this onto the device SD card, the instructions give the command
adb shell mount /data
According to the docs this should indeed work, but I got an (unhelpful) error message from ADB. Instead, I used the interactive shell, exited it, and then pushed the image to the SD card:
$ adb shell
~ # mount /data
~ # exit
$ adb push cm-10.1-20130208-NIGHTLY-i9100.zip /sdcard/
Having done that, I booted into recovery mode on the phone. The SII requires you to hold down Volume Up, Home, and Power (all at once; bring your extra fingers!) to do this, and you need to keep holding them down until you see the recovery screen.
Note! At this point, there is a backup/restore option on the ClockworkModRecovery screen. I strongly recommend using this, even if you already backed up any irreplaceable data. But then, as an ex-sysadmin, I am professionally inclined to backup paranoia. It's your data; it's up to you what you do with it.
This brought me to the scary part: choosing 'wipe data / factory reset' from the CWM menu. After this, you should be able to choose 'install zip from sdcard', choose the CM file you installed with adb push above, and away you go. However, I was unable to find this file on the sdcard. Instead, I installed it to the internal sdcard with
adb push cm-10.1-20130208-NIGHTLY-i9100.zip /emmc
and was then able to find it via the 'install zip from internal sdcard' menu option.
More troubleshooting: While doing this, I also had the problem that adb failed to recognise my device. After a few rounds of removing and reinserting the USB cable (both ends), restarting the adb server, and restarting the phone into recovery mode, I finally had success with using the 'advanced - reboot recovery' option on the phone's CWM menu. To be honest this is just voodoo as I have no idea why it stopped working in the first place or why it started again; but if you have the same problem, give it a go.
The install complete, it was time to hit 'reboot system now' on the phone's CWM menu.

How bleeding-edge are you?

Your options when choosing the CM file to download are:
  • Stable: What it sounds like. This ought to work OK. The link from the device page may not work if there's no very recent stable release for your device. Try Google or browse through the download site.
  • Monthly: A bit less stable than stable, a bit more up-to-date. Being considered for release, so ought to basically work.
  • Nightly: Bleeding edge. Use at your own risk. May well not work properly.
I tried a nightly build first, since ideally I wanted CM 10.1 (based on Android JellyBean). Sadly it crashed (literally) every second, so I retreated to the stable (9.1.0) version for my phone (based on Android Ice Cream Sandwich). To do this, I botted back into the CWM menu, used adb push to install the stable version to the internal SD card, did another factory wipe (when I tried without this it hung on boot), installed the 9.1.0 zip to my phone, and rebooted, this time successfully.

Google Apps

CyanogenMod no longer includes any of the Google Apps (Play Store etc) due to copyright issues. To install these, I had to download from goo.im, and install using adb push. (Alternatively you may be able to download and save the file straight to your phone.) I installed the zip file by shutting the phone down again and booting back into recovery. I installed to/emmc/ as before, but this time it was accessible under 'sdcard' rather than 'internal sdcard'. This may be a reflection of the way that CyanogenMod organises the internal storage as compared to the default Samsung method. This went smoothly; the only really annoying thing was that I then had to go through all my old apps reinstalling them one by one, and updating preferences. On the upside, that meant I could not install a whole load of rubbish that lingers around in my history; and unlike with a stock vendor install, there are very few restrictions on what you may and may not install or remove.

Final thoughts

So far, my phone feels faster and works fine. I'd like to get the JellyBean version running so will keep an eye on the release candidate downloads; I lack the patience to keep up with bleeding-edge. I have however found the CyanDelta app which should simplify the process of updates; as yet I haven't used it so cannot vouch for it directly. I confess that the process was a little nail-biting at points, but for most hardware (check the specifics for yours!) you should be able to reinstall the vendor's stock firmware if it all goes horribly wrong. Certainly worth the hassle for me; that dreadful vendor app will never pop up unbidden again!

No comments:

Post a Comment

Post a Comment