[XPERIA X10 Q&A, Help & Troubleshooting] aZuZu:
1) You need the following:

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

Or:

Code:

$ sudo add-apt-repository ppa:fkrull/deadsnakes

$ sudo apt-get update

$ sudo apt-get install python2.5

-JDK 6 if you wish to build Gingerbread or newer

or

-JDK 5 for Froyo or older.

You can download both from java.sun.com.

Or:

Code:

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

$ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"

$ sudo apt-get update

$ sudo apt-get install sun-java6-jdk-

Git 1.5.4 or newer. You can find it at git-scm.com.

Or:

Code:

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install git-core-(optional) Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.

Download from valgrind.org.

Or:

Code:

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install valgrind

2) Install required packages.

Code:

$ 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

3) Download the repo:

Code:

$ mkdir ~/bin

$ PATH=~/bin:$PATH

$ curl http://android.git.kernel.org/repo > ~/bin/repo

$ chmod a+x ~/bin/repo6) Initialize the repo:

Code:

$ mkdir WORKING_DIRECTORY

$ cd WORKING_DIRECTORYF

or master branch:

Code:

$ repo init -u git://android.git.kernel.org/platform/manifest.git

For specific branch other than Gingerbread you would put in Donut, Eclair, Froyo, or Gingerbread where it currently says "gingerbread" without the parenthesis:

Code:

$ repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread

4) When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.

5) Gather the files:

Code:

$ repo sync

6) Verify and insert public key block:

Code:

$ gpg --import

Code:

-----BEGIN PGP PUBLIC KEY BLOCK-----

Version: G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nczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71 MnrF6fj+Udtb5+

OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M

pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDg pqt7Y7s

KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb

N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior 6b8LrZrAhkqDjA

vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmU tkBszwo

G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ

hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+Bmr EOeCUOAJ9qmR0l

EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KL M=

=Wi5D

-----END PGP PUBLIC KEY BLOCK-----

7) After copying and pasting the public key block press Crtl+D to end the input.

8) Compiling:

Code:

$ source build/envsetup.sh

Or:

Code:

$ . build/envsetup.sh

9) Issue:

Code:

$ lunch

10) Pick your poison.

11) Now issue:

Code:

$ make

12) Now just cross your fingers and hope it all works out!

13) Issue this command to create a flashable zip:

Code:

$ make otapackage

Or if you want to test on an emulator:

Code:

$ emulator

15) If all went well you can either run your build on an emulator or flash it on a device.

Code:

Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for.

~How To Add A Device To The List~

1) Find the github for your device you wish to add. (For me it is the HTC Hero CDMA)

2) Now navigate to the location you are going clone the device tree to:

Code:

$ cd WORKING_DIRECTORY/device/htc3) Clone the github device tree from remote to local: (The heroc would be whatever you want that folder to be named so make sure it is whatever standard name would be for your device, example: Nexus One [Passion], Nexus S [Crespo], Motorola Droid [Sholes], HTC Incredible [Inc], etc.)

Code:

git clone git://github.com/wjb/android_device_htc_heroc.git -b gingerbread heroc

3) Now navigate into the folder:

Code:

$ cd heroc

4) Setup Device Specific Make Files:

Code:

$ ./setup-makefiles.sh

5) Prepare To Copy Device Proprietary Files To Vendor Tree:

Code:

$ cd prebuilt

6) Copy Proprietary Files To Vendor Tree:

Code:

$ cp -r proprietary WORKING_DIRECTORY/vendor/htc/heroc

7) Navigate back to your home directory for building:

Code:

$ cd ~/WORKING_DIRECTORY

8) Prepare To Compile:

Code:

$ source build/envsetup.sh

Or:

Code:

$ . build/envsetup.sh

9) Get your list of devices:

Code:

$ lunch

10) Pick your poison.

11) Now compile:

Code:

$ make

Or if you want a flashable zip:

Code:

$ make otapackage

Compiling kernel:

You will need sdk / ndk packages from Google:

mkdir KERNEL_DIRECTORY

cd to KERNEL_DIRECTORY

Code:

ARCH=arm CROSS_COMPILE=???/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make semc_?????_defconfig

or

Unpack config.gz to KERNEL_DIRECTORY as .config from kernel.sin --- how? Simple use hexeditor and search two times for gzip magic 1F8B08 cut all before that and you have config.gz

then

ARCH=arm CROSS_COMPILE=???/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make

Compiling invidual packages:

Code:

make [ module name ]