[Xperia Arc Android Development] championswimmer:
I'd like to give a quick rundown on how to compile AOKP from sources for all Xperia devices.

The KangXperiaProject had been working for past few weeks to try to set up and maintain a buildable repo for AOKP on all Xperia phones.

The skeleton of this tutorial is taken largely from this thread

This tutorial assumes that you are using Ubuntu (prefer to use 64 bit). If you use some other Linux distro then there might be minor changes in the way the environment is setup. Figure that out yourself ;)

Source code is about 10GB in size. One single build will take about 8GB (10+8=18). For a full set of builds and for building for multiple devices i HIGHLY recommend more than 100 GB of free space on your harddrive.

1) You need the following:

-JDK 6 if you wish to build Ice Cream Sandwich. You can download it from java.sun.com. Or:

$ sudo apt-get install sun-java6-jdk

-Python 2.4 -- 2.7, which you can download from python.org. Or:

$ sudo apt-get install python

-Git 1.7 or newer. You can find it at git-scm.com. Or:

$ sudo apt-get install git-core

2) Install required packages. 64-bit (recommended)

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils

On newer versions of Ubuntu such as 11.10 you may need to do the following:

$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so

if you wish to use adb for debugging or logging your builds you need to perform the steps hidden below.

3) Configure your USB.

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

Inside of this blank text file insert:

#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"

#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"

#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"

#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"

[COLOR=Red]#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"[/COLOR]

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

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

4) Save the file and close it and then issue this command:

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

the line in red is most important, the other lines are not important if you are using adb only for xperia phones

5) Install the repo:

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

restart your PC or log off and log on

6) Choose work directory:

$ mkdir -p ~/android/kxp
$ cd ~/android/kxp

(the working directory could be anything you like. ~/android/kxp is an example)

7. Initialize the repo

$ repo init -u https://github.com/KangXperiaProject/platform_manifest.git -b jb

NOTE : to compile for ICS, use "-b ics" instead of "-b jb"

Only JB is maintained actively now. ICS repos are buildable but not anymore maintained.

7) When prompted, enter your real name and email address.

8) Gather the files:

Code:

$ repo sync -j1

if you have fast internet, you can use -j8 or -j16 for faster sync

total source will be around 10GB in size. please be patient

9) Compiling:

after complete sync

create the environment

$ . build/envsetup.sh

now choose your device

$ lunch

pick your device according to the following list

Arc/ArcS aokp_anzu-userdebug
Ray aokp_urushi-userdebug
Neo aokp_haida-userdebug
Neo(V) aokp_hallon-userdebug
Pro aokp_iyokan-userdebug
Play aokp_zeus-userdebug
Play(CDMA) aokp_zeusc-userdebug
Live with Walkman aokp_coconut-userdebug
Mini aokp_smultron-userdebug
Mini Pro aokp_mango-userdebug
Active aokp_satsuma-userdebug
X10 aokp_es-userdebug09ra-userdebug
X8 aokp_shakira-userdebug
X10 MiniPro aokp_robyn-userdebug
X10 Mini aokp_mimmi-userdebug
S aokp_nozomi-userdebug

Now start the build process

mka -j4 otapackage

yes it's "mka" not "make"

you can obviously use make instead of mka but mka is faster and optimized specially for android building.

NOTE: the -j# number should be double the number of cores of your CPU (the CPU of the PC on which you are building)

Thus if you are on a quad core build machine use -j8

If compilation (i.e. the last step) takes too much time for your comfort, you can see this article written by cyanogenmod devs Koush and aremcee to make compile time less :)

After everybuild, we need to clean the directory... do it like this

cd ~/android/kxp
make clobber

("make clean" also works)

Before next build, sync repo again to get latest changes

repo sync -j2

Now build again

. build/envsetup.sh
lunch

mka -j4 otapackage