[Sony Xperia E3] MasterDomino:
Hello guys,

Soo there was thread made by Vynikal but its some kind of dead and outdated for cm 12.1, i managed to make everything work on my pc and want to help everyone who has problems with building CM12.1 for Flamingo.

ATTENTION!:I or xda-dev are not responsible for any damage to your device,eyes or life, made by hapiness of having cm12.1 built

Requirements:

-Ubuntu 64bit: Tuto

-Stable internet connection, no mobile connection(its not stable enough)

-About 100GB of disk space(if you screw something up you will have some in reserve)

-All fastboot,flashboot and adb drivers installed

-Beefy pc

Lets begin:​

We will start with preparations

Lets install JDK.

sudo apt-get update

then:

sudo apt-get install openjdk-7-jdk

Now you will need to install build packages, they are needed for building CyanogenMod.

Type this in terminal:

sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-7-jdk openjdk-7-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

You will also need USB access for extracting blobs.

sudo nautilus

This will open file manager as root.

Now you must go through several steps:

1.Click Computer in the left tray of file manager - you will see some folders like: etc

2.Open Folders etc/udev/rules.d/

3.Create new document and name it: 51-android.rules

4.You can close file manager now.

If you done that 4 steps now we can continue. lets fill up that file.

Copy paste that command to console:

wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules

and change <username> to your ubuntu username. in my case it will look like this:

wget -S -O - http://source.android.com/source/51-android.rules | sed "s/dominik/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules

Now we need to create some directories:

mkdir -p ~/bin
mkdir -p ~/android/system

Last thing before loong downloading - repo command:

In terminal type:

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Now you will need to open .bashrc with gedit its in home (you will see it if you enable Show hidden files or CTRL+H)

add that at the end of file:

export PATH=~/bin:$PATH

Now open .profile with gedit same as .bashrc its in default direction

paste this code to that file:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

Initializing the repo:​

Type in terminal:

cd ~/android/system
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1

Finally add local_manifest directory and copy-paste file included in attachment(thanks almighty Vynikal)

Code:

mkdir -p ~/android/system/.repo/local_manifests

And dont-click-the-red-button like command:

repo sync

And one more command to repair some duplicates in sepolicy

cd external/sepolicy
git revert 79ff523ac99b339914ccaa754e068072d64da542

Now i have Good and Bad news:

Good: we've done with the preparations.

Bad: this is not the end :silly:

Exporting blobs:​

Its kinda tricky now, you will need hiper super duper stock rom and USB debugging toggled on + you need to connect your device to ubuntu, just go to devices/usb and chose your phone (its up in the vm tray)

First make sure that you allowed usb debugging(that window that will pop up in phone)

Once again open .profile and copy-paste this:

if [ -d "<path-to-sdk>/platform-tools" ] ; then
PATH="<path-to-sdk>/platform-tools:$PATH"
fi

And run that command in terminal to install adb and fastboot drivers.

sudo apt-get install android-tools-adb android-tools-fastboot

Now enter that commands in terminal:

cd ~/android/system/device/sony/flamingo
./extract-files.sh

Setting up and preparing our files to building

cd ~/android/system
. build/envsetup.sh
breakfast flamingo

Build

brunch flamingo

============================================+#@#+============================================

Thanks to:

-@Vynikal for creating his tuto for cm12 and manifests

-visi0nary He helped me the most with several problems that we will fix in next post

-Others that i forgot sorry and send me PM (will add you)

pc:

i5 4460

2x g.skill ripjawsx cl7 1600mhz 4gb

took about 2h with ccache