About CyanogenMod

CyanogenMod (pronounced /saɪ.’æn.oʊ.dʒɛn.mɒd/) is an enhanced open source firmware distribution for smartphones and tablet computers based on the Android mobile operating system. It offers features and options not found in the official firmware distributed by vendors of these devices.

Features supported by CyanogenMod include native theming support, FLAC audio codec support, a large Access Point Name list, an OpenVPN client, an enhanced reboot menu, support for Wi-Fi, Bluetooth, and USB tethering, CPU overclocking and other performance enhancements, soft buttons and other “tablet tweaks”, toggles in the notification pull-down (such as wi-fi, Bluetooth and GPS), app permissions management, as well as other interface enhancements. CyanogenMod does not contain spyware or bloatware. In many cases, CyanogenMod may increase performance and reliability compared with official firmware releases.

CyanogenMod is developed as free and open source software based on the official releases of Android by Google, with added original and third-party code.

Read more about CyanogenMod, including its development and version history, at its Wikipedia entry.

What’s a “firmware”, anyway?

Okay, here’s a little history:

In the past, many simple appliances and electronics– everything ranging from advanced toasters to microwaves to industrial machines ran on “embedded”, limited-purpose computer chips (micro-controllers and such) to control their operations and user interfaces. Those embedded systems would require miniature, specialized software to, say, let someone program the VCR or to receive input from a remote control to change a TV’s channel.

Traditionally, this software would be written on small-capacity memory chips, usually to be written once during manufacturing and never upgraded during the life of the product. This embedded software was known as “firmware” (halfway between software and hardware), and it still exists on many electronic products, containing the programming/logic stuff that makes much of the electronic gizmos you own work. Sometimes this firmware can be updated and new functions or bug fixes may be added. For something like a refrigerator or microwave, updating the firmware is usually a torturous process, and for most electronic things, it isn’t necessary.

In the case of Android phones and tablets, as well as iOS devices– despite the fact that they may appear simply to be a phone that can run apps, what you actually have in your hand is a full-fledged, general-purpose “computer”. So while in the past, the “firmware” was just the simple software to make a mobile phone work, the name “firmware” has stuck to describe the software you load onto your phone, much like you’d load any operating system onto a computer.

So to be clear– today, your Android devices are in fact very similar to your laptop and desktop computers. Because they are now based on so-called SoCs, or “systems on a chip”, modern Android devices are effectively tiny, low-power laptops, only with touch screens instead of keyboards. CyanogenMod, based on Android, is a full-fledged operating system, just like Windows, OS X, or Linux are on laptop computers. In fact, Android runs on a version of the Linux kernel, and you can even run a full Linux desktop on many Android devices just as you would on a regular laptop.

The term “firmware”, then, is just a legacy terminology to refer to the software you put on your handheld devices. But speaking realistically, you may as well think of it as “software, particularly an operating system and apps, that can be put on my device.”

Hope that helps.

But wait– is the right term “ROM” or “firmware” or what?

The term “ROM” has multiple definitions. Technically, ROM stands for Read-Only Memory, which means you cannot write to it; it is read-only, like a DVD or (Game) CD.

Device manufacturers traditionally referred to a cell phone’s included operating system as “ROMs” because they did not intend for you, the user, to replace it. And so, modders would use “ROM” as a shorthand for “ROM image” to describe what it was they were replacing. So today the files that you put in the system partition are also referred to as a ROM sometimes. You’ll hear people say “flashing a ROM”.

Whether you call CyanogenMod a “ROM” or a “firmware” or an “operating system” or a “distribution”, it all means in this case the same thing. The ambiguous terminology is just the result of a decade-long transition from simple, non-replaceable software on hand-held devices to full-fledged, updatable operating systems on a small, portable computer that fits in the palm of your hand.

And what about the “open-source” part? What’s that mean, and more importantly, why should I care?

Generally speaking, most programs (and even entire operating systems) are written from source code, a human-readable set of instructions that are “compiled” (or built into files that your computer (or in this case, your phone or tablet) can understand and run. In the case of operating systems such as Mac OS X and Windows, many of the instructions that become the operating system are kept hidden from the public. With Android, this code is made public and are licensed in such a way that anyone can reuse the code if they like.

One major advantage to having an open-source-based operating system is that many people can scrutinize the source code, looking for bugs ranging from security holes to inefficiencies to missing features and pass fixes and features and translations into new languages back to be incorporated into the next version. CyanogenMod tries to build a new, fresh “nightly” version every 24 hours for each of the devices it supports, which includes the most up-to-date changes to the source code, provided from all over the Internet. Of course, the nightly builds may also contain newly-introduced bugs, but hey, if you feel adventurous, you can help make CyanogenMod better by trying these experimental builds and reporting back bugs to the developers.

So what is the difference between Android and CyanogenMod?

About 1-2 times a year, the vanilla Android operating system (known as AOSP, or the Android Open Source Project) is internally developed, then released to the public, by Google. They provide the source code to anyone who wants to download it. The CyanogenMod community, comprised mostly of unpaid volunteers and enthusiasts from around the world, takes this newest Android code and “ports” it to dozens of new and older (aka “legacy”) devices. At the same time, other CyanogenMod developers start adding features, fixes, and improvements that Google didn’t include to the CyanogenMod code, which benefits all the devices. The CyanogenMod community has a whole infrastructure for people to build and test experimental versions, report bugs, and contribute back to the source code.

Sometimes features that started in CyanogenMod have appeared in newer version of “official” Android. And every time Android does a new “code dump” of their latest version, CyanogenMod benefits from Google’s changes.

In this way, CyanogenMod is one (but not the only) community distribution of what started as vanilla AOSP. The Android community is vibrant, with numerous “modders” and “themers” and “performance enhancers” taking the source code and doing incredible things to it. Generally, there is a spirit of sharing knowledge and empowering people to experiment with controlling their devices, often giving old phones new life, and hopefully having fun in the process.

What does it all mean to me?

CyanogenMod is an alternative operating system intended to replace the one pre-installed on your smart phones and tablets. If you’ve got an older device that isn’t getting updates anymore, or if your device seems unusually slow, or maybe you’re sick of spyware, adware, and other unwanted garbage on your phone that you can’t remove… Maybe your device is missing features or has been otherwise artificially limited in functionality. Perhaps you just could use a boost in performance. Or maybe you’d like to be more confident that your operating system has included some of the latest bug fixes.

If so, CyanogenMod might be for you.

Who Uses CyanogenMod?

We’ve set up a page for users to talk generally about why they use CyanogenMod and why you might too.

Go on, read the Testimonials and add your own!

Why Use CyanogenMod?

For a list of features and functionality, check out the Why Mod? page.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

More Concepts

RAM, Flash storage, and the SD card

To start with, it helps to know that many Android devices have three kinds of storage: RAM, internal flash storage, and less-frequently, removable storage on an SD card.

RAM or internal memory is very fast, read-write, and volatile, meaning it “forgets” data when the device is turned off. RAM is the ‘short term’ memory that the device uses when it’s actively ‘thinking’ or processing. For apps to run, they must first be ‘loaded’ from the internal storage into RAM memory. When an app is closed, it is then removed from RAM to make room for other programs. For more info on RAM, please see Wikipedia:Random-access memory.

Internal storage, also known as flash memory, flash storage, or the eMMC (Embedded MultiMedia Card), is nonvolatile– that is, keeping information even when the device is off. Internal storage in the device is in many ways equivalent to a hard drive in a computer. This is where the device’s operating system (sometimes called “firmware”), apps, user data, and more are stored. Internal storage is generally slower than internal memory (aka “RAM”). For more info on internal storage, please see Wikipedia:Flash memory.

The SD card is a removable storage media normally dedicated to the bulk of a user’s storage, such as pictures and music. You can buy SD cards at most electronic stores and can swap them out when storage runs low on your device. However, keep in mind that not all devices have SD card slots.

Common Partitions and directories

Partitions and directories

Android devices have their internal flash storage divided into partitions. One way to think of a partition is as a room in a house. Just as each room might have a specific purpose, each partition has a specific purpose.

Additionally, directories (sometimes called “folders”) are used to store information in a typical Android installation.

Let’s look at some of the most common partitions and directories.

Common Partitions and directories

NOTE: Some devices may contain different partitions. The ones listed below are usually the most common.
  • /boot This partition stores the kernel and ramdisk. The kernel can be thought of as the “core” of the device’s software. It is what allows the hardware to “talk” to the software, and vice versa. It also controls other aspects of the operating system on the device, such as what file formats the device is able to support. The ramdisk contains the very first bits of Android that are loaded. It’s the software that loads everything else.
  • /recovery This partition holds the device’s recovery software, which gives the user access to special functions, such as upgrading the operating system or making a backup of the device’s software.
  • /system This is the main directory where the device’s essential software, the operating system itself, is stored. When CyanogenMod is installed, this is where it goes. Generally speaking, this partition is loaded into “read only” mode so that you don’t accidentally overwrite portions of Android, and it’s only able to be modified under special circumstances.
  • /cache This directory stores temporary files used by Android. Generally, files on this partition are not usually critical to the operation of the device, and can be “cleared out” by wiping its contents, especially during every major upgrade.
  • /data This directory is where much of your personal data is stored. So if you download an app from the Play Store, it goes here. If you change a setting, that change is also stored here. If you receive a SMS, it too is stored here.
  • /sdcard This directory contains the stuff from your removable media, such as an SD card. It is used by many apps as a general purpose download space. You can put movies and such on here as well. Even devices without a removable SD card slot may have an /sdcard directory. In this case, it is usually “linked” to a folder in internal storage.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Fastboot intro

A brief introduction to fastboot

fastboot is a small tool that comes with the Android SDK (software developer kit) that can be used to re-flash partitions on your device. It is an alternative to the recovery mode for doing installations and updates.

Because fastboot mode can start on your device even before Android loads (and can even run when Android isn’t installed at all), fastboot mode is useful for updating the firmware quickly, without having to use a recovery mode. In fact, it’s frequently the preferred way to initially install the recovery image on many devices. Fastboot can also be used for developer operations like unlocking the bootloader of Google’s Nexus devices.

Not all devices support fastboot, but many do.

There are two “sides” to using fastboot– the computer side and the device side. Typically your device first is connected to your computer via a USB cable. Then you boot to the “fastboot mode” on the device. On your computer, you then run the fastboot tool to issue commands. Please note that fastboot commands will ONLY work while the device is in fastboot mode.

Getting fastboot

See here for instructions on downloading the latest Android SDK, and thus fastboot, for your computer.

Helpful Tip

On some GNU/Linux distributions, you can install adb and/or fastboot through repository-provided packages.

On Debian, beginning with jessie and also available in wheezy-backports, you can install with them this command:

apt-get install android-tools-adb android-tools-fastboot

On Fedora, you can install them with this command:

yum install android-tools

On Arch Linux, you can install them with this command:

pacman -S android-tools

Running fastboot

Windows

Open a command prompt with Administrator privlidges

Navigate to the directory that contains the fastboot command. If you installed the Android SDK, this will usually be located in <path to SDK>\sdk\platform-tools\fastboot.exe

  • Example of path for Android SDK installed in root C: directory – C:\adt-bundle-windows-x86_64-2013xxxx\sdk\platform-tools

Verify that your phone is in fastboot mode and is being seen by fastboot by issuing fastboot devices. The output should show your device’s serial number:

C:\adt-bundle-windows-x86_64-2013xxxx\sdk\platform-tools>fastboot devices

062a032c001025f0s fastboot

The serial number listed should match the serial number displayed on the phone fastboot screen.

If nothing appears, double check your connection. If an error displays, refer to the below sections.

Troubleshooting fastboot

For “Command not found” errors, see the following wiki page for help.
Paths

<waiting for device> errors

If you see <waiting for device> at any point when executing fastboot command, the PC is not configured to use fastboot properly. Most typically, this is because you are not running fastboot with elevated privileges. It may also be that you do not have the drivers correctly installed, which may happen under Windows 8 because of its insistence on signed drivers.

Linux/OSX

Temporary solution: Run fastboot as root or with sudo. Better, more permanent solution: create a /etc/udev/rules.d/51-android.rules file as documented in UDEV.

Windows

Run fastboot in command prompt as an Administrator.

Make sure the output of fastboot devices returns your device serial number or you will never get past this error message.

If you have verified that you are running fastboot as Administrator and are still receiving <waiting for device>, there may be an issue with the drivers not being installed.

With the phone in fastboot mode and plugged in via USB cable:

  • Open the Devices and Printers menu of the Control Panel.
  • Verify that your phone is showing up as a device. Typically it will show up under the Unspecified section.
  • If the phone is showing up with a yellow exclamation point, then the drivers will need to be manually installed.
    • The Android SDK includes USB drivers under <path to SDK>\sdk\extras\google\usb_driver
  • If the phone does not show up at all, reboot the phone into fastboot mode while the USB cable is still plugged in. If still no luck, try changing USB cables or ports on your computer. Do NOT use a USB hub.

Installing Sony drivers in Windows 8

If you have a Sony device (eg Xperia), you can easily install the drivers for you device by downloading Androxyde’s Flashtool from http://www.flashtool.net/. Use the auto-installer in the …/drivers directory.

To install these drivers in Windows 8, you will need to disable driver signing.

Common fastboot commands

fastboot flash recovery recovery.img

fastboot flash boot boot.img

fastboot flash cache cache.img

fastboot flash userdata userdata.img

fastboot flash system system.img

fastboot reboot

fastboot oem unlock (for all Google-branded Nexus devices)

Alternatives to fastboot

Some Samsung devices use a program called heimdall, which offers functionality similar to fastboot. You can learn more about installing and compiling Heimdall here.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

adb –help

-d                            - directs command to the only connected USB device
                                returns an error if more than one USB device is present.
-e                            - directs command to the only running emulator.
                                returns an error if more than one emulator is running.
-s <specific device>          - directs command to the device or emulator with the given
                                serial number or qualifier. Overrides ANDROID_SERIAL
                                environment variable.
-p <product name or path>     - simple product name like 'sooner', or
                                a relative/absolute path to a product
                                out directory like 'out/target/product/sooner'.
                                If -p is not specified, the ANDROID_PRODUCT_OUT
                                environment variable is used, which must
                                be an absolute path.
devices [-l]                  - list all connected devices
                                ('-l' will also list device qualifiers)
connect <host>[:<port>]       - connect to a device via TCP/IP
                                Port 5555 is used by default if no port number is specified.
disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
                                Port 5555 is used by default if no port number is specified.
                                Using this command with no additional arguments
                                will disconnect from all connected TCP/IP devices.

device commands:

 adb push <local> <remote>    - copy file/dir to device
 adb pull <remote> [<local>]  - copy file/dir from device
 adb sync [ <directory> ]     - copy host->device only if changed
                                (-l means list but don't copy)
                                (see 'adb help all')
 adb shell                    - run remote shell interactively
 adb shell <command>          - run remote shell command
 adb emu <command>            - run emulator console command
 adb logcat [ <filter-spec> ] - View device log
 adb forward <local> <remote> - forward socket connections
                                forward specs are one of: 
                                  tcp:<port>
                                  localabstract:<unix domain socket name>
                                  localreserved:<unix domain socket name>
                                  localfilesystem:<unix domain socket name>
                                  dev:<character device name>
                                  jdwp:<process pid> (remote only)
 adb jdwp                     - list PIDs of processes hosting a JDWP transport
 adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>
                              - push this package file to the device and install it
                                ('-l' means forward-lock the app)
                                ('-r' means reinstall the app, keeping its data)
                                ('-s' means install on SD card instead of internal storage)
                                ('--algo', '--key', and '--iv' mean the file is encrypted already)
 adb uninstall [-k] <package> - remove this app package from the device
                                ('-k' means keep the data and cache directories)
 adb bugreport                - return all information from the device
                                that should be included in a bug report.
 adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
                              - write an archive of the device's data to <file>.
                                If no -f option is supplied then the data is written
                                to "backup.ab" in the current directory.
                                (-apk|-noapk enable/disable backup of the .apks themselves
                                   in the archive; the default is noapk.)
                                (-shared|-noshared enable/disable backup of the device's
                                   shared storage / SD card contents; the default is noshared.)
                                (-all means to back up all installed applications)
                                (-system|-nosystem toggles whether -all automatically includes
                                   system applications; the default is to include system apps)
                                (<packages...> is the list of applications to be backed up.  If
                                   the -all or -shared flags are passed, then the package
                                   list is optional.  Applications explicitly given on the
                                   command line will be included even if -nosystem would
                                   ordinarily cause them to be omitted.)
 adb restore <file>           - restore device contents from the <file> backup archive
 adb help                     - show this help message
 adb version                  - show version num

scripting:

 adb wait-for-device          - block until device is online
 adb start-server             - ensure that there is a server running
 adb kill-server              - kill the server if it is running
 adb get-state                - prints: offline | bootloader | device
 adb get-serialno             - prints: <serial-number>
 adb get-devpath              - prints: <device-path>
 adb status-window            - continuously print device status for a specified device
 adb remount                  - remounts the /system partition on the device read-write
 adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
 adb reboot-bootloader        - reboots the device into the bootloader
 adb root                     - restarts the adbd daemon with root permissions
 adb usb                      - restarts the adbd daemon listening on USB
 adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port

networking:

 adb ppp <tty> [parameters]   - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns

adb sync notes: adb sync [ <directory> ]

 <localdir> can be interpreted in several ways:
 - If <directory> is not specified, both /system and /data partitions will be updated.
 - If it is "system" or "data", only the corresponding partition
   is updated.

environmental variables:

 ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
 ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
 ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Android Debug Bridge, Adb Intro

What is adb?

The Android Debug Bridge (adb) is a development tool that facilitates communication between an Android device and a personal computer. This communication is most often done over a USB cable, but Wi-Fi connections are also supported. adb can also be used by developers to communicate with a virtual android machine running on the computer.

adb is like a “Swiss-army knife” of Android development. It provides numerous functions that are described in detail by the command: adb --help (see output here). Some of the more commonly used commands are listed in the Popular adb commands section below.

Installing adb & fastboot

Windows, Mac, and Linux

The best way to get adb and fastboot is to install the Android SDK directly from Google. After you install the SDK Tools, launch the SDK Manager and install the Android SDK Platform-tools package. Or alternatively run tools/android update sdk --no-ui. Note that the manager automatically selects the latest Android X.x (API YY) package on launch which you can safely deselect if you are only interested in adb and fastboot. Then, by running the SDK manager periodically to check for updates, you can ensure these tools are always at the latest version.

The adb and fastboot executables will be located in the platform-tools subdirectory of the SDK Tools. You can add this directory to your system’s PATH so that these tools are available from any Command Prompt or Terminal:

  • Windows 7/8:
    1. From the desktop, right-click My Computer and select Properties
    2. In the System Properties window, click on the Advanced tab
    3. In the Advanced section, click the Environment Variables button
    4. In the Environment Variables window, highlight the Path variable in the Systems Variable section and click the Edit button
    5. Append ;<path-to-sdk>/platform-tools to the end of the existing Path definition (the semi-colon separates each path entry)
  • Linux
    1. Add the following to ~/.profile and then logout/login:
    if [ -d "<path-to-sdk>/platform-tools" ] ; then
      PATH="<path-to-sdk>/platform-tools:$PATH"
    fi
  • Mac
    1. Add the following to ~/.bash_profile and then logout/login:
    if [ -d "<path-to-sdk>/platform-tools" ] ; then
      export PATH="<path-to-sdk>/platform-tools:$PATH"
    fi

Ubuntu

An easy alternative to installing the SDK package as described above exists on Ubuntu and other debian-based Linux distributions. adb and fastboot can be installed via the following commands from the Terminal:

sudo apt-get install android-tools-adb
sudo apt-get install android-tools-fastboot

There is no need to manually edit your system’s Path if this method is used.

Fedora/Centos/RHEL

An easy alternative to installing the SDK package as described above exists on Fedora and other rpm-based Linux distributions. adb and fastboot can be installed via the following command from the Terminal:

sudo yum install android-tools

There is no need to manually edit your system’s Path if this method is used. Note that on Centos/RHEL you need to have the epel repository enabled – see EPEL.

Popular adb commands

Among the most popular among CyanogenMod include the following, which can be typed from a Terminal program on the attached computer:

  • adb shell — this command establishes a shell interface for establishing a command-line session with the device. In practical purposes, this allows a person to type “into” their devices, much as one would use a terminal program on Linux or Mac OS X computers. Individual shell commands can be sent to the device by typing adb shell <command_to_be_executed_on_the_device>
  • adb push <local> <remote> — this command pushes a local file on the computer to a remote file on the device. You can include the full path to either the local or remote file.
  • adb pull <remote> [<local>] — this command will pull a remote file on the device (you can include the path) to either a specified location on the computer or, if no destination is specified, to the current directory where the command was issued.
  • adb logcat — this command allows you to view the device log in real time. It is also very useful for discovering and reporting bugs. On newer versions of android, you can add -C (that is, adb logcat -C) to get the text to display in color.
  • adb install <file> — this is used to “side-load” apps (in their .apk format) to the device.

There are many more useful commands. Check out the full instruction list here.

Secure USB debugging

In Android 4.2.2 (which corresponds to CyanogenMod 10.1), Google implemented some new security features for using adb. The new “secure debugging” feature requires that you manually approve your computer for an adb connection. This approval must be done on the device, and only after any screen lock has been passed.

To access your device via adb, ensure you are using a recently-updated version of adb, preferably from the latest Android SDK. If you are upgrading adb from a previous version, be sure to restart the daemon: adb kill-server.

The first time you connect your device to a computer via adb, you will receive a prompt on your device to Allow usb debugging?, along with an RSA fingerprint identifying the computer. You can select the Always allow from this computer checkbox if you want the device to remember this computer, in which case you will not be prompted again when connecting your device to that specific computer. This authorization must be done for each computer to which you connect your device.

This authorization prompt only appears while running Android. Recovery does not support authorizing a device, and instead checks whether Android has previously allowed the connection. So, if you see error: device unauthorized while attempting to use adb in recovery, restart to Android and authorize the connection. The next time you start recovery, adb should work.

Building adb

If you are already building CyanogenMod for yourself, you can actually compile adb. In fact, it is built for the host system (in addition to the device) with each full CyanogenMod build. You can find it in the out/host/linux-x86/bin directory, where linux-x86 should be replaced with your system type. If you do not want to build an entire release of CyanogenMod just for an updated adb binary, you can simply run mka adb from the top of your android build tree. After compiling, copy the binary to a directory in your PATH.

Troubleshooting adb

error: device unauthorized

See the Secure USB Debugging section.

“Device not found” errors

Sometimes adb can’t find your device. One solution is to run adb kill-server and then adb start-server as root or Administrator to restart the adb daemon with elevated privileges.

Also, you should make sure that the USB debugging or Android Debug Bridge option (this will vary depending on the version of Android) is checked in the Settings under Developer Options. Check out Doc: developer options if you don’t see it.

If adb still can’t find your device, make sure the USB connection method on the device is set to Camera (PTP) (sometimes called Mass storage mode) and not Media device (MTP). This setting can be accessed by swiping down on the status bar and tapping the Connected as a media device notification.

Note:

Some devices require a file at .android/adb_usb.ini be added to help your computer find the correct device. For example, the encore device requires that this file include a line containing 0x2080, the identification code for the device.

Once the device is configured correctly, you should be able to run adb devices and see something similar to the following:

$ adb devices
List of devices attached
abc12345        device

If instead of device it is unauthorized, then you need to approve your computer for an adb connection. See Secure USB Debugging.

error: insufficient permissions for device or no permission

On Linux, you need to setup UDEV rules to allow communication via adb. You can either use the entire rules configuration from the UDEV page, or add just those rules relevant to you. If you’re unsure of the vendor, idVendor can be determined with lsusb:

$ lsusb
Bus 002 Device 054: ID 0bb4:0f87 HTC (High Tech Computer Corp.)
...

In this example, 0bb4 is idVendor and 0f87 is idProduct (should you ever need it).

libncurses.so.5 64-bit troubles

Under the 64bit versions of some Ubuntu based distributions (e.g. Linux Mint 14), adb shows the following error:

adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

You can remedy this by installing the i386 version of libncurses5. From a terminal, type:

sudo apt-get install libncurses5:i386

error: protocol fault

Your version of adb is too old, download a more recent version.

See also

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Glossery

General Definitions

3G
3G is the term generally used to describe 3rd Generation mobile telecommunications, specifically allowing for greater throughput of data over cellular networks. The official standard is known as “International Mobile Telecommunications-2000 (IMT-2000)”.
Bloatware
Software or ‘apps’ that you don’t need, but come preinstalled to a device’s /system partition, meaning that you cannot remove them unless the device has been rooted. Usually, these are apps are sponsored by a company and included by a carrier for profit. For example, the Photobucket app included on the G2 by TMobile.
BFS
Brain Fuck Scheduler for Linux was created by veteran kernel programmer Con Kolivas and has been reported to improve responsiveness on light-NUMA (non-uniform memory access) Linux mobile devices and desktop computers with fewer than 16 cores.
CDMA
Code division multiple access (CDMA) is a channel access method used by various radio communication technologies. It should not be confused with the mobile phone standards called cdmaOne and CDMA2000 (which are often referred to as simply CDMA), which use CDMA as an underlying channel access method.
eMMC
An embedded Multi-Media Card is a bit like a computer hard drive for smaller devices like phones and tablets. It’s an embedded, internal storage medium that stores data such as programs, user information, images, music, etc.
ext2
Second extended filesystem for the Linux kernel. ext2 is still the filesystem of choice for flash-based storage media (such as SD cards, SSDs, and USB flash drives) since its lack of a journal minimizes the number of writes.
ext3
Third extended journaling filesystem is a journaled file system that is commonly used by the Linux kernel. It is the default file system for many popular Linux distributions. Note that due to limitations of SD Cards, you need to run “e2fsck -f” on any ext3 based SD Card filesystems after a crash to ensure your data is still intact.
ext4
Fourth extended journaling filesystem is a journaling file system developed as the successor to ext3. Note that due to limitations of SD Cards, you need to run “e2fsck -f” on any ext4 based SD Card filesystems after a crash to ensure your data is still intact.
Firmware
Programs stored in the ROM, EPROM, or flash memory that usually control various internal electronic devices (Hard Drives, Keyboards, Displays, etc). Firmware is typically ‘fixed’ software that is not updated in consumer devices, however it is often updated (or ‘flashed’) by advanced users to fix bugs or add features to the device. Flashing firmware designed for one device onto a different device, or not following a specific procedure while flashing will often render the device unusable.
Flash
Non-volatile computer storage that can be electrically erased and reprogrammed (similar to EPROM). No power is needed to maintain the information stored in the chip. This technology is primarily used in memory cards and USB flash drives for general storage and transfer of data between computers and other digital products. Because of its ease of use, speed, ability to be updated (see flashing), this technology is often used in mobile devices, PDAs, digital media players.
GNU
The name “GNU” is a recursive acronym for “GNU’s Not Unix!”; it is pronounced as one syllable with a hard g, like “grew” but with the letter “n” instead of “r”. The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system. “Free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech”, not as in “free beer”.
GNU make 
A build utility (commonly called make); it interprets Makefiles, evaluates dependencies and issues build commands. See http://en.wikipedia.org/wiki/Make_(software). AOSP and Cyanogenmod use GNU make. Alternative build tools are cmake, qmake, autotools, ninja, tup.
IMEI
The International Mobile Equipment Identity is a number unique to every GSM, WCDMA, and iDEN mobile device, as well as some satellite devices. The IMEI number is used by the GSM network to identify valid devices and therefore can be used to stop a stolen device from accessing the network. For example, if a mobile device is stolen, the owner can call their network provider and instruct them to “ban” the device using its IMEI number. This renders the device useless, whether or not the device’s SIM is changed. The IMEI can be displayed by dialing *#06#.
IRC
Internet Relay Chat. Basically a chatroom, or a cross between Instant Messaging and a forum.
Kernel
The central or core software component of most operating systems. Its responsibilities include managing the system’s resources (the communication between hardware and software components) and can provide the lowest-level abstraction layer for resources (especially memory, processors, and I/O devices).
Open-source
Open-source refers to software with publicly available source code. In the context of Android, Open-source refers to the approach to the design, development, and distribution of software. This offers accessibility to a software’s source code for modification, improvement, bug-fixing, and security-enhancement. CyanogenMod is based on this principle.
OTA
Over-the-Air, transmitted via Wi-Fi or mobile network, as opposed to downloaded to the phone via USB cable (e.g. OTA update).
Radio
The cellular radio on the device which needs control software called firmware to control it.
ROM
Read Only Memory. In the context of an Android device, ROM is the internal flash memory where the core operating system resides. It can also refer to a specific version firmware that can be applied to a device through a process usually referred to as flashing. An improperly flashed ROM can often brick the device, rendering it unusable.
SuperCID
SuperCID is a special code, 11111111, which means that software from any region can be installed. See superCID
SDK
Software Development Kit. You can find the Android SDK at http://developer.android.com/sdk.
Vanilla
A clean, unmodified version of something. In the context of Android ROMs, vanilla refers to the stock ROM that came pre-installed on the device.
Widget
An application that lives (in other words, is always running) on the homescreen instead of being ‘run’ like a regular app. Common examples are calenders and weather widgets.

Android Specific Definitions

32A
PVT32A handsets have 288MB total RAM (192MB usable by OS – same as Hero handsets) and use the Qualcomm MSM7200A CPU.
32B
PVT32B handsets have 192MB total RAM (96MB usable by OS) and use the Qualcomm MSM7201A CPU.
ADB
Android Development Bridge. Command line tool used to communicate with & control the device over a USB link from a computer. The ADB command is found in the Android SDK.
ADP
Android Developer Phone. The first ADP was a “development” version of the HTC Dream.
Beginning with HTC’s Nexus One (codename “passion”), all ADP devices received the brand name “Nexus”.
Additional ADP’s are Samsung Nexus S, Samsung Galaxy Nexus, Asus Nexus 7 (tablet), Samsung Nexus 10 (tablet) and LG Nexus 4.
The current ADP is the LG Nexus 5, announced 31 October 2013.
Android
Unveiled on 5 November 2007, Android is a mobile operating system developed by Google running on the Linux kernel.
Apps2SD
Move applications from the internal NAND memory on the device to a removable SD Card. Alternatives include Mounts2SD and Link2SD.
CM
Short for CyanogenMod
CWM
Short for ClockworkMod Recovery. Not to be confused with CM (Cyanogenmod).
Dalvik-Cache
The dalvik-cache directory holds all of the pre-compiled .dex files created from installed apps. These files are static and do not change unless the app is updated.
FC
Force Close, Android’s function to terminate non-responsive or crashed apps.
Fastboot
Fastboot is protocol used to directly update the flash filesystem in Android devices from a host over USB. It allows flashing of unsigned partition images. It is disabled almost all production devices since USB support is disabled in the bootloader.
flash_image
A small utility to be used on the device that allows you to re-write system partitions with image files. If you don’t have it, it can be found here.
GApps (Google Apps)
An add-on for Google’s applications (Market, GMail etc.), packaged separately to avoid copyright issues
Hboot
Hboot is a common manufacturer term from HTC for the bootloader.
Logcat
A debugging tool built into Android devices that displays system logs as they occur. See Logcat.
NANDroid
A set of tools that will enable anyone who has root on their Android device to make FULL system backups, in case something goes wrong or you want to try out that new experimental ROM/theme. NANDroid will backup (and restore) /system, /data, /cache, and /boot partitions.
NVFlash
is a low-level flash utility for nVidia based devices which gives you low level access to the system to flash, format, recover, repartition and do many more functions. It is a very powerful tool and should be used with caution. Read and follow all instruction carefully when using nvflash. See http://rootzwiki.com/topic/35086-guide-nvflash-general-users-guide-unbrickrecoverdowngradeupgrade-tf201/#entry982736
Recovery Mode
A special environment that you can boot into for troubleshooting and upgrading purposes.
SPL
Second Program Loader, in conjunction with the IPL comprise a device’s bootloader. Aside from bootstrapping Android, the bootloader also fulfills various diagnostic functions. One of these functions is the manipulation of data in the device’s internal flash ram. Depending on the SPL installed, the user might be able to flash signed NBH files, flash nand images, and more. Note that the SPL is installed and operates independently of the Android build that runs atop it.
Generally speaking, there are two variants of the SPL: Stock, which is ‘locked’ and is installed on most devices from the factory, and Engineering, which is ‘unlocked’ and has to be manually flashed – usually after ‘rooting’.
S-OFF
Usually a property of HTC devices. S-OFF allows the user to modify any partition on the device. Signature checking is disabled for zips, allowing the user to flash otapackages and custom kernels from recovery. S-ON prevents the user to allow these actions. Note that S-OFF does not imply that a device is rooted. See http://forum.xda-developers.com/showthread.php?p=26732440 for more information.
Tethering
Using a device (e.g. an Android phone) to share its 3G/LTE data connection to another device (e.g. laptop). With an Android device, the data connection can usually be shared via WiFi, Bluetooth or USB.
Wipe
Usually refers to wiping data and cache partitions of the device.
Zipalign
Reduces the amount of RAM consumed when running the application by allowing data to be mmap’d in; which causes all uncompressed data within the .apk, such as images or raw files, to be aligned on 4-byte boundaries.

Hacking Definitions

Aftermarket
Aftermarket generally refers to any product or service applied or requisitioned by end-users to add usability or functionality to the original product. Many aftermarket modifications can void the manufacturer’s warranty. From a manufacturer’s perspective, the after-market is any goods or services offered by the manufacturer directly to end-users of a given product or service. After-market services include support for warranties, contracts, and parts and accessories sales.
Brick
a device that no longer functions, generally caused by a failed firmware or SPL update. Since the device no longer works as intended, it is often referred to as a “brick” or “paper-weight”, since that is all it is good for. Also a verb (as in “This operation can brick your phone“).
Exploit
A proof of concept local root exploit utilizing hotplug. Allows installation of a “rootshell” program on many Android 1.x and 2.x devices.
Flashing
The process of applying a firmware image (or ROM) to a device. It generally entails a very specific order of steps. Failing to complete any one of these steps properly may result in bricking the device.
Kang
The process of creating a code based off someone else’s code or reapplying code that someone else created into your own code (e.g. git cherry-pick). The term “kang” or “kanging” can have a pejorative connotation, especially if one adopts code from someone else without giving due credit. However the term can also be used with a certain sense of irony; sometimes one will claim to have “kanged” with some tongue-in-cheek.
Rooting
Obtaining root (“administrator”, or “full”) access to the device. This means you can mount its internal memory partition as read/write, which lets you do various things: have USB or Wi-Fi tethering, uninstall applications you otherwise can’t uninstall (e.g. the Amazon MP3 store), install applications that need root access (such as AdFree), disable the camera shutter sound (simply by deleting the shutter sound file), overclock or underclock the CPU, install and boot Debian, and so on. Installing CyanogenMod roots the device in the process. The “Superuser” app controls what applications may gain root privileges.
Unlock
Most GSM devices are locked to only work with the sim cards of a particular carrier. Obtaining root access (e.g. installing CyanogenMod) on the device usually does nothing to the sim-lock. The usual way to unlock the device to all SIM cards is to obtain a subsidy unlock code from a carrier.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

All About Recovery Images

A quick summary

Recovery is a limited boot mode, independent of your normal Android operating system. In the stock recovery, you can install OTA update packages, wipe data, and wipe the cache partition. The feature set available depends on the specific recovery installed. In general, stock recoveries (which come pre-installed on your device) are the most limited. They typically only allow manufacturer updates to be performed and remain mostly invisible to the end user. Simple recovery, used by the CyanogenMod Installer, is another limited recovery meant to perform only basic tasks, like updates and wipes. Custom recoveries, described below, offer a much larger suite of tools. The most important of these is the ability to make a full device backup which can later be restored if Android misbehaves in an unrecoverable fashion.

Custom recoveries

For specific instructions about how to install a custom recovery, see the page for your device. Some devices have several custom recoveries available, while others have only one (or none!).

Active Development:

TeamWin Recovery Project (TWRP) – This is a very widely used custom recovery. It is fully touch-driven, has one of the most complete feature sets available, and uses a themable UI. TWRP is maintained by Ethan Yonker (Dees Troy) and sees a number of contributions from the community via OmniROM’s code review.

CyanogenMod Recovery (CMR) – This recovery is since recently developed by the CyanogenMod Team and is installable from the CyanogenMod development settings screen.

Development Ceased:

ClockworkMod Recovery (CWM or CWMR) – This is one of the original custom recoveries that is still widely used today. Most of its functionality was written by Koushik Dutta (Koush), but it has since seen significant code contributions come from the community via CyanogenMod’s code review. Several variants are available, including: standard (hardware keys navigate the menus), swipe (basic up/down/left/right navigation by swiping), and touch (fully touch-driven menus). More information on ClockworkMod usage can be found at ClockWorkMod Recovery Instructions.

PhilZ Touch – This recovery has gained popularity over the last couple years. Written by Phyto Wardt (Phil3759), it is taglined “CWM Advanced Edition”. Indeed, it uses ClockworkMod as its base and extends it with more filesystem tools and a custom user interface. Some of the changes made to PhilZ Touch were later submitted by the author for inclusion in ClockworkMod.

Starting into recovery mode

There are several methods for booting into recovery:

Advanced reboot menu – If your device is already running CyanogenMod, you can enable an advanced power menu that will enable you to reboot directly into recovery:

  1. Enable developer options
  2. Settings > Developer options > Advanced reboot = On
  3. Hold the power button to see the reboot menu

ADB – If ADB is installed on your computer, you can use the command:

adb reboot recovery

Terminal App – If you have superuser access (root), then from the Terminal app, you can use the following commands:

su -c 'reboot recovery'

Manual method – Every device has a way to boot into recovery mode, or a special bootloader, by holding down a special combination of buttons when the device is first started. Consult the info page for your device for the correct combination.

See also

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Google APPS for CyanogenMod (GAPPS)

Google Apps are the proprietary Google-branded applications that come pre-installed with most Android devices, such as the Play Store, Gmail, Maps, etc. Due to licensing restrictions, these apps cannot come pre-installed with CyanogenMod and must be installed separately. The Google Apps are not required to boot or run CyanogenMod, however many users find them beneficial to take full advantage of the Android ecosystem.

These Apps have been packaged by a developer independent of CyanogenMod, and download links have been provided for your convenience. It is possible to perform a “backup” of the Google Apps on your device and then “restore” them, but this does take additional steps which are not covered here.

The Google Apps packages are NOT SUPPORTED in any way by CyanogenMod.

Downloads

The packages below are for CyanogenMod 11 and above (or compatible Android builds based upon the same AOSP versions). These packages are DPI and architecture-independent, so you only need to match your OS version. In addition, only apps which are required to provide the basic Google frameworks are supplied to reduce the download size. “Missing” applications can be installed or updated from the Google Play Store. For older CyanogenMod versions see below

Version Package
CyanogenMod 14.1
(Android 7.1)
OpenGApps
CyanogenMod 13
(Android 6.0)
OpenGApps
CyanogenMod 12.1
(Android 5.1)
OpenGApps or CGApps
CyanogenMod 12
(Android 5.0)
OpenGApps or 20141212 on AFH
CyanogenMod 11
(Android 4.4)
OpenGApps or 20140606 on AFH

Installation

The Google Applications packages should be installed via recovery. Exact steps vary, but the general process is the same as that used to install CyanogenMod, or any other flashable zip:

  1. Copy the gapps .zip-file to /sdcard/
    • Using adb: adb push filename.zip /sdcard/
  2. Reboot your device to recovery via any one of these methods: 1) using the power-on key combo for your device; 2) running adb reboot recovery from your computer; 3) or via the Advanced Reboot power menu (enabled in Developer Options).
  3. Choose “install zip” or “Apply update” from within recovery, and navigate to the zip-file loaded earlier.
  4. Reboot from recovery back to Android.

Troubleshooting

Google Apps packages are not generally supported by the CyanogenMod team, or by their distributors. The good news is that there is very little that can go wrong! If you are experiencing problems, here is a list of different things you can try (each one a bit more extreme/destructive than the last):

  1. Reboot your device
  2. Verify all apps are up-to-date in the Play Store
  3. Re-flash the Gapps package (via recovery)
  4. Wipe the /system partition and reinstall both CyanogenMod and Gapps (as long as if you don’t wipe /data, your data will be preserved)
  5. Wipe /system, /data and /cache and reinstall both CyanogenMod and Gapps (this will delete all of your data, i.e. like you’re starting from a clean slate)

If you still have problems consider googling for alternative Google Apps installation package.

Older Releases

Version Package
CM 11
“small”
20140105

Download: AFH
md5: ea0894b45481c4f56e7ea43a650150c9
Only for devices with “small” /system (under 500MB)

CM 10.2 20130813

Download: AFH
md5: 1f51b5cc6370c1f45dc951109b6ce6ed

CM 10.1 20130812

Download: AFH
md5: 5f22f046e37038a3856eeb825e73d4ed

CM 10 20121011

Download: AFH
md5: 4e9e7ec3c22b0b3471bd05d62b8a659d

CM 9 20120317 AFH

md5: dc560aa235e8dd8cb00df0cefb5abd38

CM 7 20110828 AFH

md5: 1647897d8ac3efb04723d2ad2c361a3f

CM 6 Tiny: 20101020

Download via AFH
md5: bf7b653a4320dc33b15ad945a41cd56c
MDPI: 20110501
Download via AFH
md5: c97b8375ca53148fb8281216a5e583ca
Tegra: 20101020
Download via AFH
md5: 03e15f1fe1dd1bfd56eb6c67a64826e3
HDPI: 20101114
Download via AFH
md5: bd6362e156c374ae8ce1f7b1c3dcd488

CM 5 Tiny: ERE36B

Download Unavailable

CM 4 Tiny: DRC83

NOTE: Flash DRC83 BEFORE CyanogenMod 4.2
Download Unavailable

External Links

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Download ClockWorkMod Recovery

ROM Manager is THE MUST HAVE APP for any Android root user.

* Flash your recovery to the latest and greatest ClockworkMod recovery.
* Manage your ROMs via a handy UI.
* Organize and perform backups and restores from within Android!
* Install ROMs from your SD card.
* Install your favorite ROMs over the air!

 
ClockworkMod Touch Recovery:
ClockworkMod Touch recovery (and recovery) is work that needs to put in for every new device that is released by a manufacturer.
If work on ROM Manager ceased completely, all the premium features would continue working without issue. However, new recoveries do not port and build themselves. Without ClockworkMod Touch being a per device purchase, there is no way to recoup recurring server costs and labor. Keeping ROM Manager free and operational costs tens of thousands of dollars a year, and that does not include engineering costs.
Troubleshooting:
Droid users: Stuck at the “M” logo? Flash an alternate recovery and flash back to ClockworkMod.
HTC Users: Flash recovery not working? Try fastbooting a recovery on.
Droid X/2/Pro Users: You must run the Bootstrap application first to use ROM Manager.
Samsung users: You must flash a Clockwork compatible kernel first (see XDA forums)

TWRP Recovery

TWRP Recovery

TWRP is an open source, community project. TWRP development is done by roughly 4 people at this point. We also have a large support community with many people who are willing to answer questions and help people with their devices either through our IRC channel or on forums like xda-developers.
A custom recovery is used for installing custom software on your device. This custom software can include smaller modifications like rooting your device or even replacing the firmware of the device with a completely custom “ROM”

DEVICES COMPATIBLE WITH TWRP RECOVERY