[XPERIA X10 Android Development] x10forevers:
First of all, let me clear myself what I am describing here is a simplified version is what Google provided in their Building Android from Source, So I am not taking any copyright issue or anything you are going to do with this guide. U can use this guide and make a ROM. And if you think it's worthwhile to give credit to this thread, give link to this thread. I don't mind if you don't give credit to this thread, atleast you are making better android development.

What is this thread for?​

- This is the thread which will guide you about how to setup environment for building an android from source. Feel free to ask question regarding it. You also can copy paste your error (if it’s short) or attach log cat (weather in .text file or from pastebin). I will try to solve any many errors as I can, but come on I CANNOT solve every errors you ran into.

Requirement​

- Though this thread is noob friendly, for sure you require basic computer knowledge especially regarding Ubuntu setup and basic command prompt.

- You should have install Ubuntu 64-bit version (32-bit version is not supported) to your computer either in virtual machine or as separate Operating System.

- For Ubuntu you require minimum 80 GB of space to compile a single build from source.

- I think I made myself clear about requirements.

- This might not build fully working ROM and you may have to do some changes according to it.

Disclaimers​

I am not responsible for any broken PCs or damaged hard drive or anything unexpected and unfortunate happen to your computer or to your device. You are doing everything by knowing all the risks, so don’t blame on me about anything.

INDEX of Topics I am describing here ​

Post – 1: Setting up build environment

Post – 2: Install and Initialise repo

Post – 3: Setup device for specific build

Post – 4: Device specific vendor changes

Post - 5: Repo optimization and speed up build environment

Post – 6: reserve for future use

Post – 7: reserve for future use.

Now, Let’s start with real stuff …..

1A. Install JDK 6​

sudo apt-get install openjdk-6-jdk

1B. Install python​

sudo apt-get install python

1C. Install git-core​

sudo apt-get install git-core

1D. Install android SDK​

- Download it: http://developer.android.com/sdk/index.html

- Extract it to your home directory and rename it to android-sdk

- At home press ctrl+h to see hidden files and folder

- Open .bashrc file with text editor

- Add following lines at the end of it

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

- Go to your home folder and open .profile file with text editor

- Add following lines at the bottom of that page

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

- Now you have successfully install android-SDK

- To check its installed correctly, open a new Terminal and type

android

- It will open a window with android-sdk

1E: Install required packages​

- For all Ubuntu

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 xsltproc

- On Ubuntu 10.10

sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so

- On Ubuntu 11.10

sudo apt-get install libx11-dev:i386

- On Ubuntu 12.04 & 12.10

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

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

- On Ubuntu 13.04

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

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

1F: Configure USB ​

- create 51-android.rules

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

- It will open up an empty file names 51-android.rules, copy paste all of following in that file, save it and close

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

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

- After that issue following command to make it executable when it is necessary

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

This is done for the part of setting up building environment.

Now go to next post​