Cyanogenmod ROM Motorola Moto X (T-Mobile) (xt1053)
ROM
|
Download
|
Stable
|
–
|
Nightly
|
|
ROM
|
Download
|
Stable
|
–
|
Nightly
|
|
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
WARNING:
DO NOT USE THIS GUIDE ON VERIZON OR ATT DEVICES! These carriers enforce boot image signing and attempting to use this guide will end in misery/tears.
Device | http://www.github.com/cyanogenmod/android_device_samsung_klte |
Kernel | http://www.github.com/cyanogenmod/android_kernel_samsung_klte |
Codename: | klte |
---|---|
Also known as: | SM-G900F, SM-G900M, SM-G900T, SM-G900W8 |
Vendor: | Samsung |
Release date: | 11 April 2014; |
Type: | phone |
LTE freq: | 800, 850, 900, 1,800, 2,100 and 2,600 MHz |
Platform: | Qualcomm Snapdragon 801 |
CPU: | 2.5 GHz quad-core Krait 400 |
GPU: | Adreno 330 |
RAM: | 2GB |
Weight: | 145 g (5.11 oz) |
Dimensions: | 142 mm (5.59 in) H 72.5 mm (2.85 in) W 8.1 mm (0.31 in) D |
Screen size: | 130 mm (5.1 in) |
Resolution: | 1920×1080 |
Screen density: | 432 ppi |
Screen type: | Full HD Super AMOLED |
Internal storage: | 16 GB, 32 GB |
SD Card: | up to 128 GB |
Bluetooth: | 4.0 BLE |
Wi-Fi: | 802.11 a/b/g/n/ac |
Main camera: | 16MP, flash: LED |
Secondary camera: | 2MP |
Power: | 2800 mAh Li-ion battery, removable |
Peripherals: | Fingerprint recognition, Heart rate sensor, Motion Coprocessor,Accelerometer, Gesture sensor, Gyroscope, Proximity sensor, Compass, Barometer, Hall effect sensor, Magnetic sensor, RGB ambient light, Infrared (IR) LED sensor |
CM supported: | 12, 12.1, 13, 14.1 |
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.
WARNING:
DO NOT USE THIS GUIDE ON VERIZON OR ATT DEVICES! These carriers enforce boot image signing and attempting to use this guide will end in misery/tears.
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.
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.-frontend
packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version
to verify installation succeeded.heimdall version
to verify installation succeeded.README
file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.0a1dcca46a9f084a29efe779e672a7ee
zadig.exe
from the Drivers folder of the Heimdall Suite. heimdall flash --RECOVERY recovery.img --no-reboot
Note: Flashing with heimdall
sudo heimdall flash [...]
. Typical symptoms of this are:
--KERNEL
instead of --kernel
and/or --recovery
instead of --RECOVERY
.sudo kextunload -b com.apple.driver.AppleUSBCDC;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
sudo kextunload -b com.devguru.driver.SamsungComposite;
sudo kextunload -b com.devguru.driver.SamsungACMData
sudo kextunload -b com.devguru.driver.SamsungACMControl
Error: Failed to confirm end of PIT file transfer!
Helpful Tip
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Galaxy S5, 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 klte
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast klte
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
.
Now ensure that your Galaxy S5 is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/klte
directory (you can cd ~/android/system/device/samsung/klte
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch klte
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 klte
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/klte/cm_klte-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).
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-klte.zip
, which is the CyanogenMod installation package.
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-klte.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.
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.
Download (nightly build)
CyanogenMod 13.0 (Android 6.0/6.0.1 (Marshmallow))
Device | http://www.github.com/cyanogenmod/android_device_htc_flounder |
Kernel | http://www.github.com/cyanogenmod/android_kernel_htc_flounder |
Codename: | flounder |
---|---|
Vendor: | |
Manufacturer: | HTC |
Release date: | 2014 November 3 |
Type: | tablet |
Platform: | NVIDIA Tegra K1 |
CPU: | 2.3 GHz dual-core Denver (ARMv8 64-bit) |
GPU: | 192-core Kepler DX1 |
RAM: | 2GB |
Weight: | 15.0 oz (425 g) |
Dimensions: | 228.25 mm (8.99 in) (h) 153.68 mm (6.05 in) (w) 7.95 mm (0.31 in) (d) |
Screen size: | 226 mm (8.9 in) |
Resolution: | 2048×1536 |
Screen density: | 281 ppi |
Screen type: | IPS LCD |
Internal storage: | 16/32 GB |
SD Card: | none |
Bluetooth: | 4.1 |
Wi-Fi: | 802.11a/b/g/n/ac 2×2 MIMO 2.4/5 GHz dual-band |
Main camera: | 8 MP, flash: LED |
Secondary camera: | 1.6 MP |
Power: | Non-removable lithium-ion polymer 6700 mAh |
Peripherals: | Accelerometer, ambient light sensor, gyroscopic sensor, magnetometer |
CM supported: | 12, 12.1, 13 |
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.
WARNING:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem unlock
See All About Recovery Images for more information about custom recoveries and their capabilities.
acce30d4969297bb10dc80a1368cc7e8
adb reboot bootloader
fastboot devices
fastboot flash recovery your_recovery_image.img
The /vendor partition on the Nexus 9 (Wi-Fi) contains important proprietary binaries. CyanogenMod installation does not touch that partition, therefore it is the user’s responsibility to keep the proprietary binaries up to date. To do that, you can extract the vendor.img from the newest factory image for the Nexus 9 (Wi-Fi), located here. See note below about matching build id to ensure you download and flash the correct one. Then flash the vendor.img using one of these two methods:
fastboot flash vendor vendor.img
Note: The vendor.img build id (e.g. MTC19V) must match the device specific build id of your rom. If they do not match you may experience bugs/issues, and you will see this message when your device boots up into android, “There’s an internal problem with your device. Contact your manufacturer for details”
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Nexus 9 (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.
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!
Note:
If you’ve already installed CyanogenMod or another ROM on your Nexus 9 (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 Nexus 9 (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 htc make it easy.
Note: A Warning About Unlocking
THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.
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:
So this should be a one time thing…
To unlock your Nexus 9 (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).
WARNING:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem unlock
{{{device_oem_unlock_command}}}
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.
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 flounder
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast flounder
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
.
Now ensure that your Nexus 9 (Wi-Fi) is connected to your computer via the USB cable and that you are in the ~/android/system/device/htc/flounder
directory (you can cd ~/android/system/device/htc/flounder
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/htc
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/htc
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch flounder
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 flounder
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/flounder/cm_flounder-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).
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-flounder.zip
, which is the CyanogenMod installation package.
See All About Recovery Images for more information about custom recoveries and their capabilities.
adb reboot bootloader
fastboot devices
fastboot flash recovery your_recovery_image.img
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-flounder.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.
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.
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device was deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
Device | http://www.github.com/cyanogenmod/android_device_samsung_d2vzw |
Kernel | http://www.github.com/cyanogenmod/android_kernel_samsung_d2 |
Codename: | d2vzw |
---|---|
Vendor: | Samsung |
Release date: | 2012 June 28 (USA) |
Carrier: | Verizon |
Type: | phone |
CDMA freq: | Dual-band CDMA 800 1900 MHz 1xEV-DO 2000 MHz |
LTE freq: | 700MHz |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Qualcomm Snapdragon S4 |
GPU: | Adreno 225 |
RAM: | 2GB |
Weight: | 134 g (4.7 oz) |
Dimensions: | 137 mm (5.4 in) (h) 71 mm (2.8 in) (w) 7.6 mm (0.299 in) (d) |
Screen size: | 122 mm (4.8 in) |
Resolution: | 1280×720 |
Internal storage: | 16GB |
SD Card: | up to 64GB |
Bluetooth: | 4.0 |
Wi-Fi: | 802.11 b/g/n |
Main camera: | 8MP w/ LED flash |
Secondary camera: | 1.9MP |
Power: | 2100 mAh |
Peripherals: | capacitive touchscreen, proximity & light sensors, 3-axis accelerometer, 3-axis gyroscope, digital compass, A-GPS, NFC |
CM supported: | 10, 10.1, 10.2, 11, 12.1, 13, 14.1 |
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.
WARNING:
This guide is for advanced users and does not come with support. It is provided as a means to install CyanogenMod. A working adb connection as well as adb being in your PATH is required for this guide and users should not proceed without this. Additionally, you must be a 4.2.2 or older build or this will not work. In fact, if you try to use this method on a newer revision, you will almost certainly brick your device. Seriously don’t try it. Downgrading won’t work either. If you’ve updated, a qfuse is already tripped and any attempt to downgrade will also result in a brick.
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.
In order to use CyanogenMod on the Verizon variant of the Galaxy S3 you need to load an older bootloader.
08595feafb6fb03ec1b15d96bb3a8f30
b777e6b2739c55f489a6557d13c8e3a1
dac38a8387743c9d00b08a814028ae91
heimdall detect --no-reboot
heimdall print-pit --no-reboot
heimdall flash --ABOOT aboot.mbn --no-reboot
heimdall flash --BOOT boot.img --no-reboot
b4e99684f7e4b71af5972892601d7e9e
heimdall flash --RECOVERY your_recovery_image.img --no-reboot
The device is now ready to flash CyanogenMod.
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.
These instructions will hopefully assist you to start with a stock Galaxy S III (Verizon), 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 d2vzw
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast d2vzw
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
.
Now ensure that your Galaxy S III (Verizon) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/d2vzw
directory (you can cd ~/android/system/device/samsung/d2vzw
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch d2vzw
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 d2vzw
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d2vzw/cm_d2vzw-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).
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-d2vzw.zip
, which is the CyanogenMod installation package.
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-d2vzw.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.
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.
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in recovery.
Device | http://www.github.com/cyanogenmod/android_device_samsung_d2tmo |
Kernel | http://www.github.com/cyanogenmod/android_kernel_samsung_d2 |
Codename: | d2tmo |
---|---|
Vendor: | Samsung |
Release date: | 2012 June 21 (USA) |
Carrier: | T-Mobile, Mobilcity, Wind, Videotron |
Type: | phone |
GSM freq: | Quad-band GSM 850 900 1800 1900 MHz GPRS/EDGE Quad-band UMTS 850 1700 1900 2100, and HSPA+ |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Qualcomm Snapdragon S4 |
GPU: | Adreno 225 |
RAM: | 2GB |
Weight: | 134 g (4.7 oz) |
Dimensions: | 137 mm (5.4 in) (h) 71 mm (2.8 in) (w) 8.6 mm (0.339 in) (d) |
Screen size: | 122 mm (4.8 in) |
Resolution: | 1280×720 |
Internal storage: | 16GB |
SD Card: | up to 64GB |
Bluetooth: | 3.0 |
Wi-Fi: | 802.11 b/g/n |
Main camera: | 8MP w/ LED flash |
Secondary camera: | 1.9MP |
Power: | 2100 mAh |
Peripherals: | capacitive touchscreen, proximity & light sensors, 3-axis accelerometer, 3-axis gyroscope, digital compass, A-GPS, NFC |
CM supported: | 10, 10.1, 10.2, 11, 12.1, 13, 14.1 |
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.
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in 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.
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.-frontend
packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version
to verify installation succeeded.heimdall version
to verify installation succeeded.README
file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.429e64529a616249c5a1573edaaaca27
zadig.exe
from the Drivers folder of the Heimdall Suite. heimdall flash --RECOVERY recovery.img --no-reboot
Note: Flashing with heimdall
sudo heimdall flash [...]
. Typical symptoms of this are:
--KERNEL
instead of --kernel
and/or --recovery
instead of --RECOVERY
.sudo kextunload -b com.apple.driver.AppleUSBCDC;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
sudo kextunload -b com.devguru.driver.SamsungComposite;
sudo kextunload -b com.devguru.driver.SamsungACMData
sudo kextunload -b com.devguru.driver.SamsungACMControl
Error: Failed to confirm end of PIT file transfer!
Helpful Tip
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Galaxy S III (T-Mobile), 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 d2tmo
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast d2tmo
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
.
Now ensure that your Galaxy S III (T-Mobile) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/d2tmo
directory (you can cd ~/android/system/device/samsung/d2tmo
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch d2tmo
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 d2tmo
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d2tmo/cm_d2tmo-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).
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-d2tmo.zip
, which is the CyanogenMod installation package.
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-d2tmo.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.
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.
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in recovery.
Device | http://www.github.com/cyanogenmod/android_device_samsung_d2spr |
Kernel | http://www.github.com/cyanogenmod/android_kernel_samsung_d2 |
Codename: | d2spr |
---|---|
Vendor: | Samsung |
Release date: | 2012 June 28 (USA) |
Carrier: | Sprint |
Type: | phone |
GSM freq: | Quad-band GSM 850 900 1800 1900 MHz GPRS/EDGE Tri-band UMTS 850 1900 2100 MHz, and HSPA+ |
LTE freq: | 1900MHz |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Qualcomm Snapdragon S4 |
GPU: | Adreno 225 |
RAM: | 2GB |
Weight: | 134 g (4.7 oz) |
Dimensions: | 137 mm (5.4 in) (h) 71 mm (2.8 in) (w) 7.6 mm (0.299 in) (d) |
Screen size: | 122 mm (4.8 in) |
Resolution: | 1280×720 |
Internal storage: | 16GB |
SD Card: | up to 64GB |
Bluetooth: | 3.0 |
Wi-Fi: | 802.11 b/g/n |
Main camera: | 8MP w/ LED flash |
Secondary camera: | 1.9MP |
Power: | 2100 mAh |
Peripherals: | capacitive touchscreen, proximity & light sensors, 3-axis accelerometer, 3-axis gyroscope, digital compass, A-GPS, NFC, Barometer |
CM supported: | 10, 10.1, 10.2, 11, 12.1, 13, 14.1 |
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.
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in 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.
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.-frontend
packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version
to verify installation succeeded.heimdall version
to verify installation succeeded.README
file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.d1df4320321e4b21495a0d0c9ad38e42
zadig.exe
from the Drivers folder of the Heimdall Suite. heimdall flash --RECOVERY recovery.img --no-reboot
Note: Flashing with heimdall
sudo heimdall flash [...]
. Typical symptoms of this are:
--KERNEL
instead of --kernel
and/or --recovery
instead of --RECOVERY
.sudo kextunload -b com.apple.driver.AppleUSBCDC;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
sudo kextunload -b com.devguru.driver.SamsungComposite;
sudo kextunload -b com.devguru.driver.SamsungACMData
sudo kextunload -b com.devguru.driver.SamsungACMControl
Error: Failed to confirm end of PIT file transfer!
Helpful Tip
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Galaxy S III (Sprint), 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 d2spr
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast d2spr
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
.
Now ensure that your Galaxy S III (Sprint) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/d2spr
directory (you can cd ~/android/system/device/samsung/d2spr
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch d2spr
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 d2spr
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d2spr/cm_d2spr-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).
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-d2spr.zip
, which is the CyanogenMod installation package.
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-d2spr.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.
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.
Download (nightly build)
CyanogenMod 14.1 (Android 7.1 (Nougat))
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in recovery.
Device | http://www.github.com/cyanogenmod/android_device_samsung_d2att |
Kernel | http://www.github.com/cyanogenmod/android_kernel_samsung_d2 |
Codename: | d2att |
---|---|
Vendor: | Samsung |
Release date: | 2012 June 28 (USA) |
Carrier: | AT&T, Bell, Rogers, Telus |
Type: | phone |
GSM freq: | Quad-band GSM 850 900 1800 1900 MHz GPRS/EDGE Tri-band UMTS 850 1900 2100 MHz, and HSPA+ |
LTE freq: | 700MHz |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Qualcomm Snapdragon S4 |
GPU: | Adreno 225 |
RAM: | 2GB |
Weight: | 134 g (4.7 oz) |
Dimensions: | 137 mm (5.4 in) (h) 71 mm (2.8 in) (w) 8.6 mm (0.339 in) (d) |
Screen size: | 122 mm (4.8 in) |
Resolution: | 1280×720 |
Internal storage: | 16GB |
SD Card: | up to 64GB |
Bluetooth: | 3.0 |
Wi-Fi: | 802.11 b/g/n |
Main camera: | 8MP w/ LED flash |
Secondary camera: | 1.9MP |
Power: | 2100 mAh |
Peripherals: | capacitive touchscreen, proximity & light sensors, 3-axis accelerometer, 3-axis gyroscope, digital compass, A-GPS, NFC |
CM supported: | 10, 10.1, 10.2, 11, 12.1, 13, 14.1 |
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.
Note: Deprecated in favor of unified build on CM 11
For CM 11, this carrier specific device has been deprecated in favor of a new unified device: d2lte. Please visit the d2lte page for information on building and installing CyanogenMod 11. This page is for < CM 10.1 or >= CM 12.1
WARNING: Firmware update notice
CM10.1 and newer are not compatible with ICS bootloaders on this device. Update your device’s firmware or you will get assert failures in 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.
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.-frontend
packages are not required for this guide. After installation, heimdall should be available from the terminal; type heimdall version
to verify installation succeeded.heimdall version
to verify installation succeeded.README
file on Github under the relevant operating system directory. You can also refer to the Install and compile Heimdall instructions on this wiki.c2d2d787e3f914d651695a5fb6af1539
zadig.exe
from the Drivers folder of the Heimdall Suite. heimdall flash --RECOVERY recovery.img --no-reboot
Note: Flashing with heimdall
sudo heimdall flash [...]
. Typical symptoms of this are:
--KERNEL
instead of --kernel
and/or --recovery
instead of --RECOVERY
.sudo kextunload -b com.apple.driver.AppleUSBCDC;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl;
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData;
sudo kextunload -b com.devguru.driver.SamsungComposite;
sudo kextunload -b com.devguru.driver.SamsungACMData
sudo kextunload -b com.devguru.driver.SamsungACMControl
Error: Failed to confirm end of PIT file transfer!
Helpful Tip
On this device, Samsung left the backup partitions blank for nvdata and a bug can occur where the device will restore these blank partitions over your working ones. For this reason it is recommended you run the following command:
adb reboot nvbackup
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Galaxy S III (AT&T), 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 d2att
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast d2att
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
.
Now ensure that your Galaxy S III (AT&T) is connected to your computer via the USB cable and that you are in the ~/android/system/device/samsung/d2att
directory (you can cd ~/android/system/device/samsung/d2att
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch d2att
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 d2att
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/d2att/cm_d2att-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).
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-d2att.zip
, which is the CyanogenMod installation package.
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-d2att.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.
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.
ROM
|
Download
|
Stable
|
—
|
Nightly
|
|
Codename: | m7 |
---|---|
Also known as: | m7att m7lte m7tmo m7ul |
Vendor: | HTC |
Release Date: | 2013 March |
Type: | phone |
GSM freq: | 850 900 1800 1900 2100 MHz UMTS/HSPA+ |
LTE freq: | 800 1800 2600 MHz |
Platform: | Qualcomm Snapdragon 600 |
CPU: | 1.7 GHz quad-core Krait 300 |
GPU: | Adreno 320 |
RAM: | 2GB |
Weight: | 143 g (5 oz) |
Dimensions: | 137.4 mm (h) 68.2 mm (w) 9.3 mm (d) |
Screen dimension: | 119 mm (4.7 in) |
Resolution: | 1080×1920 |
Screen Density: | 469 ppi |
Screen Technology: | Super-LCD 3 |
Internal Storage: | 32GB or 64GB |
SD Card: | none |
Bluetooth: | 4.0 |
Wi-Fi: | 802.11 b/g/n/ac 2.4/5GHz |
Main camera: | 4UP, flash: LED |
Secondary camera: | 2.1MP |
Power: | 2300 mAh |
Sound: | Boomsound, Beats Audio |
Peripherals: | dual front speakers, accelerometer, gyroscope, proximity sensor, digital compass, GPS, magnometer, microphone, NFC, IR |
CM Support: | 11, 12, 12.1, 13 |
Download (nightly build)
CyanogenMod 12.1 (Android 5.1 (Lollipop))
Note: Minimum supported recovery
The minimum version of recovery that can be used to install CyanogenMod on this device is: ClockworkMod 6.0.4.8 or TWRP 2.7.0.8. See this page for more information.
Device | http://www.github.com/cyanogenmod/android_device_htc_m7vzw |
Kernel | http://www.github.com/cyanogenmod/android_kernel_htc_msm8960 |
Codename: | m7vzw |
---|---|
Also known as: | m7wlv |
Vendor: | HTC |
Release date: | 2013 March |
Carrier: | Verizon |
Type: | phone |
GSM freq: | UMTS/HSPA: 1900 2100MHz; GSM/GPRS/EDGE: 850 900 1800 1900MHz |
CDMA freq: | 800 1900 MHz |
LTE freq: | 700 MHz (Band 13) |
Platform: | Qualcomm Snapdragon 600 |
CPU: | 1.7 GHz quad-core Cortex A9 |
GPU: | Adreno 320 |
RAM: | 2GB |
Weight: | 143 g (5 oz) |
Dimensions: | 137.4 mm (h) 68.2 mm (w) 9.3 mm (d) |
Screen size: | 119 mm (4.7 in) |
Resolution: | 1080×1920 |
Screen density: | 468 ppi |
Screen type: | Super-LCD 2 |
Internal storage: | 32GB or 64GB |
SD Card: | none |
Bluetooth: | 4.0 |
Wi-Fi: | 802.11 a/b/g/n 2.4GHz |
Main camera: | 4UP, flash: LED |
Secondary camera: | 2.1MP |
Power: | 2300 mAh |
Sound: | Boomsound, Beats Audio |
Peripherals: | dual front speakers, accelerometer, gyroscope, proximity sensor, digital compass, GPS, magnometer, microphone, NFC, IR |
CM supported: | 10.2, 11, 12, 12.1 |
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.
Note: Minimum supported recovery
The minimum version of recovery that can be used to install CyanogenMod on this device is: ClockworkMod 6.0.4.8 or TWRP 2.7.0.8. See this page for more information.
Preparing your One (Verizon) for CyanogenMod
To mitigate any problems with GPS, it is strongly recommended to change the following Settings in your stock ROM before installing CyanogenMod:
S-OFF vs. Unlocked Bootloader
You must have an unlocked bootloader or be S-OFF. S-OFF is recommended so that you can easily update the firmware on your device. Unfortunately, Verizon Wireless does not allow HTC to include the One (Verizon) in its unlocked bootloader program.
This device is supported by SunShine.
Updating to firmware v6.22.605.6
You must be S-OFF to follow these instructions!
These instructions are only for users that are already running CyanogenMod and would like to update their device’s firmware without reinstalling the stock manufacturer ROM. You can check to see whether you are already on the latest firmware by cross-referencing the Baseband version (Settings > About phone > Baseband version) and HBOOT version with the following:
If one or both of the HBOOT and/or Baseband version is out of date on your device, then you can follow the instructions below to update your firmware.
Before you begin, be sure that both ADB and fastboot are installed and working on your computer. With your phone booted and connected to your computer, you should be able to type adb devices
to see your device’s serial number. Similarly, test fastboot by first rebooting your phone to the bootloader (adb reboot-bootloader
) and then typing fastboot devices
to see your serial number again. Only continue if you have working adb and fastboot!
adb reboot-bootloader
fastboot oem rebootRUU
cd
to the directory containing m7wlv-firmware-6.22.605.6.zip
and run:fastboot flash zip m7wlv-firmware-6.22.605.6.zip
fastboot flash zip m7wlv-firmware-6.22.605.6.zip
fastboot reboot
See All About Recovery Images for more information about custom recoveries and their capabilities.
97f191b24d70da1d22ea6cd15c42b501
adb reboot bootloader
fastboot devices
fastboot flash recovery your_recovery_image.img
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock One (Verizon), 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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 m7vzw
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast m7vzw
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
.
Now ensure that your One (Verizon) is connected to your computer via the USB cable and that you are in the ~/android/system/device/htc/m7vzw
directory (you can cd ~/android/system/device/htc/m7vzw
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/htc
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/htc
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch m7vzw
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 m7vzw
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/m7vzw/cm_m7vzw-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).
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-m7vzw.zip
, which is the CyanogenMod installation package.
See All About Recovery Images for more information about custom recoveries and their capabilities.
adb reboot bootloader
fastboot devices
fastboot flash recovery your_recovery_image.img
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-m7vzw.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.
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.
Download (nightly build)
CyanogenMod 13.0 (Android 6.0/6.0.1 (Marshmallow))
This is a KEXEC build and must be installed in SafeStrap (builds older than 9/1/2013 must be installed on rom-slot1). CM-12.0 requires at least Safestrap v3.75.
Device | http://www.github.com/cyanogenmod/android_device_motorola_spyder |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_omap4-common |
Codename: | spyder |
---|---|
Vendor: | Motorola |
Release date: | 2011 November 11 |
Carrier: | Verizon |
Type: | phone |
GSM freq: | 850/900/1800/1900 HSDPA 850/900/1900/2100 |
CDMA freq: | 800/1900 CDMA2000 1xEV-DO |
LTE freq: | 700 MHz Class 13 |
Platform: | TI OMAP4430 |
CPU: | 1.2 GHz dual-core Cortex-A9 |
GPU: | PowerVR SGX540 |
RAM: | 1GB |
Weight: | 127 g (4.48 oz) |
Dimensions: | 130.7 x 68.9 x 7.1 mm (5.15 x 2.71 x 0.28 in) |
Screen size: | 109 mm (4.3 in) |
Resolution: | 540 x 960 |
Screen density: | 256 ppi |
Screen type: | Super AMOLED capacitive touchscreen |
Internal storage: | 16GB |
SD Card: | microSD, up to 32 GB, 16 GB included |
Bluetooth: | v4.0 with LE+EDR |
Wi-Fi: | Wi-Fi 802.11 b/g/n |
Main camera: | 8MP, flash: LED |
Secondary camera: | 2MP |
Power: | 1780 mAh |
Peripherals: | Accelerometer, proximity, compass, GPS |
CM supported: | 10.1, 10.2, 11, 12, 12.1, 13 |
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.
This is a KEXEC build and must be installed in SafeStrap (builds older than 9/1/2013 must be installed on rom-slot1). CM-12.0 requires at least Safestrap v3.75.
896edcc80bc1b670c461508cc7d7af1e
adb install YOURAPK.apk
.zip
package, as well as any optional .zip
packages, on the root of /sdcard
:
adb push filename.zip /sdcard/
.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./sdcard
and select the CyanogenMod .zip
package.Helpful Tip
These instructions will hopefully assist you to start with a stock Droid RAZR/RAZR MAXX (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.
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!
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.
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.
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-dev
→ lib32readline6-dev
For Ubuntu 16.04 (xenial) and newer, substitute (additionally see java notes below):
libwxgtk2.8-dev
→ libwxgtk3.0-dev
openjdk-7-jdk
→ openjdk-8-jdk
Java versions: Different versions of CyanogenMod require different versions of the JDK (Java Development Kit):
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:
$HOME/.bashrc
file: export EXPERIMENTAL_USE_JAVA8=true
.Also see http://source.android.com/source/initializing.html which lists needed packages.
You will need to set up some directories in your build environment.
To create them:
$ mkdir -p ~/bin
$ mkdir -p ~/android/system
repo
commandEnter 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
~/bin
directory in your path of executionIn 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
Enter the following to initialize the repository:
$ cd ~/android/system/
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0
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.
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.
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 spyder
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast spyder
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
.
Now ensure that your Droid RAZR/RAZR MAXX (CDMA) is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/spyder
directory (you can cd ~/android/system/device/motorola/spyder
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!
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"
.
Time to start building! So now type:
$ croot
$ brunch spyder
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 spyder
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
ERROR: signapk.jar failed: return code 1make: *** [out/target/product/spyder/cm_spyder-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).
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-spyder.zip
, which is the CyanogenMod installation package.
{{{install_md5sum}}}
adb install YOURAPK.apk
Back to the $OUT
directory on your computer– you should see a file that looks something like:
cm-13.0-20161224-UNOFFICIAL-spyder.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.
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.