Installing the CyanogenMod 12 alternative OS on an Android phone

Image Change

© Lead Image © lassedesignen,

© Lead Image © lassedesignen,

Article from Issue 176/2015

CyanogenMod is the most popular alternative firmware for Android, but you'll rarely find it preinstalled on smartphones. We show how you can install the CyanogenMod firmware and explore some special CyanogenMod features.

CyanogenMod [1] is a mobile operating system derived from Android that is available free of charge for many smartphones and tablets. The developers refer to smartphone systems like CyanogenMod as ROM or simply as firmware.

CyanogenMod is backed by a company that pays the developers and wants to push forward with the project to earn money. Like many open source projects backed by a company, the CyanogenMod project is always looking for input from the greater user community (see the box titled "CyanogenMod Changes").

CyanogenMod Changes

Any changes to the software that make their way into the CyanogenMod source code are first submitted to all developers for evaluation and discussion [2]. The CyanogenMod project uses the Gerrit collaboration tool [3] for discussion and feedback. The discussions can take weeks, in the case of major changes, and they sometimes lead to several granular adjustments that affect both the function and the programming style.

Finally, the recommended changes – which now meet with general approval – make their way into the source code that is then used to create a new version of CyanogenMod (see the box titled "Image Maintenance" ). CyanogenMod's public changelog [4] explains the changes from build to build. The page also reveals what the developers are currently working on and which changes are expected for the next build version.

Because most of the work on the CyanogenMod project is under a free license, anyone can create their own customized CyanogenMod by adding their own changes, adding features from other ROMs, or porting the project to some other exotic device. These variations are not under the control of the CyanogenMod project and are thus referred to as unofficial. Creating a list of all CyanogenMod variants is thus practically impossible; put simply, a very large number of unofficial builds is out there in the wild. At this writing, the list of officially supported devices for Android 5.0.2 includes 50 devices; you can view the list on the project download page [5].

Image Maintenance

The CyanogenMod project generally maintains the following branches:

  • Nightly build: versions the build system usually produces automatically at night (hence nightly). A nightly build offers no functionality checks. Thanks to code review, the build only rarely contains bad mistakes, but nightly build users should expect parts of the ROM – or sometimes the complete ROM – not to work as desired.
  • Stable build: The developers create stable builds when the Android cycle is coming to an end and the next version of Android is waiting in the wings. Because the focus of all CM developers shifts parallel to the Android cycle, the end of work on the stable version incorporates the experiences and all the extensions of a complete 6-month cycle. In contrast to all other builds, a stable build receives security patches or fixes for serious bugs. Everyone who values security and stability should opt for a stable version.
  • Release candidate: The RCs are a special variant of stable. The candidate with the highest number becomes the next stable version if no bugs materialize. CyanogenMod 12 is currently still far from being a release candidate or stable version. In fact, no build of CyanogenMod 11 has officially been declared stable.
  • Experimental build: Experimental builds are from versions manufactured by the device handler. These experimental builds mostly exist for devices that still do not have a nightly status. Developers sometimes test new kernel functions with experimental builds beyond the normal nightly ROMs. Anyone who would like to use this kind of ROM should certainly read the device maintainer's notes beforehand. Unfortunately, the project does not have a central location for maintainer's notes – you will mostly fine them in the CyanogenMod forums [6] or at the XDA Developers site [7].
  • Monthly snapshot M: The team produces monthly builds as numbered snapshots once a new version of Android is running well enough on different hardware. New versions are supposed to appear towards the beginning of each month, but they can be delayed until the middle of the month. The device maintainers test the ROMs; the user experience team also fixes obvious problems. Snapshots are focused on anyone who wants to take advantage of the latest versions and features with minimal risk and are therefore recommended. The M status is reached when a device's hardware works, assuming it is not prone to bugs or occasional crashes and the source code of the kernel does not contain any "dirty hacks." The maintainer(s) must believe that everything is running smoothly.
  • Unofficial build: Unofficial builds are versions of firmware that work around any checks by the CyanogenMod team and are mostly found on forums like XDA [7], Rootzwiki [8], or Modaco [9]. The quality of these builds depends solely on the maintainer. Unofficial builds and their developers often find their way into the official CyanogenMod team later.

CyanogenMod runs on a variety of Android devices. Samsung, HTC, Sony, LG, Huawei, and of course Google also support alternative systems; however, these manufacturers only offer support for their own devices. Also, the alternative firmware you obtain from phone vendors typically is not totally free, apart from the GPL'd kernel.

CyanogenMod, on the other hand, is open for use with all smartphones and tablets; you can download the source code from the web, and developers are free to adapt the code. (Of course, if you want to download the system immediately and start using it, you'll need to find a version that is already adapted to your hardware.) Closed-source components only exist in a CyanogenMod (or CM for short) version that is pre-installed on a few specific devices, such as CyanogenMod 11S on the OnePlus One, or CM 11 on the Indian Yureka.

CyanogenMod is similar to Google's original Android [10] and thus offers a lean and fast smartphone system. However, CyanogenMod does not contain Google apps. Google threatened the project with legal steps at an early stage if it failed to remove the apps from the ROM. Google's vigorous protection of its app licensing explains why custom systems like CyanogenMod rely on versions of Google Now, Google Search, Play Store, Gmail, and YouTube distributed in separate packages from separate sources [11].

Okay, Gimme!

If you want to install CyanogenMod 12 on your own device, the first question is whether you will have to risk losing your warranty (see the box titled "Will I Lose my Warranty?"). Another important question is whether a version of the firmware actually exists for your hardware. Because no generic firmware versions exist for Android, each phone and each tablet needs its own CyanogenMod. If no version exists for your smartphone, the only way to run CyanogenMod is to delve deeper into the source code and create your own custom ROM.

Will I Lose my Warranty?

Check your phone license and local laws for information about installing a new system. In my market, If you install alternative firmware, you do not automatically void your warranty, and you definitely don't lose your legal warranty entitlement. However, because users typically need to unlock the bootloader to install a custom ROM, manufacturers typically force users to check a box that agrees to void the warranty before handing over the unlock codes.

In some cases, if the phone is less than six months old, the device retailer needs to prove that installing an alternative firmware version caused the damage. Once the six months have passed, you need to prove to the manufacturer that the manufacturer is responsible for the problem. Unlocking the bootloader without an unlock code is something you can only do on Nexus and Android One devices by Google. All other vendors force you to request an unlock code or run an exploit to hack the bootloader.

To find a CyanogenMod version for your hardware, start your search at the project website [1]. You can additionally take a look at the XDA Developers forum [7], where you will find a large number of unofficial CyanogenMod builds. If you still can't find a version, ask your favorite search engine.

Linux users do not need to install any special USB drivers, but you will need to use the Android Developer Bridge (ADB) and Fastboot Android tools. If you already have the Android SDK, you already have these two required command-line tools. Alternatively, you can install them on your computer by typing either the first line (Debian family) or the second line (openSUSE):

sudo apt-get install android-tools
zypper install android-tools

The second basic requirement for the installation is an unlocked bootloader that lets you install a custom recovery image. For Nexus devices, the simple command fastboot oem unlock unlocks the bootloader; some other vendors make the unlock process far more complicated.

The third step is to install the custom recovery, on top of which you then flash CyanogenMod, as they say in Android-speak. In this article, I explain how to install the current test version of CyanogenMod 12 (see the box titled "Names and Numbers") on the Nexus 5. I have kept the discussion generic wherever possible, so you can easily adapt it to other Nexus devices or Androids. To be on the safe side, check out the CyanogenMod wiki [12] for any special notes related to your device.

Names and Numbers

Android versions have a number and a code name – C for Cupcake, D for Donut, E for Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jelly Bean, KitKat, and Lollipop (alias Android 5.0).

So why is the current CyanogenMod version 12? The main version number of CyanogenMod matches the position of the letter chosen by Google in the alphabet. The latest version of Android is "L," which is the 12th letter, so the latest CyanogenMod is version 12. The number that follows the major version number relates to the minor version: Android 4.1 through 4.3 (all Jelly Bean) maps to CM 10.1, 10.2, and 10.3.

Enabling USB Debugging

To prepare for the bootloader and install CyanogenMod, you need to enable USB debugging for the Linux computer and your smartphone so they can communicate via a USB cable. You also have the option to use ADB over WLAN – but flashing firmware over a WLAN connection is definitely not advisable!

To turn on USB debugging, scroll all the way down in the Android settings to the About phone entry and tap seven times in a row on the build number (Figure 1) until the You are now a developer note appears.

Figure 1: Repeatedly tapping the build number unlocks the developer options.

A new entry, Developer options, now appears in the main Settings menu; a finger tap will open the options. Check USB debugging, connect the phone to the computer, and allow USB debugging from this computer. You will not need admin rights to run commands if ADB and Fastboot are correctly installed on the computer.

The output from adb devices in a terminal window on the Linux computer shows that the device is connected:

marcel@linux-taw3:~> adb devices
List of devices attached
013c26e0416d412d        device

A security prompt appears on the phone. Click OK to allow USB debugging. If the response to the command identifies the device as offline, the display is either locked or the security dialog for authenticating the phone is waiting for confirmation. The problem can also be due to an outdated version of the ADB.

Unlocking the Bootloader

If the bootloader on your own device is still locked, you first need to open it. When you open the bootloader, the Android system automatically performs a factory reset for security reasons and deletes all data on the Android device. Unlike most other devices, Nexus and Android One do not need an unlock code to unlock the bootloader. HTC, Motorola, and Sony offer online tools for acquiring the required code. Other manufacturers only hand out unlock codes on request (Huawei) or do not allow unlocking. Samsung uses a completely different system.

Here, I use a Nexus device. For a Nexus system, the unlocking procedure with active USB debugging and a working ADB/Fastboot configuration is limited to the following commands:

adb reboot bootloader
fastboot oem unlock

A security query appears on the Nexus 5 display after the unlock command; Nexus owners need to confirm that they want to unlock using the volume keys and the power button (Figure 2).

Figure 2: Unlocking the bootloader on the Nexus 5 test device took about two minutes. You might need more time when configuring other devices.

The LOCK STATE – unlocked item, which appears in fastboot mode on the Nexus 5 display, reveals that the unlocking process has worked (or if the bootloader is already unlocked). Furthermore, an unlocked padlock appears under the Google logo when booting up the phone. Warnings sometimes pop up with other manufacturers.

You can reboot the Nexus 5 by quickly pressing the power button (marked with the green Start label). Alternatively, type fastboot reboot in a terminal. The first boot process can take much longer than usual, but it should not take longer than 10 minutes.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Tech Tools
    • CyanogenMod-7 Brings Android Mods Up to Date
    • PhpStorm 2.0 IDE Released
  • LineageOS

    Breathe new life into your old smartphone: The TWRP recovery image and the free Android offshoot LineageOS let you install the latest security updates every week.

  • New Android Security

    Google says the upcoming Android L release will be far more secure than its predecessors.

  • Open Hardware – eelo

    With the eelo project, Gaël Duval has big plans for a free-licensed phone, with an accompanying app store and online services.

  • Open Hardware – Librem 5

    Purism is committed to creating a completely free phone that protects your data, keeps your communications private, and supports your digital rights.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs