[Sony Xperia P, U, Sola, Go] elia222:
DISCLAMER

Although the procedures in this guide were tested on my pc/phone and produced a working build on the xperia U, I take no responsibility for any consequences derived from their use.

This guide applies to Ubuntu 13.04 Raring Ringtail 64 bit. Do not use 32 Bit.

If you want to use another ubuntu version, some things might be a little different. Just search on xda and you will find all the instructions that you need to complete the setup.

1) SET UP THE BUILD ENVIRONMENT

Remove openJDK and install Java 6 jdk. Open a terminal and type:

sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

This will uninstall openJDK.

sudo add-apt-repository ppa:webupd8team/java

Adds a PPA to your system, needed to download java.

sudo apt-get update && sudo apt-get install oracle-java6-installer

Download and installs java!

To make sure the correct version of Java is activated, run the following at the Terminal prompt:

java -version

You should see something like that:

java version "1.6.0_45"

Java(TM) SE Runtime Environment (build 1.6.0_45-b06)

Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

Now type:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python lzop

This will install the needed packages.

When done, do this:

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Now, install the repo binary:

mkdir ~/bin && curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo && chmod a+x ~/bin/repo

Edit .bashrc:

sudo nano ~/.bashrc

At the bottom of the file, add the following line:

export PATH=~/bin:$PATH

Save it (In nano type Ctrl-O and then Enter, then Ctrl-X to exit back to a prompt).

Restart bash:

source ~/.bashrc

From now the guide is for cm9/10 only, if you want to build cm10.1 look at 3rd post.

2) DOWNLOAD THE SOURCES:

mkdir ~/cyanogenmod
cd ~/cyanogenmod

This creates a folder named "cyanogenmod" and opens it.

Initialize the repo:

If you're building cm10 -

repo init -u git://github.com/CyanogenMod/android.git -b jellybean

Or for cm9 -

repo init -u git://github.com/CyanogenMod/android.git -b ics

Download time!

repo sync

It will download about 10gb of data, so be patient!

Download the prebuilts:

~/cyanogenmod/vendor/cm/get-prebuilts

Download device specific repos:

. build/envsetup.sh && breakfast name_of_device

Instead of "name_of_device" use "kumquat" for xperia U, "nypon" for xperia P, "pepper" for Sola and "lotus" for Go.

Download sony's prebuilts:

Open cyanogenmod folder, press ctrl+H to show hidden files, open .repo, open local_manifests and edit roomservice.xml:

Add this line:

for cm10 -

<project name="TheMuppets/proprietary_vendor_sony" path="vendor/sony" remote="github" revision="jellybean"/>

for cm9 -

<project name="TheMuppets/proprietary_vendor_sony" path="vendor/sony" remote="github" revision="ics"/>

At the end of the file, but BEFORE </manifest>. Save and exit. Then sync the repos again:

repo sync

3) BUILD THE ROM:

. build/envsetup.sh && brunch name_of_device

Where "name_of_device" is again "kumquat" for xperia U, "nypon" for xperia P, "pepper" for Sola and "lotus" for Go.

It will take some time (on my pc with 3GHz dual core and 4gb of ram about 2h30min)

If everything goes right the flashable zip of the rom will be in cyanogenmod/out/target/product/name_of_device/cm-10-XXXXXXXXX-UNOFFICIAL-name_of_device.zip :D

4) Install the rom on your phone!

-------------------------------------------------------------------------------------------------------------

Some other tips:

When you want to download latest fxp/cm changes open a new terminal and type:

cd cyanogenmod
repo sync

When you want to delete the build products (because something has gone wrong or you want to make a new build):

make clean

Then:

. build/envsetup.sh && brunch name_of_device

To start building again.