Samsung Galaxy Note 8.0 (LTE) (n5120)

Cyanogenmod ROM Samsung Galaxy Note 8.0 (LTE) (n5120)

Cyanogenmod ROM Samsung Galaxy Note 8.0 (LTE) (n5120)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 13.0 (Android 6.0/6.0.1 (Marshmallow))

Special boot modes

  • Recovery: Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  • Bootloader: Volume Down & Power
  • Download: Volume Down & Home & Power

Source code

Device http://www.github.com/cyanogenmod/android_device_samsung_n5120
Kernel http://www.github.com/cyanogenmod/android_kernel_samsung_smdk4412
Galaxy Note 8.0 (LTE) Specifications
Codename: n5120
Vendor: Samsung
Release date: 13 May 2013
Carrier: AT&T
Type: tablet
GSM freq: 850 900 2100 MHz UMTS/HSPA+; 850 900 1800 1900 MHz GSM
LTE freq: 800 900 1800 2600 MHz
Platform: Samsung Exynos 4412
CPU: 1.6 GHz quad-core Cortex A9
GPU: Mali-400
RAM: 2GB
Weight: 338 g (11.92 oz)
Dimensions: 210.8 mm (h) x 135.9 mm (w) x 8.0 mm (d)
Screen size: 203 mm (8.0 in)
Resolution: 1280×800
Screen density: 189 ppi
Screen type: TFT LCD
Internal storage: 16/32 GB
SD Card: microSD up to 64 GB
Bluetooth: 4.0
Wi-Fi: 802.11 a/b/g/n 2.4 and 5GHz
Main camera: 5MP
Secondary camera: 1.3Mp
Power: 4600mAh
CM supported: 11, 13

How to Install CyanogenMod on the Samsung Galaxy Note 8.0 (LTE) (n5120)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Installing a custom recovery

Samsung devices come with a unique boot mode called Download Mode which is very similar to Fastboot Mode on some devices with unlocked bootloaders. Heimdall is a cross-platform, open source tool for interfacing with Download Mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode. Rooting the stock firmware is neither recommended nor necessary.

  1. Download and install the Heimdall Suite
    • Windows: Extract the Heimdall suite and take note of the directory holding heimdall.exe. You can verify Heimdall is working by opening a command prompt in this directory and typing heimdall version. If you receive an error, be sure that you have the Microsoft Visual C++ 2012 Redistributable Package (x86/32bit) installed on your computer.
    • Linux: Pick the appropriate installation package based on your distribution. The -frontend packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Mac: Install the dmg package. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Building from source: The source code for the Heimdall Suite is available on Github. For more details about how to compile the Heimdall Suite, please refer to the README file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.
  2. Download recovery — you can directly download a recovery image using the link below, or visit TWRP site to check for the latest version of recovery for your device (if your device can be found there). For general info about recoveries click here.
    Recovery: Download
    md5: 7ad3b7ece6446d294e46607b7bffe854
  3. Power off the Galaxy Note 8.0 (LTE) and connect the USB adapter to the computer but not to the Galaxy Note 8.0 (LTE), yet.
  4. Boot the Galaxy Note 8.0 (LTE) into download mode. Volume Down & Home & Power Accept the disclaimer on the device. Then, insert the USB cable into the device.
  5. Windows (only) driver installation – Skip this step if you are using Linux or Mac
    A more complete set of the following instructions can be found in the Zadig User Guide.
    1. Run zadig.exe from the Drivers folder of the Heimdall Suite.
    2. Choose Options » List All Devices from the menu.
    3. Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
    4. Click Replace Driver (having selecting “Install Driver” from the drop down list built into the button).
    5. If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
  6. At this point, familiarize yourself with the Flashing with heimdall notes below so that you are prepared for any strange behaviour if it occurs.
  7. On the computer, open a terminal (or Command Prompt on Windows) in the directory where the recovery image is located and type:
    heimdall flash --RECOVERY recovery.img --no-reboot
    Tip: The file may not be named identically to what’s in this command. If the file is wrapped in a zip or tar file, extract the file first, because heimdall isn’t going to do it for you.
  8. A blue transfer bar will appear on the device showing the recovery being transferred.
  9. Unplug the USB cable from your device.
    • NOTE: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
  10. Manually reboot the phone into recovery mode by performing the following. Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  11. The Galaxy Note 8.0 (LTE) now has a custom recovery installed. Continue to the next section.

Note: Flashing with heimdall

  • In Windows 7 UAC (User Account Control) may need switching off. Once Heimdall is finished it can be re-enabled.
  • Protocol initialization can fail if the device is connected via a USB hub – connect the USB cable directly to the PC
  • It may be necessary to run the heimdall flash command as root in Linux or Mac OS X: sudo heimdall flash [...]. Typical symptoms of this are:
    • a blue bar doesn’t show up after the process has finished
    • Failed to confirm end of file transfer sequence!
  • It may be necessary to capitalize the name of the partition on some devices. Try --KERNEL instead of --kernel and/or --recovery instead of --RECOVERY.
  • If on Linux 64bit you get “unable to execute ./heimdall: No such file or directory”, try the 32bit version and make sure to run it with sudo: reference.
  • On Mac OS X you may see this message: “ERROR: Claiming interface failed!”. If so, you need to disable the default USB drivers with the following commands:
    sudo kextunload -b com.apple.driver.AppleUSBCDC;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
    If you have installed Samsung Kies, you may further need to unload those USB drivers with the following commands:
    sudo kextunload -b com.devguru.driver.SamsungComposite;
    sudo kextunload -b com.devguru.driver.SamsungACMData
    sudo kextunload -b com.devguru.driver.SamsungACMControl
  • Using Heimdall version 1.4.0 (the latest version available for download on the Glass Echidna website) you may see this message or one similar to it:
    Error: Failed to confirm end of PIT file transfer!
    If you experience this error, follow the instructions for compiling Heimdall from source to get the latest version on GitHub with the issue patched.

Helpful Tip

  • The stock ROM may overwrite your custom recovery on boot. To prevent this, boot immediately into recovery after leaving Download Mode instead of letting the ROM boot up normally. If your recovery is overwritten, simply redo the steps you followed above and catch it before it boots next time.
  • Note for upgrades from gingerbread to jellybean remember the recovery is changed. This means once you install do NOT restore to old-gingerbread-stock ROM from cwm-recovery.
  • To upgrade from stock/CM7/CM9/CM10.1.2/CM10.1.3 to CM10.2, you must first boot into recovery and wipe data, cache, and dalvik cache (factory reset). Due to the new partition layout in CM10.2, failing to perform these steps will result in a bootloop. See here for details; more about repartitioning here. If you missed this step before installing, boot to recovery and factory reset, then reinstall CM10.2.
  • Some users have reported connection errors if the device is connected to a USB hub. If you experience such errors it is recommended that you try connecting your device to a USB port on the motherboard.
  • Antivirus software may prevent Heimdall from connecting properly. Disable your antivirus before proceeding.
  • When Heimdall fails to connect, the Download mode may get stuck, making all further attempts fail too. To retry, you may need to restart the Download mode: turn off the phone by holding Power for 5-10 seconds (or by pulling out the battery), then boot into Download mode and run Heimdall again.
  • If Heimdall fails to connect (errors related to initializing the protocol, or transferring data):
    if you just installed the driver, try rebooting your computer and trying again.
    if you still have troubles after reboot, in Zadig try installing the libusbK driver rather than the WinUSB driver.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Place the CyanogenMod .zip package, as well as any optional .zip packages, on the root of /sdcard:
    • Using adb: adb push filename.zip /sdcard/
    Note: You can copy the .zip packages to your device using any method you are familiar with. The adb method is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure /sdcard (sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
  4. If you are not already in recovery, boot to recovery mode now.
    • Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  5. In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
  6. Optional (Recommended): Select the Backup button to create a backup.
  7. Select Wipe and then Factory Reset.
  8. Select Install.
  9. Navigate to /sdcard and select the CyanogenMod .zip package.
  10. Follow the on-screen notices to install the package.
  11. Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
  12. Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Samsung Galaxy Note 8.0 (LTE) (n5120)

Introduction

These instructions will hopefully assist you to start with a stock Galaxy Note 8.0 (LTE), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Galaxy Note 8.0 (LTE)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Galaxy Note 8.0 (LTE) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast n5120

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast n5120

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Galaxy Note 8.0 (LTE) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/n5120 directory (you can cd ~/android/system/device/samsung/n5120 if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/samsung directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/samsung directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch n5120

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make n5120 should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/n5120/cm_n5120-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-n5120.zip, which is the CyanogenMod installation package.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-n5120.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Samsung Galaxy Note 8.0 (GSM) (n5100)

Cyanogenmod ROM Samsung Galaxy Note 8.0 (GSM) (n5100)

Cyanogenmod ROM Samsung Galaxy Note 8.0 (GSM) (n5100)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 13.0 (Android 6.0/6.0.1 (Marshmallow))

Special boot modes

  • Recovery: Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  • Bootloader: Volume Down & Power
  • Download: Volume Down & Home & Power

Source code

Device http://www.github.com/cyanogenmod/android_device_samsung_n5100
Kernel http://www.github.com/cyanogenmod/android_kernel_samsung_smdk4412
Galaxy Note 8.0 (GSM) Specifications
Codename: n5100
Vendor: Samsung
Type: tablet
GSM freq: 850 900 1800 1900 2100 MHz UMTS/HSPA+
Platform: Samsung Exynos 4412
CPU: 1.6 GHz quad-core Cortex A9
GPU: Mali-400
RAM: 2GB
Weight: 338 g (11.92 oz)
Dimensions: 210.8 mm (h)
135.9 mm (w)
8.0 mm (d)
Screen size: 203 mm (8.0 in)
Resolution: 1280×800
Screen density: 189 ppi
Screen type: TFT LCD
Internal storage: 16, 32 GB
SD Card: up to 64 GB
Bluetooth: 4.0
Wi-Fi: 802.11 a/b/g/n 2.4 and 5GHz
Main camera: 5Mp (2592х1944), autofocus
Secondary camera: 1.3Mp
Power: 4600mAh
CM supported: 10.2, 11, 12, 12.1, 13

How to Install CyanogenMod on the Samsung Galaxy Note 8.0 (GSM) (n5100)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Installing a custom recovery

Samsung devices come with a unique boot mode called Download Mode which is very similar to Fastboot Mode on some devices with unlocked bootloaders. Heimdall is a cross-platform, open source tool for interfacing with Download Mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode. Rooting the stock firmware is neither recommended nor necessary.

  1. Download and install the Heimdall Suite
    • Windows: Extract the Heimdall suite and take note of the directory holding heimdall.exe. You can verify Heimdall is working by opening a command prompt in this directory and typing heimdall version. If you receive an error, be sure that you have the Microsoft Visual C++ 2012 Redistributable Package (x86/32bit) installed on your computer.
    • Linux: Pick the appropriate installation package based on your distribution. The -frontend packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Mac: Install the dmg package. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Building from source: The source code for the Heimdall Suite is available on Github. For more details about how to compile the Heimdall Suite, please refer to the README file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.
  2. Download recovery — you can directly download a recovery image using the link below, or visit TWRP site to check for the latest version of recovery for your device (if your device can be found there). For general info about recoveries click here.
    Recovery: Download
    md5: 3c48751b6c40ddb93713048637fa84b8
  3. Power off the Galaxy Note 8.0 (GSM) and connect the USB adapter to the computer but not to the Galaxy Note 8.0 (GSM), yet.
  4. Boot the Galaxy Note 8.0 (GSM) into download mode. Volume Down & Home & Power Accept the disclaimer on the device. Then, insert the USB cable into the device.
  5. Windows (only) driver installation – Skip this step if you are using Linux or Mac
    A more complete set of the following instructions can be found in the Zadig User Guide.
    1. Run zadig.exe from the Drivers folder of the Heimdall Suite.
    2. Choose Options » List All Devices from the menu.
    3. Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
    4. Click Replace Driver (having selecting “Install Driver” from the drop down list built into the button).
    5. If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
  6. At this point, familiarize yourself with the Flashing with heimdall notes below so that you are prepared for any strange behaviour if it occurs.
  7. On the computer, open a terminal (or Command Prompt on Windows) in the directory where the recovery image is located and type:
    heimdall flash --RECOVERY recovery.img --no-reboot
    Tip: The file may not be named identically to what’s in this command. If the file is wrapped in a zip or tar file, extract the file first, because heimdall isn’t going to do it for you.
  8. A blue transfer bar will appear on the device showing the recovery being transferred.
  9. Unplug the USB cable from your device.
    • NOTE: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
  10. Manually reboot the phone into recovery mode by performing the following. Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  11. The Galaxy Note 8.0 (GSM) now has a custom recovery installed. Continue to the next section.

Note: Flashing with heimdall

  • In Windows 7 UAC (User Account Control) may need switching off. Once Heimdall is finished it can be re-enabled.
  • Protocol initialization can fail if the device is connected via a USB hub – connect the USB cable directly to the PC
  • It may be necessary to run the heimdall flash command as root in Linux or Mac OS X: sudo heimdall flash [...]. Typical symptoms of this are:
    • a blue bar doesn’t show up after the process has finished
    • Failed to confirm end of file transfer sequence!
  • It may be necessary to capitalize the name of the partition on some devices. Try --KERNEL instead of --kernel and/or --recovery instead of --RECOVERY.
  • If on Linux 64bit you get “unable to execute ./heimdall: No such file or directory”, try the 32bit version and make sure to run it with sudo: reference.
  • On Mac OS X you may see this message: “ERROR: Claiming interface failed!”. If so, you need to disable the default USB drivers with the following commands:
    sudo kextunload -b com.apple.driver.AppleUSBCDC;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
    If you have installed Samsung Kies, you may further need to unload those USB drivers with the following commands:
    sudo kextunload -b com.devguru.driver.SamsungComposite;
    sudo kextunload -b com.devguru.driver.SamsungACMData
    sudo kextunload -b com.devguru.driver.SamsungACMControl
  • Using Heimdall version 1.4.0 (the latest version available for download on the Glass Echidna website) you may see this message or one similar to it:
    Error: Failed to confirm end of PIT file transfer!
    If you experience this error, follow the instructions for compiling Heimdall from source to get the latest version on GitHub with the issue patched.

Helpful Tip

  • The stock ROM may overwrite your custom recovery on boot. To prevent this, boot immediately into recovery after leaving Download Mode instead of letting the ROM boot up normally. If your recovery is overwritten, simply redo the steps you followed above and catch it before it boots next time.
  • Note for upgrades from gingerbread to jellybean remember the recovery is changed. This means once you install do NOT restore to old-gingerbread-stock ROM from cwm-recovery.
  • To upgrade from stock/CM7/CM9/CM10.1.2/CM10.1.3 to CM10.2, you must first boot into recovery and wipe data, cache, and dalvik cache (factory reset). Due to the new partition layout in CM10.2, failing to perform these steps will result in a bootloop. See here for details; more about repartitioning here. If you missed this step before installing, boot to recovery and factory reset, then reinstall CM10.2.
  • Some users have reported connection errors if the device is connected to a USB hub. If you experience such errors it is recommended that you try connecting your device to a USB port on the motherboard.
  • Antivirus software may prevent Heimdall from connecting properly. Disable your antivirus before proceeding.
  • When Heimdall fails to connect, the Download mode may get stuck, making all further attempts fail too. To retry, you may need to restart the Download mode: turn off the phone by holding Power for 5-10 seconds (or by pulling out the battery), then boot into Download mode and run Heimdall again.
  • If Heimdall fails to connect (errors related to initializing the protocol, or transferring data):
    if you just installed the driver, try rebooting your computer and trying again.
    if you still have troubles after reboot, in Zadig try installing the libusbK driver rather than the WinUSB driver.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Place the CyanogenMod .zip package, as well as any optional .zip packages, on the root of /sdcard:
    • Using adb: adb push filename.zip /sdcard/
    Note: You can copy the .zip packages to your device using any method you are familiar with. The adb method is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure /sdcard (sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
  4. If you are not already in recovery, boot to recovery mode now.
    • Volume Up & Power. Hold all Buttons until the screen flashes twice, then release both.
  5. In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
  6. Optional (Recommended): Select the Backup button to create a backup.
  7. Select Wipe and then Factory Reset.
  8. Select Install.
  9. Navigate to /sdcard and select the CyanogenMod .zip package.
  10. Follow the on-screen notices to install the package.
  11. Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
  12. Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Samsung Galaxy Note 8.0 (GSM) (n5100)

Introduction

These instructions will hopefully assist you to start with a stock Galaxy Note 8.0 (GSM), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Galaxy Note 8.0 (GSM)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Galaxy Note 8.0 (GSM) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast n5100

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast n5100

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Galaxy Note 8.0 (GSM) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/n5100 directory (you can cd ~/android/system/device/samsung/n5100 if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/samsung directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/samsung directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch n5100

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make n5100 should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/n5100/cm_n5100-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-n5100.zip, which is the CyanogenMod installation package.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-n5100.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

LG Nitro HD / Optimus 4G LTE (p930)/(p935)

Cyanogenmod ROM LG Nitro HD / Optimus 4G LTE (P930) (P935)

Cyanogenmod ROM LG Nitro HD / Optimus 4G LTE (p930)/(p935)

Nitro HD / Optimus 4G LTE Specifications
Codename: p930
Also known as: p935
Vendor: LG
Type: phone
Platform: Qualcomm APQ8060
CPU: 1.5 GHz dual-core Snapdragon S3
GPU: Adreno 220
RAM: 1GB
Screen size: 114 mm (4.5 in)
Resolution: 720×1280
Screen density: 326 ppi
Screen type: IPS LCD
CM supported: 10, 10.1, 10.2, 11

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Rooting the LG Nitro HD

Rooting Notes

If you have the Ice Cream Sandwich (Android 4.0) update installed, the ZergRush rooting method will not work. It is possible to root with these instructions: http://www.androidauthority.com/optimus-4g-lte-p930-bell-root-android-4-0-4-update-v20e-109991/

If you would like to install Cyanogenmod, I recommend following this guide that downgrades your OS first so that MOD Manager can install the recovery correctly: http://forum.xda-developers.com/showthread.php?t=1784709

Rooting the Optimus 4G LTE

  1. Download the zergRush exploit: Download
    • md5: 76a9e33cfa70520b1dc9dc00ddbc64a1
  2. Download the Superuser package: Download
    • md5: a2844ac335a5c1cfdb9bea2fc041b415
  3. Download the busybox package: Download
    • md5: 25c5db694c987995909cc3166d4f01b0
  4. Extract the zergRush, Superuser, and busybox packages into the platform-tools folder of the SDK.
  5. On the computer, open terminal and run the following commands from the platform-tools directory:
    adb push zergRush /data/local/
    adb push Superuser.apk /data/local/
    adb push su /data/local/
    adb push busybox /data/local/
    adb shell
    chmod 755 /data/local/zergRush
    chmod 755 /data/local/busybox
    /data/local/zergRush
  6. The terminal should begin outputting some comments attempting to gain root.
  7. If completed successfully, the device should now be temporarily rooted.
  8. On the computer, open terminal and run the following commands from the platform-tools directory:
    adb shell
    mount -o remount,rw -t {{{mountpoint}}} /system
    /data/local/busybox cp /data/local/su /system/xbin/su
    chown 0:0 /system/xbin/su
    chmod 6755 /system/xbin/su
    ln -s /system/xbin/su /system/bin/su
    /data/local/busybox cp /data/local/busybox /system/xbin/busybox
    chown 0:0 /system/xbin/busybox
    chmod 6755 /system/xbin/busybox
    ln -s /system/xbin/busybox /system/bin/busybox
    /data/local/busybox mv /data/local/Superuser.apk /system/app/Superuser.apk

Install a Custom Recovery

  1. Search for ROM Manager in the Market (free or paid) and install the app.
  2. Open the ROM Manager application and select Flash ClockworkMod Recovery.
  3. Click on Optimus 4G LTE (p930) and then give the app root permission if it prompts you.
  4. If it hangs after that and freezes up, just allow the app to Force Close. Then open it back up and repeat steps 2 & 3.
  5. Once the flash was successful, you should see a dialog box that says “Successfully flashed ClockworkMod recovery!”.
  6. Press OK.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Boot to recovery mode, and connect the phone to your computer through USB.
    • Vol Down & Power
  4. In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
  5. Optional (Recommended): Select backup and restore to create a backup.
  6. Select wipe data/factory reset.
  7. You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 or /sdcard as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /sdcard or /data, then: adb push update.zip /sdcard/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  8. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Helpful Tip – SD card folders

CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:

  1. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older: adb push update.zip /sdcard/
  2. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer: adb shell "mkdir /sdcard/0/" followed by adb push update.zip /sdcard/0/
  3. If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer: adb push update.zip /sdcard/0/

How To Build CyanogenMod For LG Nitro HD / Optimus 4G LTE (p930)

Introduction

These instructions will hopefully assist you to start with a stock Nitro HD / Optimus 4G LTE, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Nitro HD / Optimus 4G LTE
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Nitro HD / Optimus 4G LTE (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast p930

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast p930

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Nitro HD / Optimus 4G LTE is connected to your computer via the USB cable and that you are in the ~/android/system/device/lge/p930 directory (you can cd ~/android/system/device/lge/p930 if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/lge directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/lge directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch p930

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make p930 should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/p930/cm_p930-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-p930.zip, which is the CyanogenMod installation package.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-p930.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Categories LG

Motorola Xoom (stingray)

Cyanogenmod ROM Motorola Xoom (CDMA) (Stingray) MZ600

Cyanogenmod ROM Motorola Xoom (CDMA) (stingray) MZ600

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 10.1 (Android 4.2.2 (Jelly Bean))

Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. As a Google Experience Device, the Xoom served as Google’s reference tablet until the expansion of the Nexus line to include tablets. The Verizon Xoom launched with 3G CDMA support only, with a later hardware upgrade to support 4G LTE.

Special boot modes

  • Recovery: Reboot by holding Volume Up & Power. When the Motorola splash shows up wait 3 seconds and press Down. Press Up to confirm enter recovery mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_moto_stingray
Kernel http://www.github.com/cyanogenmod/motorola-kernel-stingray
Xoom (CDMA) Specifications
Codename: stingray
Also known as: MZ600
Vendor: Motorola
Release date: 2011 March
Carrier: Verizon
Type: tablet
CDMA freq: CDMA1900 (BC14), CDMA1700/2100 (BC15)
LTE freq: 700 MHz
Platform: NVIDIA Tegra 2 250 T20
CPU: 1 GHz dual-core ARMv7
GPU: 333MHz NVIDIA GeForce ULP
RAM: 1GB
Weight: 730 g
Dimensions: 249 x 167.8 x 12.9 mm
Screen size: 257 mm (10.1 in)
Resolution: 1280×800
Internal storage: 30GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1 + EDR
Wi-Fi: 802.11 a/b/g/n
Main camera: 5 MP
Secondary camera: 1.9 MP
Power: built-in battery
CM supported: 10, 10.1

How to Install CyanogenMod on the Motorola Xoom (CDMA) (stingray)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Important Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. As a Google Experience Device, the Xoom served as Google’s reference tablet until the expansion of the Nexus line to include tablets. The Verizon Xoom launched with 3G CDMA support only, with a later hardware upgrade to support 4G LTE.

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  2. Download recovery — you can directly download a recovery image using the link below, or visit twrp.me to obtain the latest version of Team Win Recovery Project for your device.
    Recovery: Download
    md5: 5f0824ad1acbe76484afa4cdc1d2e353
  3. Connect the Xoom (CDMA) to the computer via USB.
  4. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  5. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  6. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  8. Once the flash completes successfully, reboot the device into recovery to verify the installation. Boot to recovery instructions: Reboot by holding Volume Up & Power. When the Motorola splash shows up wait 3 seconds and press Down. Press Up to confirm enter recovery mode.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Boot to recovery mode, and connect the phone to your computer through USB.
    • Reboot by holding Volume Up & Power. When the Motorola splash shows up wait 3 seconds and press Down. Press Up to confirm enter recovery mode.
  4. In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
  5. Optional (Recommended): Select backup and restore to create a backup.
  6. Select wipe data/factory reset.
  7. You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 or /sdcard as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /sdcard or /data, then: adb push update.zip /sdcard/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  8. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Helpful Tip – SD card folders

CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:

  1. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older: adb push update.zip /sdcard/
  2. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer: adb shell "mkdir /sdcard/0/" followed by adb push update.zip /sdcard/0/
  3. If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer: adb push update.zip /sdcard/0/

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Motorola Xoom (CDMA) (stingray)

Introduction

These instructions will hopefully assist you to start with a stock Xoom (CDMA), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Xoom (CDMA)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Xoom (CDMA) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Unlocking your Xoom (CDMA)

What does “unlocking” mean?

Note:

If you’ve already installed CyanogenMod or another ROM on your Xoom (CDMA), your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.

The first step in putting any custom operating system on your Xoom (CDMA) is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and moto make it easy.

Note: A Warning About Unlocking

THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.

Okay. I’m in. What do I need to do this?

To unlock your bootloader, you’ll first need a program on your computer called fastboot. One way to get fastboot is to download and install the Android SDK (Software Developer Kit) from Google. The SDK is used by app developers when they’re writing programs for Android, and who knows, you may want to write apps someday. But the SDK also contains two great tools that are useful even to non-developers. They are:

  • adbAndroid Debug Bridge – this is a program that lets your computer “talk” to your Xoom (CDMA) while the device is running. Among the many things you can do with adb– you can push files from your computer to the device or pull files from the device to your computer, you can get a running real-time log of Android activity (which is very useful for debugging or having others help you debug), you can create an interactive “shell” session (similar to Linux or OS X) to type commands to your device, and much more.

  • fastboot – fastboot works a little bit like adb, except it’s often used at a much earlier point in the boot process, even before Android or any operating system loads. You can put your Xoom (CDMA) into a “fastboot” mode, whereby, if you are connected via USB cable, you can copy entire partitions from your computer (usually in the form of an image file, such as boot.img or recovery.img) over to the device, wiping over whatever happened to be there. Fastboot is able to do more than that, however. It’s also used to send special commands to the device to do things such as unlock your bootloader.

How do I do the actual unlocking?

So this should be a one time thing…

Install the Android SDK

To unlock your Xoom (CDMA), you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Note:

Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse” will now install the proper Eclipse and JDK (OpenJDK 6).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Troubleshooting

If you have issues with fastboot or adb not being found, make sure that the Android SDK folder /platform-tools, which contains the adb and fastboot files, are in the path of execution for commands typed at the terminal. Usually typing something like

# PATH=$PATH:/your/specific/path/to/android/sdk/platform-tools/

will work for that terminal session.

Note:

The above command requires a bash-like shell. If you’re running a linux distribution which uses a shell such as csh or tcsh, first run /bin/bash to start a bash shell. See http://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html or google for more help on that. You will need bash later as well, when using the “. build/envsetup.sh” command.

Note: Linux Mint users

If you have problems with adb (“file not found”) and you’re using 64-bit linux (I don’t know much about Mint, so maybe it’s all 64-bit?) try doing this to see if adb works better:

$ sudo apt-get install ia32-libs

You’ll be using fastboot again to install a custom recovery.

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast stingray

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast stingray

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Xoom (CDMA) is connected to your computer via the USB cable and that you are in the ~/android/system/device/moto/stingray directory (you can cd ~/android/system/device/moto/stingray if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/moto directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/moto directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch stingray

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make stingray should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/stingray/cm_stingray-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161225-UNOFFICIAL-stingray.zip, which is the CyanogenMod installation package.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  1. Connect the Xoom (CDMA) to the computer via USB.
  2. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  3. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  4. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  5. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  6. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161225-UNOFFICIAL-stingray.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Motorola Xoom (GSM) (everest)

Cyanogenmod ROM Motorola Xoom (GSM) (Everest) MZ601 / MZ603 / MZ605

Cyanogenmod ROM Motorola Xoom (GSM) (MZ601 / MZ603 / MZ605) (everest)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 10.1 (Android 4.2.2 (Jelly Bean))

Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. Unlike the US variants of the Xoom, the 3G GSM Xoom was not a Google Experience Device.

Source code

Device http://www.github.com/cyanogenmod/android_device_moto_everest
Kernel http://www.github.com/cyanogenmod/motorola-kernel-stingray
Xoom (GSM) Specifications
Codename: everest
Also known as: MZ601 / MZ603 / MZ605
Vendor: Motorola
Manufacturer: Motorola
Release date: 2011 April
Carrier: Verizon
Type: tablet
GSM freq: GSM850, GSM900, GSM1800, GSM1900, UMTS2100 (B1)
Platform: NVIDIA Tegra 2 250 T20
CPU: 1 GHz dual-core ARMv7
GPU: 333MHz NVIDIA GeForce ULP
RAM: 1GB
Weight: 730 g
Dimensions: 249 x 167.8 x 12.9 mm
Screen size: 257 mm (10.1 in)
Resolution: 1280×800
Internal storage: 30GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1 + EDR
Wi-Fi: 802.11 a/b/g/n
Main camera: 5 MP
Secondary camera: 1.9 MP
Power: built-in battery
CM supported: 10, 10.1

How to Install CyanogenMod on the Motorola Xoom (GSM) (everest)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Important Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. Unlike the US variants of the Xoom, the 3G GSM Xoom was not a Google Experience Device.

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  2. Download recovery — you can directly download a recovery image using the link below, or visit twrp.me to obtain the latest version of Team Win Recovery Project for your device.
    Recovery: Download
    md5: a23fedbb261c4aee127ae0256e8ea3fe
  3. Connect the Xoom (GSM) to the computer via USB.
  4. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  5. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  6. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  8. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Boot to recovery mode, and connect the phone to your computer through USB.
  1. In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
  2. Optional (Recommended): Select backup and restore to create a backup.
  3. Select wipe data/factory reset.
  4. You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 or /sdcard as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /sdcard or /data, then: adb push update.zip /sdcard/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  5. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Helpful Tip – SD card folders

CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:

  1. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older: adb push update.zip /sdcard/
  2. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer: adb shell "mkdir /sdcard/0/" followed by adb push update.zip /sdcard/0/
  3. If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer: adb push update.zip /sdcard/0/

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

Note:

Currently, you will need the unified GApps package from Steady Hawkin or Google Apps won’t work properly.

How To Build CyanogenMod For Motorola Xoom (GSM) (everest)

Introduction

These instructions will hopefully assist you to start with a stock Xoom (GSM), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Xoom (GSM)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Xoom (GSM) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Unlocking your Xoom (GSM)

What does “unlocking” mean?

Note:

If you’ve already installed CyanogenMod or another ROM on your Xoom (GSM), your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.

The first step in putting any custom operating system on your Xoom (GSM) is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and moto make it easy.

Note: A Warning About Unlocking

THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.

Okay. I’m in. What do I need to do this?

To unlock your bootloader, you’ll first need a program on your computer called fastboot. One way to get fastboot is to download and install the Android SDK (Software Developer Kit) from Google. The SDK is used by app developers when they’re writing programs for Android, and who knows, you may want to write apps someday. But the SDK also contains two great tools that are useful even to non-developers. They are:

  • adbAndroid Debug Bridge – this is a program that lets your computer “talk” to your Xoom (GSM) while the device is running. Among the many things you can do with adb– you can push files from your computer to the device or pull files from the device to your computer, you can get a running real-time log of Android activity (which is very useful for debugging or having others help you debug), you can create an interactive “shell” session (similar to Linux or OS X) to type commands to your device, and much more.

  • fastboot – fastboot works a little bit like adb, except it’s often used at a much earlier point in the boot process, even before Android or any operating system loads. You can put your Xoom (GSM) into a “fastboot” mode, whereby, if you are connected via USB cable, you can copy entire partitions from your computer (usually in the form of an image file, such as boot.img or recovery.img) over to the device, wiping over whatever happened to be there. Fastboot is able to do more than that, however. It’s also used to send special commands to the device to do things such as unlock your bootloader.

How do I do the actual unlocking?

So this should be a one time thing…

Install the Android SDK

To unlock your Xoom (GSM), you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Note:

Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse” will now install the proper Eclipse and JDK (OpenJDK 6).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Troubleshooting

If you have issues with fastboot or adb not being found, make sure that the Android SDK folder /platform-tools, which contains the adb and fastboot files, are in the path of execution for commands typed at the terminal. Usually typing something like

# PATH=$PATH:/your/specific/path/to/android/sdk/platform-tools/

will work for that terminal session.

Note:

The above command requires a bash-like shell. If you’re running a linux distribution which uses a shell such as csh or tcsh, first run /bin/bash to start a bash shell. See http://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html or google for more help on that. You will need bash later as well, when using the “. build/envsetup.sh” command.

Note: Linux Mint users

If you have problems with adb (“file not found”) and you’re using 64-bit linux (I don’t know much about Mint, so maybe it’s all 64-bit?) try doing this to see if adb works better:

$ sudo apt-get install ia32-libs

You’ll be using fastboot again to install a custom recovery.

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast everest

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast everest

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Xoom (GSM) is connected to your computer via the USB cable and that you are in the ~/android/system/device/moto/everest directory (you can cd ~/android/system/device/moto/everest if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/moto directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/moto directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch everest

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make everest should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/everest/cm_everest-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-everest.zip, which is the CyanogenMod installation package.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  1. Connect the Xoom (GSM) to the computer via USB.
  2. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  3. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  4. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  5. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  6. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-everest.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Motorola XOOM (WiFi) (wingray)

Cyanogenmod ROM Motorola XOOM (WiFi) (wingray) MZ604 / MZ606

Cyanogenmod ROM Motorola XOOM (WiFi) MZ604 / MZ606 (wingray)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 10.1 (Android 4.2.2 (Jelly Bean))

Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. As a Google Experience Device, the Xoom served as Google’s reference tablet until the expansion of the Nexus line to include tablets. The Wi-Fi only Xoom was launched one month after the Verizon Xoom.

Special boot modes

  • Recovery: Vol Down repeatedly during boot until recovery is selected, Vol Up to confirm.

Source code

Device http://www.github.com/cyanogenmod/android_device_moto_wingray
Kernel http://www.github.com/cyanogenmod/motorola-kernel-stingray
Xoom (Wi-Fi) Specifications
Codename: wingray
Also known as: MZ604 / MZ606
Vendor: Motorola
Release date: 2011 April
Carrier: Verizon
Type: tablet
Platform: NVIDIA Tegra 2 250 T20
CPU: 1 GHz dual-core ARMv7
GPU: 333MHz NVIDIA GeForce ULP
RAM: 1GB
Weight: 730 g
Dimensions: 249 x 167.8 x 12.9 mm
Screen size: 257 mm (10.1 in)
Resolution: 1280×800
Internal storage: 30GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1 + EDR
Wi-Fi: 802.11 a/b/g/n
Main camera: 5 MP
Secondary camera: 1.9 MP
Power: built-in battery
CM supported: 9, 10, 10.1

How to Install CyanogenMod on the Motorola Xoom (Wi-Fi) (wingray)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Important Notes

The first Android Honeycomb-based tablet, manufactured by Motorola. As a Google Experience Device, the Xoom served as Google’s reference tablet until the expansion of the Nexus line to include tablets. The Wi-Fi only Xoom was launched one month after the Verizon Xoom.

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  2. Download recovery — you can directly download a recovery image using the link below, or visit twrp.me to obtain the latest version of Team Win Recovery Project for your device.
    Recovery: Download
    md5: a661076dd04167d823cf3ce0ffd951da
  3. Connect the Xoom (Wi-Fi) to the computer via USB.
  4. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  5. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  6. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  8. Once the flash completes successfully, reboot the device into recovery to verify the installation. Boot to recovery instructions: Vol Down repeatedly during boot until recovery is selected, Vol Up to confirm.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Boot to recovery mode, and connect the phone to your computer through USB.
    • Vol Down repeatedly during boot until recovery is selected, Vol Up to confirm.
  4. In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
  5. Optional (Recommended): Select backup and restore to create a backup.
  6. Select wipe data/factory reset.
  7. You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 or /sdcard as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /sdcard or /data, then: adb push update.zip /sdcard/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  8. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Helpful Tip – SD card folders

CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:

  1. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older: adb push update.zip /sdcard/
  2. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer: adb shell "mkdir /sdcard/0/" followed by adb push update.zip /sdcard/0/
  3. If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer: adb push update.zip /sdcard/0/

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

Note:

Some MZ603 & MZ604 owners will experience an issue with the official ClockworkMod Recovery v5.8.3.1, with the error message “Error mounting /sdcard”. Similarly, the “mount USB storage” menu item will show the error “E:Unable to open ums lunfile (No such file or directory)”. (The absence or presence of a MicroSD card in the external slot does not make any difference with this error.) If you run into this error, you may be able to mount a card in the external MicroSD slot instead, by using an alternate recovery image first or by plugging a USB drive into your device and mounting “sdcard” (recovery will mount the USB as an sdcard”). You can also mount the sdcard manually using the command adb shell mount -o bind /data/media /sdcard. If that fails, try adb shell mount /dev/block/mmcblk0p1 /sdcard/

How To Build CyanogenMod For Motorola Xoom (Wi-Fi) (wingray)

Introduction

These instructions will hopefully assist you to start with a stock Xoom (Wi-Fi), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Xoom (Wi-Fi)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Xoom (Wi-Fi) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Unlocking your Xoom (Wi-Fi)

What does “unlocking” mean?

Note:

If you’ve already installed CyanogenMod or another ROM on your Xoom (Wi-Fi), your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.

The first step in putting any custom operating system on your Xoom (Wi-Fi) is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and moto make it easy.

Note: A Warning About Unlocking

THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.

Okay. I’m in. What do I need to do this?

To unlock your bootloader, you’ll first need a program on your computer called fastboot. One way to get fastboot is to download and install the Android SDK (Software Developer Kit) from Google. The SDK is used by app developers when they’re writing programs for Android, and who knows, you may want to write apps someday. But the SDK also contains two great tools that are useful even to non-developers. They are:

  • adbAndroid Debug Bridge – this is a program that lets your computer “talk” to your Xoom (Wi-Fi) while the device is running. Among the many things you can do with adb– you can push files from your computer to the device or pull files from the device to your computer, you can get a running real-time log of Android activity (which is very useful for debugging or having others help you debug), you can create an interactive “shell” session (similar to Linux or OS X) to type commands to your device, and much more.

  • fastboot – fastboot works a little bit like adb, except it’s often used at a much earlier point in the boot process, even before Android or any operating system loads. You can put your Xoom (Wi-Fi) into a “fastboot” mode, whereby, if you are connected via USB cable, you can copy entire partitions from your computer (usually in the form of an image file, such as boot.img or recovery.img) over to the device, wiping over whatever happened to be there. Fastboot is able to do more than that, however. It’s also used to send special commands to the device to do things such as unlock your bootloader.

How do I do the actual unlocking?

So this should be a one time thing…

Install the Android SDK

To unlock your Xoom (Wi-Fi), you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Note:

Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse” will now install the proper Eclipse and JDK (OpenJDK 6).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Troubleshooting

If you have issues with fastboot or adb not being found, make sure that the Android SDK folder /platform-tools, which contains the adb and fastboot files, are in the path of execution for commands typed at the terminal. Usually typing something like

# PATH=$PATH:/your/specific/path/to/android/sdk/platform-tools/

will work for that terminal session.

Note:

The above command requires a bash-like shell. If you’re running a linux distribution which uses a shell such as csh or tcsh, first run /bin/bash to start a bash shell. See http://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html or google for more help on that. You will need bash later as well, when using the “. build/envsetup.sh” command.

Note: Linux Mint users

If you have problems with adb (“file not found”) and you’re using 64-bit linux (I don’t know much about Mint, so maybe it’s all 64-bit?) try doing this to see if adb works better:

$ sudo apt-get install ia32-libs

You’ll be using fastboot again to install a custom recovery.

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast wingray

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast wingray

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Xoom (Wi-Fi) is connected to your computer via the USB cable and that you are in the ~/android/system/device/moto/wingray directory (you can cd ~/android/system/device/moto/wingray if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/moto directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/moto directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch wingray

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make wingray should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/wingray/cm_wingray-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-wingray.zip, which is the CyanogenMod installation package.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  1. Connect the Xoom (Wi-Fi) to the computer via USB.
  2. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  3. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  4. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  5. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  6. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-wingray.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Oppo R7 Plus (r7plus)

CyanogenMod ROM Oppo R7 Plus (r7plus)

CyanogenMod ROM Oppo R7 Plus (r7plus)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))

Special boot modes

  • Recovery: With the device powered down, hold the Volume Down and Power buttons.
  • Fastboot: With the device powered down, hold the Volume Up and Power buttons.

Source code

Device http://www.github.com/cyanogenmod/android_device_oppo_r7plus
Kernel http://www.github.com/cyanogenmod/android_kernel_oppo_msm8939
R7 Plus Specifications
Codename: r7plus
Vendor: Oppo
Release date: 2015 May
Type: phone
Platform: Qualcomm Snapdragon 615
CPU: 1.5 GHz and 1.0 GHz octa-core Cortex A53
GPU: Adreno 405
RAM: 3GB
Weight: 192 g (6.77 oz)
Dimensions: 158 mm (6.22 in) (h)
82 mm (3.23 in) (w)
7.8 mm (0.31 in) (d)
Screen size: 152 mm (6.0 in)
Resolution: 1080×1920
Screen density: 367 ppi
Screen type: AMOLED
Internal storage: 32GB
SD Card: up to 128GB
Bluetooth: 4.0
Wi-Fi: 802.11 a/b/g/n/ac
Main camera: 13MP Sony IMX278, flash: Dual LED
Secondary camera: 8MP OmniVision OV8858
Power: 4100 mAh Li-Po
Peripherals: Dual SIM, Fingerprint sensor
CM supported: 12.1, 13, 14.1

How to Install CyanogenMod on the Oppo R7 Plus (r7plus)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  2. Download recovery — you can directly download a recovery image using the link below, or visit twrp.me to obtain the latest version of Team Win Recovery Project for your device.
    Recovery: Download
    md5: f7768891e8a68cda18ef3f8c47ad834a
  3. Connect the R7 Plus to the computer via USB.
  4. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  5. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  6. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  8. Once the flash completes successfully, reboot the device into recovery to verify the installation. Boot to recovery instructions: With the device powered down, hold the Volume Down and Power buttons.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Place the CyanogenMod .zip package, as well as any optional .zip packages, on the root of /sdcard:
    • Using adb: adb push filename.zip /sdcard/
    Note: You can copy the .zip packages to your device using any method you are familiar with. The adb method is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure /sdcard (sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
  4. If you are not already in recovery, boot to recovery mode now.
    • With the device powered down, hold the Volume Down and Power buttons.
  5. In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
  6. Optional (Recommended): Select the Backup button to create a backup.
  7. Select Wipe and then Factory Reset.
  8. Select Install.
  9. Navigate to /sdcard and select the CyanogenMod .zip package.
  10. Follow the on-screen notices to install the package.
  11. Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
  12. Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Oppo R7 Plus (r7plus)

Introduction

These instructions will hopefully assist you to start with a stock R7 Plus, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A R7 Plus
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the R7 Plus (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Unlocking your R7 Plus

What does “unlocking” mean?

Note:

If you’ve already installed CyanogenMod or another ROM on your R7 Plus, your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.

The first step in putting any custom operating system on your R7 Plus is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and oppo make it easy.

Note: A Warning About Unlocking

THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.

Okay. I’m in. What do I need to do this?

To unlock your bootloader, you’ll first need a program on your computer called fastboot. One way to get fastboot is to download and install the Android SDK (Software Developer Kit) from Google. The SDK is used by app developers when they’re writing programs for Android, and who knows, you may want to write apps someday. But the SDK also contains two great tools that are useful even to non-developers. They are:

  • adbAndroid Debug Bridge – this is a program that lets your computer “talk” to your R7 Plus while the device is running. Among the many things you can do with adb– you can push files from your computer to the device or pull files from the device to your computer, you can get a running real-time log of Android activity (which is very useful for debugging or having others help you debug), you can create an interactive “shell” session (similar to Linux or OS X) to type commands to your device, and much more.

  • fastboot – fastboot works a little bit like adb, except it’s often used at a much earlier point in the boot process, even before Android or any operating system loads. You can put your R7 Plus into a “fastboot” mode, whereby, if you are connected via USB cable, you can copy entire partitions from your computer (usually in the form of an image file, such as boot.img or recovery.img) over to the device, wiping over whatever happened to be there. Fastboot is able to do more than that, however. It’s also used to send special commands to the device to do things such as unlock your bootloader.

How do I do the actual unlocking?

So this should be a one time thing…

Install the Android SDK

To unlock your R7 Plus, you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Note:

Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse” will now install the proper Eclipse and JDK (OpenJDK 6).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem unlock
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Troubleshooting

If you have issues with fastboot or adb not being found, make sure that the Android SDK folder /platform-tools, which contains the adb and fastboot files, are in the path of execution for commands typed at the terminal. Usually typing something like

# PATH=$PATH:/your/specific/path/to/android/sdk/platform-tools/

will work for that terminal session.

Note:

The above command requires a bash-like shell. If you’re running a linux distribution which uses a shell such as csh or tcsh, first run /bin/bash to start a bash shell. See http://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html or google for more help on that. You will need bash later as well, when using the “. build/envsetup.sh” command.

Note: Linux Mint users

If you have problems with adb (“file not found”) and you’re using 64-bit linux (I don’t know much about Mint, so maybe it’s all 64-bit?) try doing this to see if adb works better:

$ sudo apt-get install ia32-libs

You’ll be using fastboot again to install a custom recovery.

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast r7plus

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast r7plus

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your R7 Plus is connected to your computer via the USB cable and that you are in the ~/android/system/device/oppo/r7plus directory (you can cd ~/android/system/device/oppo/r7plus if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/oppo directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/oppo directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch r7plus

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make r7plus should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/r7plus/cm_r7plus-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-r7plus.zip, which is the CyanogenMod installation package.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  1. Connect the R7 Plus to the computer via USB.
  2. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  3. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  4. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  5. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  6. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-r7plus.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Motorola Moto G LTE (4G) 2014 (thea)

CyanogeMod ROM Motorola Moto G LTE (4G) 2014 (thea, thea_umtsds, thea_ds, XT1072, XT1077, XT1078, XT1079)

CyanogeMod ROM Motorola Moto G LTE (4G) 2014 (thea, thea_umtsds, thea_ds, XT1072, XT1077, XT1078, XT1079)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))

Notes

This is a unified build that supports retail (XT1072, XT1077, XT1078 and XT1079).

Special boot modes

  • Recovery: Hold Volume Down & Power simultaneously. On the next screen use Volume Down to scroll to recovery and then use Volume Up to select.
  • Bootloader: Hold Volume Down & Power simultaneously. On the next screen use Volume Down to scroll and Volume Up to select.
  • Fastboot: Hold Volume Down & Power simultaneously.

Source code

Device http://www.github.com/cyanogenmod/android_device_motorola_thea
Kernel http://www.github.com/cyanogenmod/android_kernel_motorola_msm8226
Moto G 2014 LTE Specifications
Codename: thea
Also known as: thea, thea_umtsds, thea_ds, XT1072, XT1077, XT1078, XT1079
Vendor: Motorola
Release date: 2015 January
Type: phone
GSM freq: GSM 850/900/1800/1900 MHz, HSDPA 850/900/1900/2100 MHz – International, HSDPA 850/1700/1900/2100 MHz- T-Mobile, AT&T
CDMA freq: CDMA 800/1900 MHz, CDMA2000 1xEV-DO
LTE freq: LTE band 1(2100), 3(1800), 7(2600), 20(800)
Platform: Qualcomm Snapdragon 400 MSM8926
CPU: 1.2 GHz quad-core Cortex A7
GPU: Adreno 305
RAM: 1GB
Weight: 149 g (5.26 oz)
Dimensions: 141.5 x 70.7 x 11 mm (5.57 x 2.78 x 0.43 in)
Screen size: 127 mm (5.0 in)
Resolution: 720 x 1280 pixels
Screen density: ~294 ppi
Screen type: IPS LCD capacitive touchscreen, 16M colors
Internal storage: 8GB or 16GB
SD Card: up to 32GB
Bluetooth: v4.0 with A2DP, LE
Wi-Fi: Wi-Fi 802.11 b/g/n, Wi-Fi hotspot
Main camera: 8MP, flash: LED
Secondary camera: 2MP
Power: 2390 mAh
Peripherals: Accelerometer, gyroscope, proximity, compass
CM supported: 12.1, 13, 14.1

How to Install CyanogenMod on the Motorola Moto G 2014 LTE (thea)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Important Notes

This is a unified build that supports retail (XT1072, XT1077, XT1078 and XT1079).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to obtain your bootloader unlock code:
    fastboot oem get_unlock_data
  8. Visit the Motorola Bootloader Unlock website and follow the instructions there to obtain your unlock key and unlock your bootloader.
  9. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  10. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  2. Download recovery — you can directly download a recovery image using the link below, or visit twrp.me to obtain the latest version of Team Win Recovery Project for your device.
    Recovery: Download
    md5: 35c37561f0c22bfe23cd01b5c388e8b5
  3. Connect the Moto G 2014 LTE to the computer via USB.
  4. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  5. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  6. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  7. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  8. Once the flash completes successfully, reboot the device into recovery to verify the installation. Boot to recovery instructions: Hold Volume Down & Power simultaneously. On the next screen use Volume Down to scroll to recovery and then use Volume Up to select.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Place the CyanogenMod .zip package, as well as any optional .zip packages, on the root of /sdcard:
    • Using adb: adb push filename.zip /sdcard/
    Note: You can copy the .zip packages to your device using any method you are familiar with. The adb method is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure /sdcard (sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
  4. If you are not already in recovery, boot to recovery mode now.
    • Hold Volume Down & Power simultaneously. On the next screen use Volume Down to scroll to recovery and then use Volume Up to select.
  5. In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
  6. Optional (Recommended): Select the Backup button to create a backup.
  7. Select Wipe and then Factory Reset.
  8. Select Install.
  9. Navigate to /sdcard and select the CyanogenMod .zip package.
  10. Follow the on-screen notices to install the package.
  11. Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
  12. Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Motorola Moto G 2014 LTE (thea)

Introduction

These instructions will hopefully assist you to start with a stock Moto G 2014 LTE, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Moto G 2014 LTE
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Moto G 2014 LTE (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Unlocking your Moto G 2014 LTE

What does “unlocking” mean?

Note:

If you’ve already installed CyanogenMod or another ROM on your Moto G 2014 LTE, your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.

The first step in putting any custom operating system on your Moto G 2014 LTE is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and motorola make it easy.

Note: A Warning About Unlocking

THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.

Okay. I’m in. What do I need to do this?

To unlock your bootloader, you’ll first need a program on your computer called fastboot. One way to get fastboot is to download and install the Android SDK (Software Developer Kit) from Google. The SDK is used by app developers when they’re writing programs for Android, and who knows, you may want to write apps someday. But the SDK also contains two great tools that are useful even to non-developers. They are:

  • adbAndroid Debug Bridge – this is a program that lets your computer “talk” to your Moto G 2014 LTE while the device is running. Among the many things you can do with adb– you can push files from your computer to the device or pull files from the device to your computer, you can get a running real-time log of Android activity (which is very useful for debugging or having others help you debug), you can create an interactive “shell” session (similar to Linux or OS X) to type commands to your device, and much more.

  • fastboot – fastboot works a little bit like adb, except it’s often used at a much earlier point in the boot process, even before Android or any operating system loads. You can put your Moto G 2014 LTE into a “fastboot” mode, whereby, if you are connected via USB cable, you can copy entire partitions from your computer (usually in the form of an image file, such as boot.img or recovery.img) over to the device, wiping over whatever happened to be there. Fastboot is able to do more than that, however. It’s also used to send special commands to the device to do things such as unlock your bootloader.

How do I do the actual unlocking?

So this should be a one time thing…

Install the Android SDK

To unlock your Moto G 2014 LTE, you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Note:

Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse” will now install the proper Eclipse and JDK (OpenJDK 6).

Unlocking the bootloader

WARNING:

Unlocking the bootloader will automatically wipe all device data.

  1. Make sure your computer has working fastboot and adb.
  2. Enable USB debugging on the device.
  3. Enable OEM unlock in the Developer options settings on the device. (Note: Not all devices have this setting, so continue with next step if yours does not.)
  4. Connect the device to the computer through USB.
  5. From a terminal on a computer, type the following to boot the device into fastboot mode:
    adb reboot bootloader
  6. Once the device is in fastboot mode, verify your PC sees the device by typing fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissions fastboot”, try running fastboot as root.
  7. From the same terminal, type the following command to unlock the bootloader:
    fastboot oem get_unlock_data
  8. If the device doesn’t automatically reboot, reboot it from the menu. It should now be unlocked.
  9. Since the device resets completely, you will need to re-enable USB debugging on the device to continue.

Troubleshooting

If you have issues with fastboot or adb not being found, make sure that the Android SDK folder /platform-tools, which contains the adb and fastboot files, are in the path of execution for commands typed at the terminal. Usually typing something like

# PATH=$PATH:/your/specific/path/to/android/sdk/platform-tools/

will work for that terminal session.

Note:

The above command requires a bash-like shell. If you’re running a linux distribution which uses a shell such as csh or tcsh, first run /bin/bash to start a bash shell. See http://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html or google for more help on that. You will need bash later as well, when using the “. build/envsetup.sh” command.

Note: Linux Mint users

If you have problems with adb (“file not found”) and you’re using 64-bit linux (I don’t know much about Mint, so maybe it’s all 64-bit?) try doing this to see if adb works better:

$ sudo apt-get install ia32-libs

You’ll be using fastboot again to install a custom recovery.

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast thea

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast thea

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Moto G 2014 LTE is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/thea directory (you can cd ~/android/system/device/motorola/thea if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/motorola directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/motorola directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch thea

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make thea should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/thea/cm_thea-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-thea.zip, which is the CyanogenMod installation package.

Installing a custom recovery using fastboot

See All About Recovery Images for more information about custom recoveries and their capabilities.

  1. Make sure your computer has working fastboot and adb.
  1. Connect the Moto G 2014 LTE to the computer via USB.
  2. Make sure the fastboot binary is in your PATH or that you place the recovery image in the same directory as fastboot.
  3. Open a terminal on your PC and reboot the device into fastboot mode by typing
    adb reboot bootloader
    or by using the hardware key combination for your device while it is powered off.
  4. Once the device is in fastboot mode, verify your PC sees the device by typing
    fastboot devices
    • If you don’t see your device serial number, and instead see “<waiting for device>”, fastboot is not configured properly on your machine. See fastboot documentation for more info.
    • If you see “no permissionsfastboot”, make sure your UDEV rules are setup correctly.
  5. Flash recovery onto your device by entering the following command:
    fastboot flash recovery your_recovery_image.img
    where the latter part is the filename of the recovery image.
  6. Once the flash completes successfully, reboot the device into recovery to verify the installation.
    • Note: Some ROMs overwrite recovery at boot time so if you do not plan to immediately boot into recovery to install CyanogenMod, please be aware that this may overwrite your custom recovery with the stock one.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-thea.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Samsung Galaxy Note 2 LTE (r950)

CyanogenMod ROM Samsung Galaxy Note 2 LTE (US Cellular) (r950) SCH-R950

CyanogenMod ROM Samsung Galaxy Note 2 LTE (US Cellular) (r950) SCH-R950

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 11 (Android 4.4-4.4.4 (KitKat))

Special boot modes

  • Recovery: Home & Volume Up & Power
  • Download: Home & Volume Down & Power

Source code

Device http://www.github.com/cyanogenmod/android_device_samsung_r950
Kernel http://www.github.com/cyanogenmod/android_kernel_samsung_smdk4412
Galaxy Note 2 LTE (US Cellular) Specifications
Codename: r950
Also known as: SCH-R950
Vendor: Samsung
Release date: Dec 2012
Carrier: US Cellular
Type: phablet
CDMA freq: CDMA 1x/EVDO Rev A, Tri-band: 800/AWS/1900MHz
LTE freq: Band 2 (1900MHz), Band 4 (AWS), Band 5 (850MHz), Band 12 (700MHz)
Platform: Samsung Exynos 4412
CPU: 1.6 GHz quad-core Cortex A9
GPU: Mali-400
RAM: 2GB
Weight: 182 g (6.34 oz)
Dimensions: 151 mm (5.949 in) (h)
81 mm (3.17 in) (w)
9.45 mm (0.37 in) (d)
Screen size: 141 mm (5.5 in)
Resolution: 1280×720
Internal storage: 16GB
SD Card: up to 64GB
Bluetooth: 4.0
Wi-Fi: 802.11 a/b/g/n
Main camera: 8MP w/ flash
Secondary camera: 1.9MP
CM supported: 10.1, 10.2, 11

How to Install CyanogenMod on the Samsung Galaxy Note 2 LTE (US Cellular) (r950)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Installing a custom recovery

Samsung devices come with a unique boot mode called Download Mode which is very similar to Fastboot Mode on some devices with unlocked bootloaders. Heimdall is a cross-platform, open source tool for interfacing with Download Mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode. Rooting the stock firmware is neither recommended nor necessary.

  1. Download and install the Heimdall Suite
    • Windows: Extract the Heimdall suite and take note of the directory holding heimdall.exe. You can verify Heimdall is working by opening a command prompt in this directory and typing heimdall version. If you receive an error, be sure that you have the Microsoft Visual C++ 2012 Redistributable Package (x86/32bit) installed on your computer.
    • Linux: Pick the appropriate installation package based on your distribution. The -frontend packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Mac: Install the dmg package. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Building from source: The source code for the Heimdall Suite is available on Github. For more details about how to compile the Heimdall Suite, please refer to the README file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.
  2. Download recovery — you can directly download a recovery image using the link below, or visit TWRP site to check for the latest version of recovery for your device (if your device can be found there). For general info about recoveries click here.
    Recovery: Download
    md5: 8b9b34f7375ae9142fd5e7aecc10ce99
  3. Power off the Galaxy Note 2 LTE (US Cellular) and connect the USB adapter to the computer but not to the Galaxy Note 2 LTE (US Cellular), yet.
  4. Boot the Galaxy Note 2 LTE (US Cellular) into download mode. Home & Volume Down & Power Accept the disclaimer on the device. Then, insert the USB cable into the device.
  5. Windows (only) driver installation – Skip this step if you are using Linux or Mac
    A more complete set of the following instructions can be found in the Zadig User Guide.
    1. Run zadig.exe from the Drivers folder of the Heimdall Suite.
    2. Choose Options » List All Devices from the menu.
    3. Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
    4. Click Replace Driver (having selecting “Install Driver” from the drop down list built into the button).
    5. If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
  6. At this point, familiarize yourself with the Flashing with heimdall notes below so that you are prepared for any strange behaviour if it occurs.
  7. On the computer, open a terminal (or Command Prompt on Windows) in the directory where the recovery image is located and type:
    heimdall flash --RECOVERY recovery.img --no-reboot
    Tip: The file may not be named identically to what’s in this command. If the file is wrapped in a zip or tar file, extract the file first, because heimdall isn’t going to do it for you.
  8. A blue transfer bar will appear on the device showing the recovery being transferred.
  9. Unplug the USB cable from your device.
    • NOTE: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
  10. Manually reboot the phone into recovery mode by performing the following. Home & Volume Up & Power
  11. The Galaxy Note 2 LTE (US Cellular) now has a custom recovery installed. Continue to the next section.

Note: Flashing with heimdall

  • In Windows 7 UAC (User Account Control) may need switching off. Once Heimdall is finished it can be re-enabled.
  • Protocol initialization can fail if the device is connected via a USB hub – connect the USB cable directly to the PC
  • It may be necessary to run the heimdall flash command as root in Linux or Mac OS X: sudo heimdall flash [...]. Typical symptoms of this are:
    • a blue bar doesn’t show up after the process has finished
    • Failed to confirm end of file transfer sequence!
  • It may be necessary to capitalize the name of the partition on some devices. Try --KERNEL instead of --kernel and/or --recovery instead of --RECOVERY.
  • If on Linux 64bit you get “unable to execute ./heimdall: No such file or directory”, try the 32bit version and make sure to run it with sudo: reference.
  • On Mac OS X you may see this message: “ERROR: Claiming interface failed!”. If so, you need to disable the default USB drivers with the following commands:
    sudo kextunload -b com.apple.driver.AppleUSBCDC;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
    If you have installed Samsung Kies, you may further need to unload those USB drivers with the following commands:
    sudo kextunload -b com.devguru.driver.SamsungComposite;
    sudo kextunload -b com.devguru.driver.SamsungACMData
    sudo kextunload -b com.devguru.driver.SamsungACMControl
  • Using Heimdall version 1.4.0 (the latest version available for download on the Glass Echidna website) you may see this message or one similar to it:
    Error: Failed to confirm end of PIT file transfer!
    If you experience this error, follow the instructions for compiling Heimdall from source to get the latest version on GitHub with the issue patched.

Helpful Tip

  • The stock ROM may overwrite your custom recovery on boot. To prevent this, boot immediately into recovery after leaving Download Mode instead of letting the ROM boot up normally. If your recovery is overwritten, simply redo the steps you followed above and catch it before it boots next time.
  • Note for upgrades from gingerbread to jellybean remember the recovery is changed. This means once you install do NOT restore to old-gingerbread-stock ROM from cwm-recovery.
  • To upgrade from stock/CM7/CM9/CM10.1.2/CM10.1.3 to CM10.2, you must first boot into recovery and wipe data, cache, and dalvik cache (factory reset). Due to the new partition layout in CM10.2, failing to perform these steps will result in a bootloop. See here for details; more about repartitioning here. If you missed this step before installing, boot to recovery and factory reset, then reinstall CM10.2.
  • Some users have reported connection errors if the device is connected to a USB hub. If you experience such errors it is recommended that you try connecting your device to a USB port on the motherboard.
  • Antivirus software may prevent Heimdall from connecting properly. Disable your antivirus before proceeding.
  • When Heimdall fails to connect, the Download mode may get stuck, making all further attempts fail too. To retry, you may need to restart the Download mode: turn off the phone by holding Power for 5-10 seconds (or by pulling out the battery), then boot into Download mode and run Heimdall again.
  • If Heimdall fails to connect (errors related to initializing the protocol, or transferring data):
    if you just installed the driver, try rebooting your computer and trying again.
    if you still have troubles after reboot, in Zadig try installing the libusbK driver rather than the WinUSB driver.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Place the CyanogenMod .zip package, as well as any optional .zip packages, on the root of /sdcard:
    • Using adb: adb push filename.zip /sdcard/
    Note: You can copy the .zip packages to your device using any method you are familiar with. The adb method is used here because it is universal across all devices and works in both Android and recovery mode. If you are in recovery mode, you may need to ensure /sdcard (sometimes called Internal Storage) is mounted by checking its status in the Mounts menu. If you have booted regularly, USB debugging must be enabled.
  4. If you are not already in recovery, boot to recovery mode now.
    • Home & Volume Up & Power
  5. In Team Win Recovery Project, select menu choices by tapping on the appropriately labelled button.
  6. Optional (Recommended): Select the Backup button to create a backup.
  7. Select Wipe and then Factory Reset.
  8. Select Install.
  9. Navigate to /sdcard and select the CyanogenMod .zip package.
  10. Follow the on-screen notices to install the package.
  11. Optional: Install any additional packages you wish using the same method (if you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it).
  12. Once installation has finished, return to the main menu and select Reboot, then System. The device will now boot into CyanogenMod.

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Samsung Galaxy Note 2 LTE (US Cellular) (r950)

Introduction

These instructions will hopefully assist you to start with a stock Galaxy Note 2 LTE (US Cellular), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Galaxy Note 2 LTE (US Cellular)
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Galaxy Note 2 LTE (US Cellular) (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast r950

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast r950

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Galaxy Note 2 LTE (US Cellular) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/r950 directory (you can cd ~/android/system/device/samsung/r950 if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/samsung directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/samsung directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch r950

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make r950 should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/r950/cm_r950-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-r950.zip, which is the CyanogenMod installation package.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-r950.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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

Samsung Galaxy S2 Epic Touch 4G (d710)

Samsung Galaxy S II Epic 4G Touch ("d710") Cyanogenmod

CyanogenMod ROM Samsung Galaxy S II / S2 Epic Touch 4G (d710) Sprint

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 11 (Android 4.4-4.4.4 (KitKat))

Notes

WARNING:

Some second-generation Samsung Exynos devices are potentially susceptible to a “superbrick” caused by performing a factory reset with the stock kernel, which effectively kills the internal memory in the device. It is highly recommended you do not perform this operation while using a stock kernel for safety reasons.

WARNING:

The newest CM11 Gapps package (20140606) is too big for the /system partition of d710. Please use the 20140105 package instead.

The install guide assumes the device is already running stock Android 4.x

Special boot modes

  • Recovery: Volume Up & Power
  • Download: Volume Down & Power

Source code

Device http://www.github.com/cyanogenmod/android_device_samsung_d710
Kernel http://www.github.com/cyanogenmod/android_kernel_samsung_smdk4412
Galaxy S II Epic 4G Touch Specifications
Codename: d710
Vendor: Samsung
Release date: 2011 September 16
Carrier: Sprint
Type: phone
WiMAX freq: 2.5 Ghz WiMAX
CDMA freq: 800 1900 MHz CDMA
2000 MHz 1xEV-DO
Platform: Samsung Exynos 4210
CPU: 1.2 GHz dual-core Cortex A9
GPU: ARM Mali-400
RAM: 1GB
Weight: 130 g (4.59 oz)
Dimensions: 130 mm (5.12 in) (h)
70 mm (2.76 in) (w)
10 mm (0.39 in) (d)
Screen size: 114 mm (4.5 in)
Resolution: 800×480
Screen density: 206 ppi
Internal storage: 16GB
SD Card: up to 32GB
Bluetooth: 3.0+HS
Wi-Fi: 802.11 a/b/g/n
Main camera: 8MP w/ LED-flash
Secondary camera: 2MP
Power: 1800 mAh
CM supported: 10.1, 10.2, 11

How to Install CyanogenMod on the Samsung Galaxy S II Epic 4G Touch (d710)

Note: DISCLAIMER

Modifying or replacing your device’s software may void your device’s warranty, lead to data loss, hair loss, financial loss, privacy loss, security breaches, or other damage, and therefore must be done entirely at your own risk. No one affiliated with the CyanogenMod project is responsible for your actions. Good luck.

Important Notes

WARNING:

Some second-generation Samsung Exynos devices are potentially susceptible to a “superbrick” caused by performing a factory reset with the stock kernel, which effectively kills the internal memory in the device. It is highly recommended you do not perform this operation while using a stock kernel for safety reasons.

WARNING:

The newest CM11 Gapps package (20140606) is too big for the /system partition of d710. Please use the 20140105 package instead.

The install guide assumes the device is already running stock Android 4.x

Installing a custom recovery

Samsung devices come with a unique boot mode called Download Mode which is very similar to Fastboot Mode on some devices with unlocked bootloaders. Heimdall is a cross-platform, open source tool for interfacing with Download Mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode. Rooting the stock firmware is neither recommended nor necessary.

  1. Download and install the Heimdall Suite
    • Windows: Extract the Heimdall suite and take note of the directory holding heimdall.exe. You can verify Heimdall is working by opening a command prompt in this directory and typing heimdall version. If you receive an error, be sure that you have the Microsoft Visual C++ 2012 Redistributable Package (x86/32bit) installed on your computer.
    • Linux: Pick the appropriate installation package based on your distribution. The -frontend packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Mac: Install the dmg package. After installation, heimdall should be available from the terminal; type heimdall version to verify installation succeeded.
    • Building from source: The source code for the Heimdall Suite is available on Github. For more details about how to compile the Heimdall Suite, please refer to the README file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.
  2. Download recovery — visit TWRP site to check for the latest version of recovery for your device (if your device can be found there). For general info about recoveries click here.
  3. Power off the Galaxy S II Epic 4G Touch and connect the USB adapter to the computer but not to the Galaxy S II Epic 4G Touch, yet.
  4. Boot the Galaxy S II Epic 4G Touch into download mode. Volume Down & Power Accept the disclaimer on the device. Then, insert the USB cable into the device.
  5. Windows (only) driver installation – Skip this step if you are using Linux or Mac
    A more complete set of the following instructions can be found in the Zadig User Guide.
    1. Run zadig.exe from the Drivers folder of the Heimdall Suite.
    2. Choose Options » List All Devices from the menu.
    3. Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
    4. Click Replace Driver (having selecting “Install Driver” from the drop down list built into the button).
    5. If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
  6. At this point, familiarize yourself with the Flashing with heimdall notes below so that you are prepared for any strange behaviour if it occurs.
  7. On the computer, open a terminal (or Command Prompt on Windows) in the directory where the recovery image is located and type:
    heimdall flash --kernel zImage --no-reboot
    Tip: The file may not be named identically to what’s in this command. If the file is wrapped in a zip or tar file, extract the file first, because heimdall isn’t going to do it for you.
    Note: this device has an initramfs recovery, meaning recovery is actually packaged inside a kernel image. Substitute the filename of the kernel/recovery combo that you downloaded in place of zImage above.
  8. A blue transfer bar will appear on the device showing the recovery being transferred.
  9. Unplug the USB cable from your device.
    • NOTE: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
  10. Manually reboot the phone into recovery mode by performing the following. Volume Up & Power
  11. The Galaxy S II Epic 4G Touch now has a custom recovery installed. Continue to the next section.

Note: Flashing with heimdall

  • In Windows 7 UAC (User Account Control) may need switching off. Once Heimdall is finished it can be re-enabled.
  • Protocol initialization can fail if the device is connected via a USB hub – connect the USB cable directly to the PC
  • It may be necessary to run the heimdall flash command as root in Linux or Mac OS X: sudo heimdall flash [...]. Typical symptoms of this are:
    • a blue bar doesn’t show up after the process has finished
    • Failed to confirm end of file transfer sequence!
  • It may be necessary to capitalize the name of the partition on some devices. Try --KERNEL instead of --kernel and/or --recovery instead of --RECOVERY.
  • If on Linux 64bit you get “unable to execute ./heimdall: No such file or directory”, try the 32bit version and make sure to run it with sudo: reference.
  • On Mac OS X you may see this message: “ERROR: Claiming interface failed!”. If so, you need to disable the default USB drivers with the following commands:
    sudo kextunload -b com.apple.driver.AppleUSBCDC;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
    sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
    If you have installed Samsung Kies, you may further need to unload those USB drivers with the following commands:
    sudo kextunload -b com.devguru.driver.SamsungComposite;
    sudo kextunload -b com.devguru.driver.SamsungACMData
    sudo kextunload -b com.devguru.driver.SamsungACMControl
  • Using Heimdall version 1.4.0 (the latest version available for download on the Glass Echidna website) you may see this message or one similar to it:
    Error: Failed to confirm end of PIT file transfer!
    If you experience this error, follow the instructions for compiling Heimdall from source to get the latest version on GitHub with the issue patched.

Helpful Tip

  • The stock ROM may overwrite your custom recovery on boot. To prevent this, boot immediately into recovery after leaving Download Mode instead of letting the ROM boot up normally. If your recovery is overwritten, simply redo the steps you followed above and catch it before it boots next time.
  • Note for upgrades from gingerbread to jellybean remember the recovery is changed. This means once you install do NOT restore to old-gingerbread-stock ROM from cwm-recovery.
  • To upgrade from stock/CM7/CM9/CM10.1.2/CM10.1.3 to CM10.2, you must first boot into recovery and wipe data, cache, and dalvik cache (factory reset). Due to the new partition layout in CM10.2, failing to perform these steps will result in a bootloop. See here for details; more about repartitioning here. If you missed this step before installing, boot to recovery and factory reset, then reinstall CM10.2.
  • Some users have reported connection errors if the device is connected to a USB hub. If you experience such errors it is recommended that you try connecting your device to a USB port on the motherboard.
  • Antivirus software may prevent Heimdall from connecting properly. Disable your antivirus before proceeding.
  • When Heimdall fails to connect, the Download mode may get stuck, making all further attempts fail too. To retry, you may need to restart the Download mode: turn off the phone by holding Power for 5-10 seconds (or by pulling out the battery), then boot into Download mode and run Heimdall again.
  • If Heimdall fails to connect (errors related to initializing the protocol, or transferring data):
    if you just installed the driver, try rebooting your computer and trying again.
    if you still have troubles after reboot, in Zadig try installing the libusbK driver rather than the WinUSB driver.

Installing CyanogenMod from recovery

  1. Make sure your computer has working adb.
  2. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  3. Boot to recovery mode, and connect the phone to your computer through USB.
    • Volume Up & Power
  4. In ClockworkMod Recovery, use the physical volume buttons to move up and down. On most devices, the power button is used to confirm a menu selection, but for some devices a physical home key acts as a selector. Some devices have touch enabled ClockworkMod Recovery, in which case you may be able to swipe to, or touch, menu selections.
  5. Optional (Recommended): Select backup and restore to create a backup.
  6. Select wipe data/factory reset.
  7. You have two options for transferring and installing the installation packages. The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 or /sdcard as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /sdcard or /data, then: adb push update.zip /sdcard/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  8. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Helpful Tip – SD card folders

CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:

  1. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10 or older: adb push update.zip /sdcard/
  2. If you’re coming from a ROM with Android 4.1 or older to CyanogenMod 10.1 or newer: adb shell "mkdir /sdcard/0/" followed by adb push update.zip /sdcard/0/
  3. If you’re coming from a ROM with Android 4.2 or newer to CyanogenMod 10.1 or newer: adb push update.zip /sdcard/0/

Helpful Tip

See something wrong on this page? Click here: Report a Site Problem.

How To Build CyanogenMod For Samsung Galaxy S II Epic 4G Touch (d710)

Introduction

These instructions will hopefully assist you to start with a stock Galaxy S II Epic 4G Touch, unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

What you’ll need

  • A Galaxy S II Epic 4G Touch
  • A relatively recent computer (Linux, OS X, or Windows) with a reasonable amount of RAM and about 100 GB of free storage (more if you enable ccache or build for multiple devices). The less RAM you have, the longer the build will take (aim for 8 GB or more). Using SSDs results in considerably faster build times than traditional hard drives.
  • A USB cable compatible with the Galaxy S II Epic 4G Touch (typically micro USB, but older devices may use mini USB or have a proprietary cable)
  • A decent internet connection & reliable electricity :)
  • Some familiarity with basic Android operation and terminology. It would help if you’ve installed custom roms on other devices and are familiar with recovery. It may also be useful to know some basic command line concepts such as cd for “change directory”, the concept of directory hierarchies, that in Linux they are separated by /, etc.

If you are not accustomed to using Linux– this is an excellent chance to learn. It’s free– just download and run a virtual machine (VM) such as Virtualbox, then install a Linux distribution such as Ubuntu (AOSP vets Ubuntu as well). Any recent 64-bit version should work great, but the latest is recommended.

Note:

You want to use a 64-bit version of Linux. A 32-bit Linux environment will only work if you are building CyanogenMod 6 and older. For CyanogenMod 10.1, if you encounter issues with 64bit host binaries, you can set BUILD_HOST_32bit=1 in your environment. This is generally not needed, though, especially with CyanogenMod 10.2 and newer.

Using a VM allows Linux to run as a guest inside your host computer– a computer in a computer, if you will. If you hate Linux for whatever reason, you can always just uninstall and delete the whole thing. (There are plenty of places to find instructions for setting up Virtualbox with Ubuntu, so I’ll leave it to you to do that.)

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

You only need to do these steps the first time you build. If you previously prepared your build environment and have downloaded the CyanogenMod source code for another device, skip to Prepare the device-specific code.

Install the SDK

If you have not previously installed adb and fastboot, install the Android SDK. “SDK” stands for Software Developer Kit, and it includes useful tools that you can use to flash software, look at the system logs in real time, grab screenshots, and more– all from your computer.

Helpful Tip

While the SDK contains lots of different things– the two tools you are most interested in for building Android are adb and fastboot, located in the /platform-tools directory.

Install the Build Packages

Several “build packages” are needed to build CyanogenMod. You can install these using the package manager of your choice.

Helpful Tip

A package manager in Linux is a system used to install or remove software (usually originating from the Internet) on your computer. With Ubuntu, you can use the Ubuntu Software Center. Even better, you may also use the apt-get install command directly in the Terminal. (Learn more about the apt packaging tool system from Wikipedia.)

For both 32-bit & 64-bit systems, you’ll need:

bc bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop maven openjdk-7-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

In addition to the above, for 64-bit systems, get these:

g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):

  • libwxgtk2.8-devlibwxgtk3.0-dev
  • openjdk-7-jdkopenjdk-8-jdk

Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):

  • CyanogenMod 7 – 9: Sun/Oracle Java SE 1.6
  • CyanogenMod 10.1: Sun/Oracle Java SE 1.6 or 1.7
  • CyanogenMod 10.2 – 11.0: Sun/Oracle Java SE 1.6 or 1.7 (OpenJDK 1.7 works fine, but the build system will display a warning)
  • CyanogenMod 12.0 – 13.0: OpenJDK 1.7 (see note about OpenJDK 1.8 below)
  • CyanogenMod 14.1: OpenJDK 1.8

Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:

  1. Obtain OpenJDK 1.7 from the openjdk-r PPA
  2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.

Also see http://source.android.com/source/initializing.html which lists needed packages.

Create the directories

You will need to set up some directories in your build environment.

To create them:

$ mkdir -p ~/bin
$ mkdir -p ~/android/system

Install the repo command

Enter the following to download the “repo” binary and make it executable (runnable):

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

Put the ~/bin directory in your path of execution

In recent versions of Ubuntu, ~/bin should already be in your PATH. You can check this by opening ~/.profile with a text editor and verifying the following code exists (add it if it is missing):

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

Note: Make sure the cm branch entered here is the one you wish to build and is supported on your device.
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0

Download the source code

To start the download of all the source code to your computer:

$ repo sync

The CM manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are -j 4 and -c. The -j 4 part means that there will be four simultaneous threads/connections. If you experience problems syncing, you can lower this to -j 3 or -j 2. -c will ask repo to pull in only the current branch, instead of the entire CM history.

Prepare to wait a long time while the source code downloads.

Helpful Tip

The repo sync command is used to update the latest source code from CyanogenMod and Google. Remember it, as you can do it every few days to keep your code base fresh and up-to-date.

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

You won’t see any confirmation- just another prompt. But this should cause some prebuilt apps to be loaded and installed into the source code. Once completed, this does not need to be done again.

Prepare the device-specific code

Helpful Tip – Errors during breakfast

Different maintainers setup their device inheritance rules differently. Some require a vendor directory to be populated before breakfast will even succeed. If you receive an error here about vendor makefiles, then jump down to the next section Extract proprietary blobs. The first portion of breakfast should have succeeded at pulling in the device tree and the extract blobs script should be available. After completing that section, you can rerun breakfast d710

After the source downloads, ensure you are in the root of the source code (cd ~/android/system), then type:

$ source build/envsetup.sh
$ breakfast d710

This will download the device specific configuration and kernel source for your device. An alternative to using the breakfast command is to build your own local manifest. To do this, you will need to locate your device on CyanogenMod’s GitHub and list all of the repositories defined in cm.dependencies in your local manifest.

Helpful Tip

If you want to know more about what source build/envsetup.sh does or simply want to know more about the breakfast, brunch and lunch commands, you can head over to the Envsetup help page.

Helpful Tip

Instead of typing cd ~/android/system every time you want to return back to the root of the source code, here’s a short command that will do it for you: croot. To use this command, you must first run source build/envsetup.sh from ~/android/system.

Extract proprietary blobs

Now ensure that your Galaxy S II Epic 4G Touch is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/d710 directory (you can cd ~/android/system/device/samsung/d710 if necessary). Then run the extract-files.sh script:

$ ./extract-files.sh

You should see the proprietary files (aka “blobs”) get pulled from the device and moved to the ~/android/system/vendor/samsung directory. If you see errors about adb being unable to pull the files, adb may not be in the path of execution. If this is the case, see the adb page for suggestions for dealing with “command not found” errors.

Note:

Your device should already be running a build of CyanogenMod for the branch you wish to build for the extract-files.sh script to function properly.

Note:

It’s important that these proprietary files are extracted to the ~/android/system/vendor/samsung directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

to your ~/.bashrc file (what’s a .bashrc file?). Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:

prebuilts/misc/linux-x86/ccache/ccache -M 50G

where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration. See more information about ccache on Google’s android build environment initialization page.

Helpful Tip

If you are a very active developer, working on many other projects than just Android, you might prefer to keep your Android ccache independent (because it’s huge and can slow down the efficiency of ccache in your other projects). Beginning with CyanogenMod 12.1, you can specify environment variables for the location and size of CyanogenMod’s ccache. Some syntax examples: export ANDROID_CCACHE_DIR="$HOME/android/.ccache" and export ANDROID_CCACHE_SIZE="50G".

Start the build

Time to start building! So now type:

$ croot
$ brunch d710

The build should begin.

Helpful Tip

If the build doesn’t start, try lunch and choose your device from the menu. If that doesn’t work, try breakfast and choose from the menu. The command make d710 should then work.

Helpful Tip

A second, bonus tip! If you get a command not found error for croot, brunch, or lunch, be sure you’ve done the source build/envsetup.sh command in this Terminal session from the ~/android/system directory.

Helpful Tip

A third tip! If the build to fails while downloading Gello, you’ll need to import a missing certificate into Maven’s truststore. Detailed instructions on how to do that can be found here

If the build breaks…

  • If you experience this not-enough-memory-related error…
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d710/cm_d710-ota-eng.root.zip] Error 1

…you may want to make the following change to ~/android/system/build/tools/releasetools/common.py:

Search for instances of -Xmx2048m (it should appear either under OPTIONS.java_args or near usage of signapk.jar), and replace it with -Xmx1024m or -Xmx512m.

Then start the build again (with brunch).

  • If you see a message about things suddenly being “killed” for no reason, your (virtual) machine may have run out of memory or storage space. Assign it more resources and try again.

Install the build

Assuming the build completed without error (it will be obvious when it finishes), type:

$ cd $OUT

in the same terminal window that you did the build. Here you’ll find all the files that were created. The stuff that will go in /system is in a folder called system. The stuff that will become your ramdisk is in a folder called root. And your kernel is called… kernel.

But that’s all just background info. The two files we are interested in are (1) recovery.img, which contains CyanogenMod Recovery, and (2) cm-13.0-20161224-UNOFFICIAL-d710.zip, which is the CyanogenMod installation package.

Install CyanogenMod

Back to the $OUT directory on your computer– you should see a file that looks something like:

cm-13.0-20161224-UNOFFICIAL-d710.zip

Note:

The above file name may vary depending on the version of CM you are building. Your build may not include a version number or may identify itself as a “KANG” rather than UNOFFICIAL version. Regardless, the file name will end in .zip and should be titled similarly to official builds.

Now you can flash the cm...zip file above as usual via recovery mode. Before doing so, now is a good time to make a backup of whatever installation is currently running on the device in case something goes wrong with the flash attempt. While CyanogenMod Recovery doesn’t have a backup feature, there are other custom recoveries available that do. You can also use something like Titanium Backup (root required) as an alternative.

Success! So….what’s next?

You’ve done it! Welcome to the elite club of self-builders. You’ve built your operating system from scratch, from the ground up. You are the master/mistress of your domain… and hopefully you’ve learned a bit on the way and had some fun too.

Now that you’ve succeeded in building CyanogenMod for your device, here are some suggestions on what to do next.

Also, be sure to take a glance at the Dev Center on this wiki for all kinds of more detailed information about developer topics ranging from collecting logs, understanding what’s in the source code directories, submitting your own contributions, porting CyanogenMod to new devices, and a lot more.

Congrats again!

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