[XPERIA X8 General] eagleeyetom:
Hello everybody. After many attempts to build a ROM I decided to share my knowledge with you :)

I'm going to show you how to build CM7 for X8 using official CM sources.

As the result you will have:

CyanogenMod in version 2.3.7 for X8 aka Shakira. You need to have unlocked bootloader and flash FXP kernel to use this ROM.

WARNING: This may brick your device. You have been warned!

What are the requirements?

0. A smart head, and being willing to learn something new.

1. A PC featuring a dual-core CPU (the more, the merrier) and at least 1.5GB RAM. Having a CPU that supports 64-Bit Mode (Intel EM64T / AMD64) and Paravirtualization (Intel VT-x / AMD-V) is required if you are planning to run a 64-Bit distribution.

2. A Linux based system such as Ubuntu or Linux Mint. My guide should work on any other Ubuntu based distribution as well, though you need to adapt commands in case you're running a RPM based Red Hat/Fedora/openSUSE distribution. To make things easier if your main OS is Windows you better consider using Linux in a Virtual Machine (VirtualBox recommended).

3. Speedy internet connection so the download of the CyangogenMod sources don't take forever.

4. About 50GB of FREE disk space.

5. Ability to access to Internet in Linux / your Virtual Machine so you can access Google and XDA to search for help, because everything that can go wrong will go wrong ;P

Shall we dance? :)

1. Download and install Linux. Linux is perfectly legal free opensource software; you won't go to jail for downloading it. I prefer Ubuntu 10.10 or Linux Mint 10 (which I'm using). The best choice is to use the respective 64-Bit edition. You may find links in next post.

2. There is a tool called "Terminal" - it's your new best friend. Create a shortcut in desktop.

How Linux look like

Just like Windows, but better ;)

Paste this into terminal:

For Ubuntu below 11.04 use this:

sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib

NOTE: As for Ubuntu 11.04+ (also applies to Linux Mint 11+) see what Novek posted in the CMCompiler thread.

lib32readline5-dev has been replaced by lib32readline-gplv2-dev on 11.10

And "gcc-4.3-multilib g++-4.3-multilib" aren't used from 11.04 and up - not needed, so use this code:

sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev

You may want to add that piece of intel.

This will install required packages. If you'll receive errors try to delete packages from above code.

After this you'll need to create folders for CM repo.

Type:

mkdir -p ~/bin
mkdir -p ~/android/system
PATH=~/bin:$PATH

You could name second folder as you want.

Next step: Repo installation

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

chmod is a very important command. It's allows you to give permissions for specific files/folders.

Next step: Downloading the beast ;)

Remember to type correct folder name!

cd ~/android/system/
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync -j10

-j attribute is responsible for number of processes taken in single action. If you have powerful PC you could use -j16 or even -j32. Bigger number - quicker extraction of files.

Get the ROM Manager just in case;)

~/android/system/vendor/cyanogen/get-rommanager

Next step: Download Android-SDK to make ADB work

Extract this to home directory, then

cd ~/android-sdk-linux/tools
./android

Just do what is shown in this movies:

[YOUTUBE]dfdpYFMax8M[/YOUTUBE] [YOUTUBE]-qBpoEf1XYE[/YOUTUBE]

Download all files and get ready.

Next step: Copy proprietary files

(you need to have phone connected in debugging mode) - For proprietary files use stock ROM or official CM 7.1.

Type in terminal:

cd ~/android/system/device/semc/shakira/
./extract-files.sh

If you have problems copy adb file to this directory and edit extract-files.sh to have something like this:

./adb pull instead of adb pull

If you have troubles do this:

After installation open terminal and type:

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

Put correct path to your adb.

Type

./adb devices

if you'll receive such line

"List of devices attached
???????????? no permissions"

do specific thing.

sudo touch /etc/udev/rules.d/51-android.rules && sudo sh -c "echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", SYSFS{idProduct}=="612e", MODE="0666"' >> /etc/udev/rules.d/51-android.rules" && sudo chmod 644 /etc/udev/rules.d/51-android.rules

If something goes wrong type

lsusb

to see which devices are connected and change code.

Then

sudo restart udev
sudo ./adb kill-server
sudo ./adb start-server

And it's ready to action.

Next step: Setting build environment

Type in terminal:

cd ~/android/system/
. build/envsetup.sh && breakfast shakira

You'll see the list of CM devices

Shakira is number 136 (right now is #144) - It won't work due to changes in CM device tree.

So use:

lunch cyanogen_shakira-eng
or
breakfast shakira

Next: Step - build!

All you need to do right now is type magic command "make"

Add -j4 to make it much quicker

To obtain update.zip file type

make -j4 bacon

Now wait patiently and fight errors :)

I'm glad if I helped somebody to build his/her first ROM.

If I made any mistakes feel free to correct me.

Thanks to B.Jay for help.

I spent some time to write this, so hit thanks button ;)

You can also donate me. All donations are highly appreciated :beer: ;)