[Sony Xperia E3] vinay:
This guide is focused on xperia e3 but for other devices process will be simler too.

This guide is not in good shape now i will keep improving it and making it easier and better.

if xperia e3 don,t have too many developers then become one.

Requirements

linux os. -recommended ubuntu 14.04 LTS

(you can install ubuntu on virtualbox or dual boot ubuntu with windows)

cross compiler tool chain -recomended Linaro GCC 4.9.3 optimized for arm-cortex_a7

kernel source code. download it from sony or you can compile my nitrogen kernel only if you have D2212/02 recomended.

unlocked bootloader

tools for building boot.img Download HERE

Sony Kernel

D2202/12 DOWNLOAD

D2203/06/43 DOWNLOAD

Nitrogen Kernel

D2202/12/03/06/43 DOWNLOAD

config for lte varriants is not uploaded but u may find it in your device /proc/config.gz

extarct config from config.gz and rename it to Nitrogen_lte_defconfig and put it in

<kernel source folder>/arch/arm/config/<here>

Setting up Environment in Ubuntu.

boot up ubuntu and open Home directory.

create two new folder.

one with name "toolchain"

one with name "build"

now extract your toolchain to toolchain folder it must contain these folders

arm-cortex_a7-linux-gnueabihf
bin
include
lib
libexec
share

(depends on toolchain you have)

Extracting Nitrogen source code

if you downloaded zip then extract that zip home dir.

then rename flamingo-kernel folder to kernel

else you can use these commands

sudo apt-get update
sudo apt-get install git

then

git clone https://github.com/vinay94185vinay/Flamingo-kernel.git

after that rename flamingo kernel to kernel.

How to extract sony source code

open terminal type

tar -xjvf

then drag n drop source code file

then hit enter. (it will extract files in home firectory)

open your firmware number folder. eg: 18.5.C.0.19

delete extarnal folder then move/copy "kernel" folder to home dir.

and then extract build tools to build folder.

Compiling.

open an terminal (CTRL+ALT+T) and type

cd Kernel

(this will change directory to kernel folder.)

then type

export CROSS_COMPILE=[COLOR="Green"]~/toolchain/bin/[/COLOR][COLOR="Red"]arm-cortex_a7-linux-gnueabihf-[/COLOR]

(red line depend on tool chain and green line on it,s location)

how to find correct red line for toolchain.

open toolchain folder

then bin

in my case it contains files like

arm-cortex_a7-linux-gnueabihf-addr2line

arm-cortex_a7-linux-gnueabihf-ar

arm-cortex_a7-linux-gnueabihf-as

see all files contains that red line.

now you must understood how to know that line.

for sony kernel source code type

For D2202 and D2212

make [COLOR="Red"]ARCH=arm CROSS_COMPILE=$CROSS_COMPILE[/COLOR] [COLOR="Green"]arima_8226ds_dp_defconfig[/COLOR]

For D2203 and D2206 and D2243

make [COLOR="Red"]ARCH=arm CROSS_COMPILE=$CROSS_COMPILE[/COLOR] [COLOR="Green"]arima_8926ss_dp_defconfig[/COLOR]

"RED" line make sure that you compile kernel for arm based cpu that is in your android device

if you remove this line you will end up making a kernel for your pc.

"GREEN" is to load an preset default configuration for compiling kernel

it contains what thing,s has to be compiled in this kernel.

for nitrogen kernel source code type

D2202 and D2212

make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_defconfig

D2203 and D2206 and D2243

make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_lte_defconfig

Now type for dualcore cpu

make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE [COLOR="red"]-j3[/COLOR]

"red" -j3 tell,s compiler to make 3 job,s which is good for intel dual core cpu.

if you have dual core amd cpu it should be better for you to have 2 job,s mean -j2

and -j4 for quard core.

for quard core cpu

make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j5

(do it like this cores + 1)

now wait for untill your kernel get compiled.

it may take long time. depend on how fast and how many cores your cpu have.

if you don,t get any error then

you have compiled your kernel :good:.

building boot.img

copy zimage from kernel/arch/arm/boot folder.

to build/msm8226_flamingo/<zimage>

now in msm8226_flamingo folder.

open new_stock_files/<according to your device>/

copy ramdisk. and dt.img to msm8226_flamingo folder.

now open terminal (CTRL+ALT+T) and type

cd build/msm8226_flamingo/

then

./makeit.sh

(don,t forget dot.)

now you can see boot.img in build/msm8226_flamingo folder.

now you can flash boot.img with fastboot or flashtool.

feel free to ask if you don,t understand or have error in any step.