Sony Ericsson Xperia Neo (hallon)

Sony Ericsson Xperia Neo ("hallon") Cyanogenmod

Cyanogenmod ROM Sony Ericsson Xperia Neo (hallon)

Quick Info

Download CyanogenMod

It looks like we don’t have any roms for download for this device. 🙁

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 jellybean branch of CyanogenMod.

Notes

The Sony Ericsson Xperia Neo (aka hallon) is a touchscreen smartphone manufactured by Sony Ericsson. Official CyanogenMod support for the Sony Ericsson Xperia Neo was added in CyanogenMod 7.1.

Special boot modes

  • Fastboot:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_semc_hallon
Kernel http://www.github.com/cyanogenmod/semc-kernel-msm7x30
Xperia Neo Specifications
Codename: hallon
Vendor: Sony Ericsson
Release date: 2011 April 19 (EUROPE)
Type: phone
GSM freq: 850 900 1800 1900 MHz GSM/GPRS/EDGE
850 1900 2100 MHz UMTS/HSPA+ (CANADA)
900 2100 MHz UMTS/HSPA+ (EUROPE)
Platform: Qualcomm MSM8255
CPU: 1 GHz single-core Qualcomm Snapdragon S2
GPU: Qualcomm Adreno 205
RAM: 512MB
Weight: 126 g (4.4 oz)
Dimensions: 116 mm (4.6 in) (h)
57 mm (2.24 in) (w)
13 mm (0.511 in) (d)
Screen size: 94 mm (3.7 in)
Resolution: 854×480 (FWVGA)
Screen type: LED LCD
Internal storage: 1 GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1+EDR with A2DP
Wi-Fi: 802.11b/g/n
Main camera: 8.1 megapixel with LED flash
Secondary camera: 0.3 megapixel
Power: 1650 mAh internal rechargeable removable lithium-ion polymer battery
Peripherals: microUSB, A-GPS, DNLA, microHDMI, capacitive touchscreen, proximity & ambient light sensors, volume controls, 3-axis accelerometer, digital compass
CM supported: 7, 9, 10
Latest CM version: jellybean

How to Install CyanogenMod on the Sony Ericsson Xperia Neo (hallon)

Note: DISCLAIMER

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

Important Notes

The Sony Ericsson Xperia Neo (aka hallon) is a touchscreen smartphone manufactured by Sony Ericsson. Official CyanogenMod support for the Sony Ericsson Xperia Neo was added in CyanogenMod 7.1.

Unlock your Xperia Neo

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Neo 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Neo you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Neo and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
      1. Power down device
      2. Plug data cable into PC
      3. While holding down the Menu button, plug the data cable into the device

      If successful, the LED will turn blue to indicate the device is in fastboot mode.

  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Neo’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Ericsson Xperia Neo (hallon)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast hallon

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Neo is connected to your computer via the USB cable and that you are in the ~/android/system/device/semc/hallon directory (you can cd ~/android/system/device/semc/hallon 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/semc 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/semc directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch hallon

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 hallon should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-10-20161224-UNOFFICIAL-hallon.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Ericsson Xperia Neo V (haida)

Sony Ericsson Xperia Neo V ("haida") Cyanogenmod

Cyanogenmod ROM Sony Ericsson Xperia Neo V (haida)

Quick Info

Download CyanogenMod

It looks like we don’t have any roms for download for this device. 🙁

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 jellybean branch of CyanogenMod.

Notes

The Sony Ericsson Xperia Neo V (aka haida) is a touchscreen smartphone manufactured by Sony Ericsson. Official CyanogenMod support for the Sony Ericsson Xperia Neo V was added in CyanogenMod 9.0.

Special boot modes

  • Bootloader:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

  • Fastboot:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_semc_haida
Kernel http://www.github.com/cyanogenmod/semc-kernel-msm7x30
Xperia Neo V Specifications
Codename: haida
Vendor: Sony Ericsson
Release date: 2011 October (EUROPE)
Type: phone
GSM freq: 850 900 1800 1900 MHz GSM/GPRS/EDGE
850 1900 2100 MHz UMTS/HSPA+ (USA)
900 2100 MHz UMTS/HSPA+ (EUROPE)
Platform: Qualcomm MSM8255
CPU: 1 GHz single-core Qualcomm Snapdragon S2
GPU: Qualcomm Adreno 205
RAM: 512MB
Weight: 126 g (4.4 oz)
Dimensions: 116 mm (4.6 in) (h)
57 mm (2.24 in) (w)
13 mm (0.511 in) (d)
Screen size: 94 mm (3.7 in)
Resolution: 854×480 (FWVGA)
Screen type: LED LCD
Internal storage: 1 GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1+EDR with A2DP
Wi-Fi: 802.11b/g/n
Main camera: 5 megapixel with LED flash
Secondary camera: 0.3 megapixel
Power: 1500 mAh internal rechargeable removable lithium polymer battery
Peripherals: microUSB, A-GPS, DNLA, microHDMI, capacitive touchscreen, proximity & ambient light sensors, volume controls, 3-axis accelerometer, digital compass
CM supported: 9, 10
Latest CM version: jellybean

How to Install CyanogenMod on the Sony Ericsson Xperia Neo V (haida)

Note: DISCLAIMER

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

Important Notes

The Sony Ericsson Xperia Neo V (aka haida) is a touchscreen smartphone manufactured by Sony Ericsson. Official CyanogenMod support for the Sony Ericsson Xperia Neo V was added in CyanogenMod 9.0.

Unlock your Xperia Neo V

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Neo V 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Neo V you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Neo V and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
      1. Power down device
      2. Plug data cable into PC
      3. While holding down the Menu button, plug the data cable into the device

      If successful, the LED will turn blue to indicate the device is in fastboot mode.

  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Neo V’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Ericsson Xperia Neo V (haida)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast haida

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Neo V is connected to your computer via the USB cable and that you are in the ~/android/system/device/semc/haida directory (you can cd ~/android/system/device/semc/haida 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/semc 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/semc directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch haida

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 haida should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-10-20161224-UNOFFICIAL-haida.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Ericsson Live with Walkman (coconut)

Sony Ericsson Live with Walkman ("coconut") Cyanogenmod

Cyanogenmod ROM Sony Ericsson Live with Walkman (coconut)

Quick Info

Download CyanogenMod

It looks like we don’t have any roms for download for this device. 🙁

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 jellybean branch of CyanogenMod.

Special boot modes

  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable.

Source code

Device http://www.github.com/cyanogenmod/android_device_semc_coconut
Kernel http://www.github.com/cyanogenmod/semc-kernel-msm7x30
Live with Walkman Specifications
Codename: coconut
Also known as: coconut
Vendor: Sony Ericsson
Release date: 2011-08
Type: phone
Platform: Qualcomm MSM8255
CPU: 1 GHz single-core Snapdragon S2
GPU: Adreno 205
RAM: 512MB
Weight: 115 g (4.06 oz)
Dimensions: 106 x 56.5 x 14.2 mm
Screen size: 81 mm (3.2 in)
Resolution: 320×480
Screen density: 180 ppi
Screen type: TFT LCD
Internal storage: 320MB
Bluetooth: 2.1 with A2DP, EDR
Wi-Fi: Wi-Fi 802.11 b/g/n, DLNA, Wi-Fi hotspot
Main camera: 5MP w/ LED flash
Secondary camera: 0.3mp
Peripherals: Accelerometer, proximity, compass
CM supported: 7, 9, 10
Latest CM version: jellybean

How to Install CyanogenMod on the Sony Ericsson Live with Walkman (coconut)

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.

Unlock your Live with Walkman

What does “unlocking” mean?

The first step in putting any custom operating system on your Live with Walkman 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Live with Walkman you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Live with Walkman and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Live with Walkman’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Ericsson Live with Walkman (coconut)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast coconut

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Live with Walkman is connected to your computer via the USB cable and that you are in the ~/android/system/device/semc/coconut directory (you can cd ~/android/system/device/semc/coconut 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/semc 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/semc directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch coconut

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 coconut should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-10-20161224-UNOFFICIAL-coconut.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Ericsson Xperia Arc (anzu)

Sony Ericsson Xperia Arc (anzu) Cyanogenmod

Cyanogenmod ROM Sony Ericsson Xperia Arc (anzu)

Quick Info

Download CyanogenMod

It looks like we don’t have any roms for download for this device. 🙁

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 jellybean branch of CyanogenMod.

Special boot modes

  • Fastboot:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_semc_anzu
Kernel http://www.github.com/cyanogenmod/semc-kernel-msm7x30
Xperia Arc Specifications
Codename: anzu
Vendor: Sony Ericsson
Release date: 2011 April 1 (EUROPE)
Type: phone
GSM freq: 850 900 1800 1900 MHz GSM/GPRS/EDGE

800 850 1900 2100 MHz UMTS/HSPA+ (CANADA)
900 2100 MHz UMTS/HSPA+ (EUROPE)

Platform: Qualcomm MSM8255
CPU: 1 GHz single-core Snapdragon S2
GPU: Qualcomm Adreno 205
RAM: 512MB
Weight: 117 g (4.1 oz)
Dimensions: 125 mm (4.9 in) (h)

63 mm (2.48 in) (w)
9 mm (0.354 in) (d)

Screen size: 107 mm (4.2 in)
Resolution: 854×480 (FWVGA)
Screen type: TFT LED-LCD
Internal storage: 1GB
SD Card: up to 32 GB
Bluetooth: Bluetooth 2.1+EDR with A2DP
Wi-Fi: 802.11b/g/n
Main camera: 8 megapixel w/LED flash
Power: 1500 mAh internal rechargeable removable lithium-ion polymer battery
Peripherals: microUSB, A-GPS, DNLA, microHDMI, capacitive touchscreen, proximity and ambient light sensors, volume controls, 3-axis accelerometer, digital compass
CM supported: 7, 9, 10
Latest CM version: jellybean

How to Install CyanogenMod on the Sony Ericsson Xperia Arc (anzu)

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.

Unlock your Xperia Arc

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Arc 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Arc you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Arc and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
      1. Power down device
      2. Plug data cable into PC
      3. While holding down the Menu button, plug the data cable into the device

      If successful, the LED will turn blue to indicate the device is in fastboot mode.

  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Arc’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    1. Power down device
    2. Plug data cable into PC
    3. While holding down the Menu button, plug the data cable into the device

    If successful, the LED will turn blue to indicate the device is in fastboot mode.

  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Ericsson Xperia Arc (anzu)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast anzu

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Arc is connected to your computer via the USB cable and that you are in the ~/android/system/device/semc/anzu directory (you can cd ~/android/system/device/semc/anzu 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/semc 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/semc directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch anzu

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 anzu should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-10-20161224-UNOFFICIAL-anzu.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia Ion (aoba)

CyanogenMod ROM Sony Xperia Ion (aoba)

CyanogenMod ROM Sony Xperia Ion (aoba)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 9 (Android 4.0.4 (Ice Cream Sandwich))

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 ics branch of CyanogenMod.

Source code

Device http://www.github.com/cyanogenmod/android_device_Sony_aoba
Kernel http://www.github.com/cyanogenmod/sony-kernel-msm8660
Xperia Ion Specifications
Codename: aoba
Vendor: Sony
Manufacturer: Sony
Release date: 2012 September
Type: phone
GSM freq: GSM 850 / 900 / 1800 / 1900
HSDPA 850 / 1900 / 2100
LTE freq: LTE 700 MHz Class 17 / 1700 / 2100
Platform: Qualcomm MSM8260
CPU: 1.5 GHz dual-core Snapdragon S3
GPU: Adreno 220
RAM: 1GB
Weight: 144 g (5.08 oz)
Dimensions: 133 x 68 x 10.6 mm (5.24 x 2.68 x 0.43 in)
Screen size: 116 mm (4.6 in)
Resolution: 720×1280
Screen density: 323 ppi
Internal storage: 16GB
SD Card: up to 32GB
Bluetooth: Bluetooth 2.1 + EDR
Wi-Fi: 802.11b/g/n
Main camera: 12 MP
Secondary camera: 1.3 MP
Power: Non-removable Li-Ion 1900 mAh battery
Peripherals: Accelerometer, gyro, proximity, compass, HDMI,
CM supported: 9
Latest CM version: ics

How to Install CyanogenMod on the Sony Xperia Ion (aoba)

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.

Unlock your Xperia Ion

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Ion 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Ion you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Ion and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Ion’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia Ion (aoba)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast aoba

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Ion is connected to your computer via the USB cable and that you are in the ~/android/system/device/Sony/aoba directory (you can cd ~/android/system/device/Sony/aoba 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/Sony 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/Sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch aoba

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 aoba should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-9-20161224-UNOFFICIAL-aoba.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia TX (hayabusa)

CyanogenMod ROM Sony Xperia TX (hayabusa / LT29i)

CyanogenMod ROM Sony Xperia TX (LT29i) (hayabusa)

Quick Info

Download CyanogenMod

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

Notes

Note: UserData partitions unification starting from CM-13.0

The internal physical SDCard partition and the apps data partition of the device have been merged into a common UserData partition. The Unification process will require you to empty the SDCard partition, flash the new ROM zip and follow the instructions. Every time your files could get lost (Data, SDCard, …), a warning will be shown to explain the issue and the flash will be aborted. You will then be able to flash the zip once again to accept the previously aborted process and unify the UserData. Then flash the ROM as usual.

Special boot modes

  • Recovery: On boot, press Volume Down when the LEDs start lightning up.
    Second Recovery: To boot the FOTA Recovery, press Volume Up instead.
  • Bootloader: With the device powered down, hold Volume Down and connect the USB cable. The notification light should turn green.
  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.

Source code

Device http://www.github.com/cyanogenmod/android_device_sony_hayabusa
Kernel http://www.github.com/cyanogenmod/android_kernel_sony_msm8x60
Xperia TX Specifications
Codename: hayabusa
Also known as: LT29i
Vendor: Sony
Release date: 2012 August
Type: phone
GSM freq: 850 / 900 / 1800 / 1900 / 2100 MHz UMTS/HSPA+
Platform: Qualcomm Snapdragon S4 MSM8260A
CPU: 1.5 GHz dual-core Krait
GPU: Adreno 225
RAM: 1GB
Weight: 127 g (4.48 oz)
Dimensions: 131.0 mm (h)
68.6 mm (w)
8.6 mm (d)
Screen size: 110.0 mm (4.55 in)
Resolution: 720×1280
Screen density: 323 ppi
Screen type: TFT
Internal storage: 16GB
SD Card: officially up to 32GB
Bluetooth: Bluetooth 4.0 + A2DP
Wi-Fi: 802.11 2.4GHz a/b/g/n 5GHz
Main camera: 13 MP f/2.4, flash: LED
Secondary camera: 1.3 MP
Power: Removable 1750 mAh
Peripherals: Wi-Fi Direct, Wi-Fi Display, Wi-Fi Hotspot, MHL HDMI, GPS, NFC, Accelerometer, Compass, Gyroscope, Light sensor, Proximity Sensor
CM supported: 10.1, 13, 14.1

How to Install CyanogenMod on the Sony Xperia TX (hayabusa)

Note: DISCLAIMER

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

Important Notes

Note: UserData partitions unification starting from CM-13.0

The internal physical SDCard partition and the apps data partition of the device have been merged into a common UserData partition. The Unification process will require you to empty the SDCard partition, flash the new ROM zip and follow the instructions. Every time your files could get lost (Data, SDCard, …), a warning will be shown to explain the issue and the flash will be aborted. You will then be able to flash the zip once again to accept the previously aborted process and unify the UserData. Then flash the ROM as usual.

Unlock your Xperia TX

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia TX 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia TX you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia TX and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia TX’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia TX (hayabusa)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast hayabusa

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia TX is connected to your computer via the USB cable and that you are in the ~/android/system/device/sony/hayabusa directory (you can cd ~/android/system/device/sony/hayabusa 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/sony 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/sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch hayabusa

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 hayabusa should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-13.0-20161224-UNOFFICIAL-hayabusa.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia Z3 dual (z3dual)

CyanogenMod ROM Sony Xperia Z3 dual (z3dual) (D6633, D6683)

CyanogenMod ROM Sony Xperia Z3 dual (D6633, D6683) (z3dual)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 12.1 (Android 5.1 (Lollipop))

Special boot modes

  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_sony_z3dual
Kernel http://www.github.com/cyanogenmod/android_kernel_sony_msm8974
Xperia Z3 Dual Specifications
Codename: z3dual
Also known as: D6633, D6683
Vendor: Sony
Type: phone
Platform: Qualcomm MSM8974AC Snapdragon 801
CPU: 2.5 GHz quad-core Krait 400
GPU: Adreno 330
RAM: 3GB
Weight: 152 g (5.36 oz)
Dimensions: 146 mm (5.75 in) (h)
72 mm (2.83 in) (w)
7.3 mm (0.29 in) (d)
Screen size: 132 mm (5.2 in)
Resolution: 1920×1080
Screen type: IPS LCD
Internal storage: 16/32GB
SD Card: up to 128GB
Bluetooth: v4.0, A2DP, apt-X
Wi-Fi: 802.11 a/b/g/n/ac
Main camera: 20.7MP
Secondary camera: 2.2MP
Power: 3100 mAh
CM supported: 12.1

How to Install CyanogenMod on the Sony Xperia Z3 Dual (z3dual)

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.

Unlock your Xperia Z3 Dual

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Z3 Dual 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Z3 Dual you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Z3 Dual and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Z3 Dual’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia Z3 Dual (z3dual)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast z3dual

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Z3 Dual is connected to your computer via the USB cable and that you are in the ~/android/system/device/sony/z3dual directory (you can cd ~/android/system/device/sony/z3dual 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/sony 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/sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch z3dual

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 z3dual should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-13.0-20161224-UNOFFICIAL-z3dual.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia Z Ultra (Google Play Edition) (togari_gpe)

Cyanogenmod ROM Sony Xperia Z Ultra (Google Play Edition) (togari_gpe)

Cyanogenmod ROM Sony Xperia Z Ultra (Google Play Edition) (togari_gpe)

Quick Info

Download CyanogenMod

Download (nightly build)
CyanogenMod 12.1 (Android 5.1 (Lollipop))

Special boot modes

  • Recovery: Press Volume Up when the notification light is purple.
  • Bootloader: With the device powered down, hold Volume Down and connect the USB cable. The notification light should briefly turn green to indicate you are in flash mode.
  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_sony_togari_gpe
Kernel http://www.github.com/cyanogenmod/android_kernel_sony_msm8974
Xperia Z Ultra (Google Play Edition) Specifications
Codename: togari_gpe
Vendor: Sony
Manufacturer: Sony
Release date: 2013 December 10
Type: phone
GSM freq: 850, 900, 1800, 1900 MHz GSM/EDGE/GPRS; 850, 900, 1700, 1900, 2100 MHz UMTS/HSPA+
LTE freq: 700, 850, 900, 1700, 1900, 2100, 2600 MHz
Platform: Qualcomm MSM8974
CPU: 2.2 GHz quad-core Krait Snapdragon S800
GPU: Adreno 330
RAM: 2GB
Weight: 212 g
Dimensions: 179 mm (7.05 in) (h)
92 mm (3.62 in) (w)
6.5 mm (0.26 in) (d)
Screen size: 162 mm (6.4 in)
Resolution: 1080×1920
Screen density: 344 ppi
Screen type: TFT
Internal storage: 16GB
SD Card: up to 64GB
Bluetooth: Bluetooth 4.0
Wi-Fi: 802.11a/b/g/n
Main camera: 8 MP, flash: LED
Secondary camera: 2 MP
Power: 3050 mAh
Peripherals: light sensor, proximity sensor, accelerometer, compass, gyroscope
CM supported: 11, 12, 12.1

How to Install CyanogenMod on the Sony Xperia Z Ultra (Google Play Edition) (togari_gpe)

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.

Unlock your Xperia Z Ultra (Google Play Edition)

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Z Ultra (Google Play Edition) 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Z Ultra (Google Play Edition) you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Z Ultra (Google Play Edition) and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Z Ultra (Google Play Edition)’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia Z Ultra (Google Play Edition) (togari_gpe)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast togari_gpe

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Z Ultra (Google Play Edition) is connected to your computer via the USB cable and that you are in the ~/android/system/device/sony/togari_gpe directory (you can cd ~/android/system/device/sony/togari_gpe 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/sony 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/sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch togari_gpe

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 togari_gpe should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-13.0-20161224-UNOFFICIAL-togari_gpe.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia Z (yuga)

Cyanogenmod ROM Sony Xperia Z (yuga) C6603

Cyanogenmod ROM Sony Xperia Z C6603 (yuga)

Quick Info

Download CyanogenMod

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

Special boot modes

  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.

Source code

Device http://www.github.com/cyanogenmod/android_device_sony_yuga
Kernel http://www.github.com/cyanogenmod/android_kernel_sony_apq8064
Xperia Z Specifications
Codename: yuga
Also known as: C6603
Vendor: Sony
Manufacturer: Sony
Release date: 2013 March
Type: phone
GSM freq: 850, 900, 1800, 1900, 2100 MHz UMTS/HSPA+
LTE freq: 800, 850, 1800, 2100, 2600 MHz
Platform: Qualcomm APQ8064, Qualcomm MDM9215M
CPU: 1.5 GHz quad-core Krait Snapdragon S4 Pro
GPU: Adreno 320
RAM: 2GB
Weight: 146 g
Dimensions: 139.0 x 71.0 x 7.9 mm
Screen size: 127 mm (5.0 in)
Resolution: 1080×1920
Screen density: 441 ppi
Screen type: TFT
Internal storage: 16GB
SD Card: up to 64GB
Bluetooth: Bluetooth 4.0
Wi-Fi: 802.11a/b/g/n
Main camera: 13 MP
Secondary camera: 2 MP
Power: 2330 mAh
Peripherals: light sensor, proximity sensor, accelerometer, compass, gyroscope
CM supported: 10.1, 10.2, 11, 12.1, 13

How to Install CyanogenMod on the Sony Xperia Z (yuga)

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.

Unlock your Xperia Z

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia Z 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia Z you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia Z and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia Z’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue to indicate you are in fastboot mode.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia Z (yuga)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast yuga

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia Z is connected to your computer via the USB cable and that you are in the ~/android/system/device/sony/yuga directory (you can cd ~/android/system/device/sony/yuga 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/sony 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/sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch yuga

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 yuga should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-13.0-20161224-UNOFFICIAL-yuga.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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

Sony Xperia V (tsubasa)

Cyanogenmod ROM Sony Xperia V (tsubasa) LT25i

Cyanogenmod ROM Sony Xperia V LT25i (tsubasa)

Quick Info

Download CyanogenMod

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

Notes

Note: UserData partitions unification starting from CM-13.0

The internal physical SDCard partition and the apps data partition of the device have been merged into a common UserData partition. The Unification process will require you to empty the SDCard partition, flash the new ROM zip and follow the instructions. Every time your files could get lost (Data, SDCard, …), a warning will be shown to explain the issue and the flash will be aborted. You will then be able to flash the zip once again to accept the previously aborted process and unify the UserData. Then flash the ROM as usual.

Special boot modes

  • Recovery: On boot, press Volume Down when the LEDs start lightning up.
    Second Recovery: To boot the FOTA Recovery, press Volume Up instead.
  • Bootloader: With the device powered down, hold Volume Down and connect the USB cable. The notification light should turn green.
  • Fastboot: With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.

Source code

Device http://www.github.com/cyanogenmod/android_device_sony_tsubasa
Kernel http://www.github.com/cyanogenmod/android_kernel_sony_msm8x60
Xperia V Specifications
Codename: tsubasa
Also known as: LT25i
Vendor: Sony
Release date: 2012 September
Type: phone
GSM freq: 850 / 900 / 1800 / 1900 / 2100 MHz UMTS/HSPA+
LTE freq: 850 / 1800 / 2100 / 2600 MHz
Platform: Qualcomm Snapdragon S4 MSM8960
CPU: 1.5 GHz dual-core Krait
GPU: Adreno 225
RAM: 1GB
Weight: 120 g (4.23 oz)
Dimensions: 129.0 mm (h)
65.0 mm (w)
10.7 mm (d)
Screen size: 109 mm (4.3 in)
Resolution: 720×1280
Screen density: 342 ppi
Screen type: TFT
Internal storage: 8GB
SD Card: officially up to 32GB
Bluetooth: Bluetooth 4.0 + A2DP
Wi-Fi: 802.11 2.4GHz a/b/g/n 5GHz
Main camera: 13 MP f/2.4, flash: LED
Secondary camera: 1.3 MP
Power: Removable 1700 mAh
Peripherals: Wi-Fi Direct, Wi-Fi Display, Wi-Fi Hotspot, MHL HDMI, GPS, NFC, Accelerometer, Compass, Gyroscope, Light sensor, Proximity Sensor
CM supported: 10.1, 10.2, 11, 12, 13, 14.1

How to Install CyanogenMod on the Sony Xperia V (tsubasa)

Note: DISCLAIMER

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

Important Notes

Note: UserData partitions unification starting from CM-13.0

The internal physical SDCard partition and the apps data partition of the device have been merged into a common UserData partition. The Unification process will require you to empty the SDCard partition, flash the new ROM zip and follow the instructions. Every time your files could get lost (Data, SDCard, …), a warning will be shown to explain the issue and the flash will be aborted. You will then be able to flash the zip once again to accept the previously aborted process and unify the UserData. Then flash the ROM as usual.

Unlock your Xperia V

What does “unlocking” mean?

The first step in putting any custom operating system on your Xperia V 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 (CyanogenMod), you need to turn this off.

To unlock your bootloader, you’ll first need a program on your computer called adb. One way to get adb 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.

Install the Android SDK

Download the SDK, per the steps on Google’s web page. Then install it by following the specific instructions for your computer.

Obtaining the Bootloader Unlock Code

Note:

Unlocking the bootloader on a Sony device may automatically wipe internal storage; a backup of the sdcard is suggested. It will also irreversibly erase the DRM keys stored in the TA partition of some devices, which will result in the loss of certain proprietary features that may have been included. Check your specific device forum on XDA to learn more.

In order to unlock the bootloader on your Xperia V you will need to obtain a code from Sony. The following process will help you acquire this code so that you can flash a custom recovery.

  1. Open the Phone application on the Xperia V and enter *#06# to obtain the device’s IMEI, IDID or MEID. Save this for later use.
    • Optional: if you do not have a phone app, the IMEI, IDID or MEID can be found on the box or on the device in Settings -> About Device -> Status.
  2. Put the device into fastboot mode:
    • With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.
  3. Open a terminal on the PC and enter fastboot getvar version
    • If you receive the message <waiting for device> fastboot is not configured properly, please see fastboot for more details.
  4. Navigate a browser here
    • Select your device and click the ‘continue’ button at the bottom of the page.
    • Enter your email address, agree to the terms and select ‘Submit’
    • Click the link from your email, enter your IMEI, IDID or MEID and continue
    • The unlock code should now appear, write this down for the next step.
  5. In the PC’s terminal, enter the following command: fastboot oem unlock 0xKEY
    • KEY corresponds to the unlock code you were given.

The Xperia V’s bootloader should now be unlocked.

Installing CyanogenMod on Sony Devices

  1. Download the CyanogenMod build package for your device that you’d like to install to your computer.
    Optional: Download 3rd party applications packages, like Google Apps which are necessary to download apps from Google Play.
  2. Extract boot.img from the zip to your computer, you will need this file for fastboot.
  3. Put the phone into fastboot mode:
    With the device powered down, hold Volume Up and connect the USB cable. The notification light should turn blue.
  4. Open a terminal on the PC with admin rights, access your platform-tools directory of the Android SDK, and enter the following:
    • fastboot flash boot boot.img
    • fastboot reboot
    While the device reboots, press the Volume rockers a few times to load recovery.
Note: Make the selection below based on the recovery version you see on your screen. If you’re installing CyanogenMod 11, you will have CWM Recovery. If installing CyanogenMod 12.0 or newer, you will have CyanogenMod Recovery.
Click here to continue instructions using CyanogenMod Recovery
Note: Once the device boots into CyanogenMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection. The recovery is also touch screen friendly, so you can swipe up or down to scroll and tap the item you wish to select.
  1. Optional (Recommended): Using adb you can create a backup on your PC of your apps and app data. Boot the device into android and open a command prompt (or terminal on Mac and Linux) and enter the following:
    • adb backup -apk -all -f backup20161224.ab
    When the backup is complete return to recovery mode.
  2. On the device, select wipe data/factory reset.
  3. You have two options for installing the installation zip packages. (Note: The sideload method requires a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors):
    • Sideload method: Select apply update > apply update from adb. Open a command prompt (or Terminal on Mac and Linux) and enter adb sideload update.zip, where update.zip should be replaced with the package filename. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Install update method: If you previously placed the installation zip packages on your internal storage, select apply update > choose from internal storage. Navigate to the directory where you placed the packages and select one. If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Click here to continue instructions using CWM Recovery
Note:Once the device boots into ClockworkMod Recovery, use the physical volume buttons to move up and down. The home button is used to confirm your selection.
  1. Optional (Recommended): Select backup and restore to create a backup of your current ROM.
  2. Select wipe data/factory reset. If you get an error formatting /data, try format /data and /data/media from the mounts and storage menu
  3. You have two options for transferring and installing the installation zip packages. Both cases require a recent version of adb to be working in recovery (adb bundled with ubuntu may have protocol errors). The sideload method is more universal across devices, whereas the push and install method is more commonly used:
    • Sideload method: select install zip > install zip from sideload. Follow the on-screen notices to install the package. The installer does not necessarily display an “Install complete.” message. You can tell the install is complete if there were no fatal error messages and you have regained control over the menu.
    • Push and install method: Open a command prompt (or Terminal on Mac and Linux) and navigate to the directory holding the package(s) you would like to install. On the device, navigate to the mounts and storage menu. If you see /storage/sdcard0 as a mountable volume, go ahead and mount it. If you do not see this directory, then instead mount the /data directory. Take note of which volume you mounted. Now, push the package(s) to your device:
    – If you mounted /storage/sdcard0, then: adb push update.zip /storage/sdcard0/
    – If you mounted /data, then: adb push update.zip /sdcard/0/
    where update.zip should be replaced with the package filename. Go back to the main menu and select install zip. Choose to install from the same directory where you pushed the package(s). If you are installing multiple packages, install CyanogenMod first and then install any subsequent packages on top of it.
  4. Once installation has finished, return to the main menu and select reboot system now. The device will now boot into CyanogenMod.

Note:

On all 2011 model Sony devices, the kernel will not update when flashed in recovery, so the kernel must be updated via fastboot every time you flash a new build of CyanogenMod.

Helpful Tip

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

How To Build CyanogenMod For Sony Xperia V (tsubasa)

Introduction

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

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

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

What you’ll need

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

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

Note:

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

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

So let’s begin!

Build CyanogenMod and CyanogenMod Recovery

Prepare the Build Environment

Note:

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

Install the SDK

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

Helpful Tip

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

Install the Build Packages

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

Helpful Tip

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

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

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

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

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

For Ubuntu 15.10 (wily) and newer, substitute:

  • lib32readline-gplv2-devlib32readline6-dev

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

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

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

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

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

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

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

Create the directories

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

To create them:

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

Install the repo command

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

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

Put the ~/bin directory in your path of execution

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

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

Initialize the CyanogenMod source repository

Enter the following to initialize the repository:

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

Download the source code

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

$ repo sync

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

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

Helpful Tip

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

Get prebuilt apps (CM11 and below)

Next,

$ cd ~/android/system/vendor/cm

then enter:

$ ./get-prebuilts

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

Prepare the device-specific code

Helpful Tip – Errors during breakfast

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

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

$ source build/envsetup.sh
$ breakfast tsubasa

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

Helpful Tip

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

Helpful Tip

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

Extract proprietary blobs

Now ensure that your Xperia V is connected to your computer via the USB cable and that you are in the ~/android/system/device/sony/tsubasa directory (you can cd ~/android/system/device/sony/tsubasa 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/sony 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/sony directory by using the extract-files.sh script. Makefiles are generated at the same time to make sure the blobs are eventually copied to the device. Without these blobs, CyanogenMod may build without error, but you’ll be missing important functionality, such as graphics libraries that enable you to see anything!

Turn on caching to speed up build

You can speed up subsequent builds by adding

export USE_CCACHE=1

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

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

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

Helpful Tip

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

Start the build

Time to start building! So now type:

$ croot
$ brunch tsubasa

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 tsubasa should then work.

Helpful Tip

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

Helpful Tip

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

If the build breaks…

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

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

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

Then start the build again (with brunch).

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

Install the build

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

$ cd $OUT

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

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

Install CyanogenMod

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

cm-13.0-20161224-UNOFFICIAL-tsubasa.zip

Note:

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

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

Success! So….what’s next?

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

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

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

Congrats again!

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