Cyanogenmod ROM Motorola Moto X (T-Mobile) (xt1053)
ROM
|
Download
|
Stable
|
–
|
Nightly
|
|
ROM
|
Download
|
Stable
|
–
|
Nightly
|
|
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.
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_targa |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_omap4-common |
Codename: | targa |
---|---|
Vendor: | Motorola |
Release date: | 2011 September 8 |
Carrier: | Verizon |
Type: | phone |
CDMA freq: | 800/1900 CDMA2000 1xEV-DO |
LTE freq: | 700 MHz Class 13 |
Platform: | TI OMAP4430 |
CPU: | 1 GHz dual-core Cortex-A9 |
GPU: | PowerVR SGX540 |
RAM: | 1GB |
Weight: | 158.8 g (5.57 oz) |
Dimensions: | 127.5 x 66.9 x 11 mm (5.02 x 2.63 x 0.43 in) |
Screen size: | 109 mm (4.3 in) |
Resolution: | 540 x 960 |
Screen density: | 256 ppi |
Screen type: | TFT capacitive touchscreen |
Internal storage: | 16GB |
SD Card: | microSD, up to 32 GB, 16 GB included |
Bluetooth: | v2.1 with A2DP, EDR |
Wi-Fi: | Wi-Fi 802.11 b/g/n |
Main camera: | 8MP, flash: LED |
Secondary camera: | VGA |
Power: | 1735 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.
a764315b5ffc83847cc1ca282b36f56b
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 Bionic, 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 targa
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast targa
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 Bionic is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/targa
directory (you can cd ~/android/system/device/motorola/targa
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 targa
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 targa
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/targa/cm_targa-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-targa.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-targa.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 12.1 (Android 5.1 (Lollipop))
This is a unified build for Motorola Droid Mini / Ultra / MAXX
Device | http://www.github.com/cyanogenmod/android_device_motorola_obake |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_ghost |
Codename: | obake |
---|---|
Also known as: | XT1030, XT1080, XT1080m |
Vendor: | Motorola |
Release date: | 2013 Aug 23 |
Carrier: | Verizon |
Type: | phone |
GSM freq: | 850, 900, 1800, 1900 MHz GSM, 850, 900, 1700/2100, 1900, 2100 MHz UMTS |
LTE freq: | 700 (band 13), 850 (band 5), 1700/2100 (band 4), 1900 (band 2) MHz, LTE, HSDPA+ (4G) 42.2 Mbit/s, HSUPA 5.76 Mbit/s, UMTS, EDGE, GPRS |
Platform: | Motorola X8 (Qualcomm Snapdragon S4 Pro MSM8960AB) |
CPU: | 1.7 GHz dual-core Krait |
GPU: | Adreno 320 |
RAM: | 2GB |
Weight: | Droid Mini: 130 g (4.59 oz) Droid Ultra: 137 g (4.83 oz) Droid MAXX: 167 g (5.89 oz) |
Dimensions: | Droid Mini: 121.3 x 61.3 x 8.9 mm (4.78 x 2.41 x 0.35 in) Droid Ultra: 137.5 x 71.2 x 7.2 mm (5.41 x 2.80 x 0.28 in) Droid MAXX: 137.5 mm (5.41 in) x 71.2 mm (2.80 in) x 8.5 mm (0.33 in) |
Screen size: | Droid Mini: 109 mm (4.3 in), Droid Ultra: 127 mm (5.0 in), Droid MAXX: 127 mm (5.0 in) |
Resolution: | 720 x 1280 pixels |
Screen density: | Droid Mini: 342 ppi Droid Ultra: 294 ppi Droid MAXX: 294 ppi |
Screen type: | AMOLED |
Internal storage: | 16 / 32 GB |
SD Card: | none |
Bluetooth: | 4.0, EDR |
Wi-Fi: | 802.11 a, b, g, n, n 5GHz, ac |
Main camera: | 10MP, flash: LED |
Secondary camera: | 2MP |
Power: | Droid Mini: 2000 mAh Droid Ultra: 2130 mAh Droid MAXX: 3500 mAh |
Peripherals: | Accelerometer, Compass |
CM supported: | 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.
This is a unified build for Motorola Droid Mini / Ultra / MAXX
WARNING:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem get_unlock_data
See All About Recovery Images for more information about custom recoveries and their capabilities.
aadfe53423e4301364a03a2458b2536d
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 Droid Mini / Ultra / MAXX, 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 Droid Mini / Ultra / MAXX, 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 Droid Mini / Ultra / MAXX is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and motorola make it easy.
Note: A Warning About Unlocking
THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.
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 Droid Mini / Ultra / MAXX, 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 get_unlock_data
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 obake
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast obake
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 Mini / Ultra / MAXX is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/obake
directory (you can cd ~/android/system/device/motorola/obake
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 obake
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 obake
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/obake/cm_obake-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-obake.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-obake.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))
Device | http://www.github.com/cyanogenmod/android_device_motorola_condor |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_msm8610 |
Codename: | condor |
---|---|
Also known as: | XT1021, XT1022, XT1023 |
Vendor: | Motorola |
Release date: | 2014 May 13 |
Type: | phone |
GSM freq: | GSM 850/900/1800/1900 MHz, HSDPA 850/900/1900/2100 MHz |
Platform: | Qualcomm Snapdragon 200 |
CPU: | 1.2 GHz dual-core Cortex A7 |
GPU: | Adreno 302 |
RAM: | 1GB |
Weight: | 142 g (5.04 oz) |
Dimensions: | 124.8 mm (4.91 in) x 64.8 mm (2.55 in) x 12.3 mm (0.48 in) |
Screen size: | 109 mm (4.3 in) |
Resolution: | 540 x 960 pixels |
Screen density: | ~256 ppi |
Screen type: | IPS LCD |
Internal storage: | 4GB |
SD Card: | up to 32GB |
Bluetooth: | v4.0 |
Wi-Fi: | Wi-Fi 802.11 b/g/n |
Main camera: | 5MP, flash: none |
Secondary camera: | none |
Power: | 1980 mAh |
Peripherals: | Accelerometer, proximity, compass |
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:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem get_unlock_data
See All About Recovery Images for more information about custom recoveries and their capabilities.
11084b7b3d3db34d1e44c9e95db04705
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 Moto E, 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 Moto E, your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.
The first step in putting any custom operating system on your Moto E is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and motorola make it easy.
Note: A Warning About Unlocking
THE PROCESS OF UNLOCKING THE BOOTLOADER WILL ERASE ALL YOUR PERSONAL DATA FROM THE DEVICE.
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 Moto E, 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 get_unlock_data
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 condor
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast condor
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 Moto E is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/condor
directory (you can cd ~/android/system/device/motorola/condor
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 condor
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 condor
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/condor/cm_condor-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-condor.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-condor.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_maserati |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_omap4-common |
Codename: | maserati |
---|---|
Vendor: | Motorola |
Release date: | 2012 February 10 |
Carrier: | Verizon |
Type: | phone (slider) |
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: | 178.9 g (6.28 oz) |
Dimensions: | 127 x 67.3 x 12.7 mm (5.0 x 2.65 x 0.5 in) |
Screen size: | 102 mm (4.0 in) |
Resolution: | 540 x 960 |
Screen density: | 275 ppi |
Screen type: | TFT capacitive touchscreen |
Internal storage: | 16GB |
SD Card: | microSD, up to 32 GB |
Bluetooth: | v4.0 with LE+EDR |
Wi-Fi: | Wi-Fi 802.11 b/g/n |
Main camera: | 8MP, flash: LED |
Secondary camera: | 1.3MP |
Power: | 1785 mAh |
Peripherals: | Accelerometer, proximity, compass, GPS, HDMI, FM Radio (Not officialy supported) |
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.
af6112a1d1a42ddc79dbad3624fe11c3
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 4, 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 maserati
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast maserati
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 4 is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/maserati
directory (you can cd ~/android/system/device/motorola/maserati
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 maserati
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 maserati
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/maserati/cm_maserati-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-maserati.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-maserati.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 12.1 (Android 5.1 (Lollipop))
Note:
Your device must be bootloader unlocked.
For CM 11.0, the device builds have been unified. Get the latest CM 11.0 build for KitKat bootloader updated devices here and for devices still on JellyBean bootloader here.
For CM 12.0 and newer, KitKat bootloader is required and builds were de-unified again. Get them under the usual xt907 builds.
Device | http://www.github.com/cyanogenmod/android_device_motorola_xt907 |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_msm8960-common |
Codename: | xt907 |
---|---|
Also known as: | scorpion_mini |
Vendor: | Motorola |
Release date: | 2012 September |
Carrier: | Verizon |
Type: | phone |
GSM freq: | GSM 850/900/1800/1900 HSDPA 850/900/1900/2100 |
CDMA freq: | CDMA 800/1900 CDMA2000 1xEV-DO |
LTE freq: | LTE 700 MHz Class 13 |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Krait |
GPU: | Adreno 225 |
RAM: | 1GB |
Weight: | 126 g (4.44 oz) |
Dimensions: | 122.5 mm (4.82 in) (h) 60.9 mm (2.40 in) (w) 8.3 mm (0.33 in) (d) |
Screen size: | 109 mm (4.3 in) |
Resolution: | 540 x 960 |
Screen density: | ~256 ppi |
Screen type: | Super AMOLED |
Internal storage: | 8 GB (4 GB user available) |
SD Card: | microSD, up to 32 GB |
Bluetooth: | v4.0 with LE+EDR |
Wi-Fi: | 802.11 a/b/g/n, dual-band, Wi-Fi hotspot, DLNA |
Main camera: | 8MP, flash: LED |
Secondary camera: | VGA |
Power: | Non-removable Li-Ion 2000 mAh battery |
Peripherals: | Accelerometer, proximity, compass |
CM supported: | 10.1, 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:
Your device must be bootloader unlocked.
For CM 11.0, the device builds have been unified. Get the latest CM 11.0 build for KitKat bootloader updated devices here and for devices still on JellyBean bootloader here.
For CM 12.0 and newer, KitKat bootloader is required and builds were de-unified again. Get them under the usual xt907 builds.
./run.sh
See All About Recovery Images for more information about custom recoveries and their capabilities.
ec2177f9d1c3a3d4671e99522d9b6315
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
Devices with System Version “182.46.15.XT907.Verizon.en.US” or “183.46.15.XT907.Verizon.en.US” (Check under Settings -> About Phone) as installed by an Over-The-Air update can not have their boot loader unlocked unless it was unlocked prior to the update. As of mid 2015, there are no known ways of unlocking the boot loader with those system versions, regardless of if you have root access or not.
These instructions will hopefully assist you to start with a stock Droid RAZR M, 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 xt907
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast xt907
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 M is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/xt907
directory (you can cd ~/android/system/device/motorola/xt907
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 xt907
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 xt907
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/xt907/cm_xt907-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-xt907.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-xt907.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 12.1 (Android 5.1 (Lollipop))
Note:
For CM 11.0, the builds have been unified. Get the latest CM 11.0 builds for mb886 here.
For CM 12.0 and newer, builds were de-unified again and can be found under the usual mb886 device builds.
Note:
Your device must be bootloader unlocked to run CyanogenMod. This can only be accomplished on stock firmware versions prior to 9.20.1
Device | http://www.github.com/cyanogenmod/android_device_motorola_mb886 |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_msm8960-common |
Codename: | mb886 |
---|---|
Also known as: | qinara |
Vendor: | Motorola |
Release date: | 2012 July |
Carrier: | AT&T |
Type: | phone |
GSM freq: | GSM 850/900/1800/1900 HSDPA 850/1700/1900/2100 |
LTE freq: | LTE 700 MHz Class 17/2100 |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Krait |
GPU: | Adreno 225 |
RAM: | 1GB |
Weight: | 140 g (4.94 oz) |
Dimensions: | 133.5 mm (5.26 in) (h) 69.9 mm (2.75in) (w) 8.4 mm (0.33 in) (d) |
Screen size: | 114 mm (4.5 in) |
Resolution: | 720 x 1280 |
Screen density: | ~326 ppi |
Screen type: | TFT |
Internal storage: | 8 GB (4 GB user available) |
SD Card: | microSD, up to 32 GB |
Bluetooth: | v4.0 with A2DP, LE, EDR |
Wi-Fi: | 802.11 a/b/g/n, dual-band, Wi-Fi Direct |
Main camera: | 8MP, flash: LED |
Secondary camera: | 1.3MP |
Power: | Non-removable Li-Ion 1780 mAh battery |
Peripherals: | Accelerometer, proximity, compass |
CM supported: | 10.1, 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:
For CM 11.0, the builds have been unified. Get the latest CM 11.0 builds for mb886 here.
For CM 12.0 and newer, builds were de-unified again and can be found under the usual mb886 device builds.
Note:
Your device must be bootloader unlocked to run CyanogenMod. This can only be accomplished on stock firmware versions prior to 9.20.1
./run.sh
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
/storage/sdcard0
or /sdcard
as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data
partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):adb push update.zip /storage/sdcard0/
adb push update.zip /sdcard/
update.zip
should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.Helpful Tip – SD card folders
CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:
adb push update.zip /sdcard/
adb shell "mkdir /sdcard/0/"
followed by adb push update.zip /sdcard/0/
adb push update.zip /sdcard/0/
Helpful Tip
These instructions will hopefully assist you to start with a stock Atrix HD, 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 mb886
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast mb886
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 Atrix HD is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/mb886
directory (you can cd ~/android/system/device/motorola/mb886
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 mb886
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 mb886
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/mb886/cm_mb886-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-mb886.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-mb886.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 7 (Android 2.3 (Gingerbread))
Note: Support Status
This device does not support the latest official release of CyanogenMod. This may be due to hardware limitations or simply because development is ongoing. The most recent version supported is based on the gingerbread branch of CyanogenMod.
Device | http://www.github.com/cyanogenmod/android_device_motorola_olympus |
Codename: | olympus |
---|---|
Vendor: | Motorola |
Manufacturer: | motorola |
Release date: | 2011 August 5 |
Carrier: | Verizon |
Type: | phone |
GSM freq: | 850 900 1800 1900 MHz |
CDMA freq: | 850 1900 2100 MHz |
LTE freq: | 700MHz |
Platform: | NVIDIA Tegra 2 |
CPU: | 1 GHz dual-core Nvidia Tegra 2 |
GPU: | GeForce ULP |
RAM: | 1GB |
Weight: | 158 g (5.6 oz) |
Dimensions: | 127 mm (5 in) (h) 67 mm (2.6 in) (w) 12 mm (0.472 in) (d) |
Screen size: | 109 mm (4.3 in) |
Resolution: | 960 x 540 px |
Internal storage: | 16GB |
SD Card: | up to 32 GB |
Bluetooth: | 2.1 |
Wi-Fi: | 802.11 b/g/n |
Main camera: | 8MP w/ Dual LED flash |
Secondary camera: | 1.3MP |
Power: | 1700 mAh internal rechargeable removable lithium-ion polymer battery |
CM supported: | 7 |
Latest CM version: | gingerbread |
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.
If the bootloader of the Motorola Atrix 4G has already been unlocked, you may skip this section.
feb9a71470ee539e074bf420a2e4d8bd
703af2c5d0258fa09e6e2ace6e1ef648
a5da47565160e0f95b84a1e769b9028b
f609dbc4c5842f9654e44a1980375100
fastboot oem unlock
chmod +x sbf_flash
./sbf_flash <SBF File name here>.sbf
fastboot oem unlock
fastboot oem unlock **ID**
fastboot reboot
See All About Recovery Images for more information about custom recoveries and their capabilities.
c03a7a40c633cd66886d51793dbb29c2
adb reboot bootloader
fastboot devices
fastboot flash recovery your_recovery_image.img
/storage/sdcard0
or /sdcard
as a mountable volume, go ahead and mount it. If you do not see one of these partitions, then instead mount the /data
partition. Take note of which volume you mounted. Now, push the package(s) to your device (also, see tip below):adb push update.zip /storage/sdcard0/
adb push update.zip /sdcard/
update.zip
should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.Helpful Tip – SD card folders
CyanogenMod 10.1 and newer have multi-user support (introduced in Android 4.2). If your device has storage on the /data partition, then Android actually looks in /data/media/0/ for the first user’s /sdcard/ storage. ClockworkMod recovery symlinks /sdcard/ to /data/media/ though. So, if you are pushing files to internal storage in recovery and want them to be visible in Android, you should push them to /sdcard/0/ or /data/media/0/. Here’s the most frequent scenarios:
adb push update.zip /sdcard/
adb shell "mkdir /sdcard/0/"
followed by adb push update.zip /sdcard/0/
adb push update.zip /sdcard/0/
These instructions will hopefully assist you to start with a stock Atrix 4G, 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 gingerbread
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.
$ cd ~/android/system/vendor/cyanogen
then enter:
$ ./get-rommanager
You won’t see any confirmation- just another prompt. But this should cause the Rom Manager apps to be loaded and installed into the source code. Once completed, this does not need to be done again.
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ lunch
You should see a list of devices, including something like cm_olympus-userdebug
. Select it by typing its number. It is possible that lunch
does not display your device. In that case try
$ lunch cm_olympus-userdebug
or
$ lunch full_olympus-userdebug
If all goes well, you should see that olympus-specific directories are downloaded automatically.
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 Atrix 4G is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/olympus
directory (you can cd ~/android/system/device/motorola/olympus
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:
prebuilt/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 olympus
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 olympus
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/olympus/cm_olympus-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-7-20161224-UNOFFICIAL-olympus.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-7-20161224-UNOFFICIAL-olympus.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 12.1 (Android 5.1 (Lollipop))
Note:
Your device must be bootloader unlocked.
For CM 11.0, the device builds have been unified. Get the latest CM 11.0 build for KitKat bootloader updated xt925 here and for xt925 still on JellyBean bootloader here.
For CM 12.0 and newer, the builds were de-unified again. The builds for KitKat updated bootloader xt925 are under the usual xt925 builds. The builds for xt925 that is still on JellyBean bootloader are here.
Device | http://www.github.com/cyanogenmod/android_device_motorola_xt925 |
Kernel | http://www.github.com/cyanogenmod/android_kernel_motorola_msm8960-common |
Codename: | xt925 |
---|---|
Also known as: | vanquish_u |
Vendor: | Motorola |
Release date: | 2012 September |
Type: | phone |
GSM freq: | GSM 850 / 900 / 1800 / 1900 HSDPA 850 / 900 / 1900 / 2100 |
LTE freq: | LTE 800 / 1800 / 2600 LTE 700 / 800 / 1700 / 1800 / 2600 |
Platform: | Qualcomm MSM8960 |
CPU: | 1.5 GHz dual-core Cortex A9 (Krait) |
GPU: | Adreno 225 |
RAM: | 1GB |
Weight: | 146 g (5.15 oz) |
Dimensions: | 131.9 x 67.9 x 8.4 mm (5.19 x 2.67 x 0.33 in) |
Screen size: | 119 mm (4.7 in) |
Resolution: | 720 x 1280 pixels |
Screen density: | ~312 ppi |
Screen type: | Super AMOLED capacitive touchscreen |
Internal storage: | 16 GB (12 GB user available) |
SD Card: | microSD, up to 32 GB |
Bluetooth: | Yes, v4.0 with A2DP, LE, EDR |
Wi-Fi: | Wi-Fi 802.11 a/b/g/n, dual-band, DLNA, Wi-Fi hotspot |
Main camera: | 8 MP, 3264×2448 pixels, autofocus, 1080p@30fps, flash: LED flash |
Secondary camera: | Yes, 1.3 MP |
Power: | Non-removable Li-Po 2500/2530 mAh battery (Up to 16h-2G / Up to 22h-3G) |
Peripherals: | Accelerometer, proximity, compass |
CM supported: | 10.1, 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:
Your device must be bootloader unlocked.
For CM 11.0, the device builds have been unified. Get the latest CM 11.0 build for KitKat bootloader updated xt925 here and for xt925 still on JellyBean bootloader here.
For CM 12.0 and newer, the builds were de-unified again. The builds for KitKat updated bootloader xt925 are under the usual xt925 builds. The builds for xt925 that is still on JellyBean bootloader are here.
WARNING:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem get_unlock_data
See All About Recovery Images for more information about custom recoveries and their capabilities.
047f9294e72d813526437e9464372c46
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 RAZR HD (GSM), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for CyanogenMod (based on Google’s Android operating system). Using these, you can build both CyanogenMod and CyanogenMod Recovery image from source code, and then install them both to your device.
It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the very very very uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.
Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :) And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.
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 RAZR HD (GSM), your device is already unlocked. Assuming you also have adb and fastboot installed on your computer, you can skip this whole section and proceed to the HOW TO BUILD section below.
The first step in putting any custom operating system on your RAZR HD (GSM) is to unlock the bootloader. A bootloader is the very first program that runs when you turn on your device. The bootloader initializes some hardware and then loads the kernel and ramdisk, and gets the boot process going. If the bootloader is in locked mode, it will ensure that only the stock operating system can run. Since you will be installing your own operating system, you need to turn this off. Luckily, Google and motorola 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 RAZR HD (GSM), you will need fastboot installed. Go ahead and download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.
Note:
Google’s instructions may be out of date for 12.04. The Sun JDK isn’t available anymore as a dpkg AND they say Eclipse 3.6 isn’t available as a package. Well, 3.7.X is now available. Doing a “$ sudo apt-get install eclipse
” will now install the proper Eclipse and JDK (OpenJDK 6).
WARNING:
Unlocking the bootloader will automatically wipe all device data.
adb reboot bootloader
fastboot devices
fastboot oem get_unlock_data
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 xt925
After the source downloads, ensure you are in the root of the source code (cd ~/android/system
), then type:
$ source build/envsetup.sh
$ breakfast xt925
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 RAZR HD (GSM) is connected to your computer via the USB cable and that you are in the ~/android/system/device/motorola/xt925
directory (you can cd ~/android/system/device/motorola/xt925
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 xt925
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 xt925
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/xt925/cm_xt925-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-xt925.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-xt925.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.