[Sony Xperia P, U, Sola, Go] Xperia_Modder:
Hello guys

I saw that the other guide on how to build from sources is outdated, so I tought “why don't write another one more updated?”, and here we go!

-Warning-

Always use latest Ubuntu/Fedora and always use 64bit

Like DroidModderXtreme said don't make other cm10.2, wait more stable nightly

Guide contenent:

1. Setup build enviroment - Ubuntu & Fedora

2. Download & compile CM 9/10 sources

3. Download & compile CM 10.1/10.2 sources

4. Final statement

1. Setup build enviroment - Ubuntu & Fedora

install dependencies:

Ubuntu:

sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 libssl-dev

Fedora

sudo yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686
ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686 install git
gnupg gnupg2 flex flex-devel bison bison-devel gperf gcc gcc-c++ make
automake kernel-devel zip curl zlib zlib-devel glibc glibc-devel ncurses
ncurses-devel xulrunner xulrunner-devel libX11 libX11-common libX11-devel
xorg-x11-proto-devel readline readline-devel mesa-libGL mesa-libGL-devel
mesa-libGLU python-markdown libxml2 libxml2-devel libxslt libxslt-devel
perl perl-devel perl-Switch SDL SDL-devel wxGTK wxGTK-devel squashfs-tools
pngcrush schedtool

type this:

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

configure usb:

gksudo gedit /etc/udev/rules.d/51-android.rules

add these lines, save and exit:

#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"

#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"

#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"

#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"

#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"

#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"

#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"

#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"

#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"

#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"

#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"

#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"

#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"

#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"

#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"

#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"

#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"

#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"

#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"

#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"

#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"

#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"

set right permission:

sudo chmod a+r /etc/udev/rules.d/51-android.rules

--Java for Ubuntu--------------------------------------------------------------------------------------------

remove openJDK:

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

add java PPA

sudo add-apt-repository ppa:webupd8team/java

download and install it:

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

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

--Java for Fedora--------------------------------------------------------------------------------------------

download java JDK 6 x64-rpm.bin

[URL="http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR"]CLICK[/URL]

install it (change ## with your version)

chmod +x /path/to/file/jdk-##-linux-*-rpm.bin && /path/to/binary/jdk-##-linux-*-rpm.bin

swap to oracle JDK with:

alternatives --config java

edit profile, save and close it (change ## with your version):

## export JAVA_HOME JDK ##

export JAVA_HOME="/usr/java/jdk1.6.0_##"

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

download android SDK:

[URL="CLICK"]CLICK[/URL]

place it in home/android and edit bashrc:

gksudo gedit .bashrc

add this, save and exit:

# Android tools
export PATH=${PATH}:~/android/android-sdk-linux/tools
export PATH=${PATH}:~/android/android-sdk-linux/platform-tools
export PATH=${PATH}:~/bin

edit profile:

gksudo gedit .profile

add this PATH, save and exit:

PATH="$HOME/android/android-sdk-linux/tools:$HOME/android/android-sdk-linux/platform-tools:$PATH"

install the REPO:

mkdir ~/bin && PATH=~/bin:$PATH && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo

2. Download & compile CM 9/10 sources

-change ## with your cm version

mkdir ~/android/cm##
cd ~/android/cm##

initialize the repo:

cm10

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

cm9

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

edit your manifest:

gksudo gedit ~/android/cm##/.repo/manifest.xml

add sony prebuilts, save and exit:

cm10

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

cm9

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

download with:

repo sync

download prebuilts:

cd ~/android/cm##/vendor/cm && . get-prebuilts

. build/envsetup.sh && brunch kumquat

to delete your build product do:

mka clobber

3. Download & compile CM 10.1/10.2 sources

-change ## with your cm version

mkdir ~/android/cm##
cd ~/android/cm##

initialize the repo:

cm10.1

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

cm10.2

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

edit your manifest:

gksudo gedit ~/android/cm##/.repo/manifest.xml

add sony prebuilts, save and exit:

cm10.1

<!--Xperia U-->

<project path="kernel/sony/u8500" name="munjeni/android_kernel_xperiago" remote="github" revision="jb-dev" />
<project path="vendor/sony" name="percy-g2/proprietary_vendor_Sony-u8500" remote="github" revision="cm-10.1" />
<project path="device/sony/montblanc-common" name="Legacy-Xperia/android_device_sony_montblanc-common" remote="github" revision="cm10.1" />
<project path="device/sony/kumquat" name="Gava97/android_device_sony_kumquat" remote="github" revision="cm10.1" />
<project path="hardware/semc/dash" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="jellybean" />

<!--Custom Repo-->

<project path="frameworks/av" name="Legacy-Xperia/android_frameworks_av" remote="github" revision="cm-10.1" />
<project path="frameworks/native" name="Legacy-Xperia/android_frameworks_native" remote="github" revision="cm-10.1" />
<project path="hardware/libhardware" name="Legacy-Xperia/android_hardware_libhardware" remote="github" revision="cm-10.1" />
<project path="hardware/libhardware_legacy" name="Legacy-Xperia/android_hardware_libhardware_legacy" remote="github" revision="cm-10.1" />
<project path="system/core" name="Legacy-Xperia/android_system_core" />
<project path="bootable/recovery" name="DevSwift/android_bootable_recovery-1" remote="github" revision="cm-10.1" />

cm10.2

<!--Xperia U-->

<project path="kernel/sony/u8500" name="munjeni/android_kernel_xperiago" remote="github" revision="jb-dev" />
<project path="device/sony/kumquat" name="XperiaNovathor/android_device_sony_kumquat" remote="github" revision="master" />
<project path="vendor/sony" name="Andrewas/proprietary_vendor_sony" remote="github" revision="master" />
<project path="hardware/semc" name="munjeni/aosp_4.3_hardware_semc" remote="github" revision="master" />

delete these lines only for cm 10.1

<project path="frameworks/av" name="CyanogenMod/android_frameworks_av" remote="github" revision="cm-10.1" />
<project path="frameworks/native" name="CyanogenMod/android_frameworks_native" remote="github" revision="cm-10.1" />
<project path="hardware/libhardware" name="CyanogenMod/android_hardware_libhardware" remote="github" revision="cm-10.1" />
<project path="hardware/libhardware_legacy" name="CyanogenMod/android_hardware_libhardware_legacy" remote="github" revision="cm-10.1" />
<project path="system/core" name="CyanogenMod/android_system_core" />
<project path="bootable/recovery" name="CyanogenMod/android_bootable_recovery" remote="github" revision="cm-10.1" />

download with:

repo sync

download prebuilts:

cd ~/android/cm##/vendor/cm && . get-prebuilts

do this only for cm10.2

patch -p1 < device/sony/kumquat/patches/external_bluetooth_bluedroid.patch
patch -p1 < device/sony/kumquat/patches/framework_av.patch
patch -p1 < device/sony/kumquat/patches/framework_native.patch
patch -p1 < device/sony/kumquat/patches/hardware_libhardware.patch
patch -p1 < device/sony/kumquat/patches/hardware_libhardware_legacy.patch
patch -p1 < device/sony/kumquat/patches/system_netd.patch
patch -p1 < device/sony/kumquat/patches/system_core.patch

. build/envsetup.sh && brunch kumquat

to delete your build product do:

mka clobber

4. Final Statement

This is a WIP, so if you have idea, suggestion, spot errors... fell free to post/pm me them

Thanks goes to [MENTION=4499881]elia222[/MENTION], [MENTION=5338729]Gava97[/MENTION], [MENTION=5264432]DroidModderXtreme[/MENTION], [MENTION=4913184]percy_g2[/MENTION], [MENTION=4120742]munjeni[/MENTION], Legacy-Xperia and Cyanogenmod, [MENTION=5092285]Andrewasth[/MENTION]