[LeEco Le 2 Guides, News, & Discussion] Brawn_Sg:
This is My first guide on XDA :p

From the day I owned Le2 I always wished to compile my own kernel. I searched on the web for compiling 64bit android kernel but didn't get satisfying results. So I did some research and asked some android developers, I got help from some developers but some of the developer refused may be due to their attitude or may be they didn't want to share their ideas / knowledge. So i saw some kind devs trying things out for our device.Then we created a team ,and i met really kind and expert developers there.Later leeco released the kernel sources.People claimed it was not working.But our team worked too hard to get it work.

What will you need :

1. Ubuntu 64 Bit OS

2. Good Internet Connection.

3. Basic Knowledge of Linux.

4.A little common sense

Lets Start

First we need to get some important stuff / tools / software .

1. Open Ubuntu Software center and install JDK 7 or JDK 8

2. Open terminal and run the following command

sudo apt-get install libncurses5-dev

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

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

sudo apt-get install -y ccache &&echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc &&source ~/.bashrc && echo $PATH

export USE_CCACHE=1

mkdir ~/bin

export PATH=~/bin:$PATH

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

chmod a+x ~/bin/repo

Now ur'r Linux machine is all set to compile kernel.

3. Now you need to download a toolchain.Use any 64 bit compatible toolchain .In my case i am using uber toolchain "aarch-linux-android-4.9"

create a folder kernel

now

type

cd kernel

git clone https://bitbucket.org/UBERTC/aarch64-linux-android-4.9.git

4. Time to download Kernel sources. For this tutorial I am using our team's kernel source. Here is the link for our sources > h t t p s ://github.com/s2-devs/android_kernel_leeco_msm8976

.Select branch as stock-6.0 from left and press download on the right.

5. place both this zip in "kernel" directory which we made in previous step.

6. Extract the zip in the "kernel". Now you will have two folders one of toolchain and other of kernel source.

7. Open the kernel source folder and type the following code.

9. Run the following command to point the variable to toolchains path :

in my case:

export CROSS_COMPILE=/home/Bh-singhal/kernel/aarch64-linux-android-4.9/bin/aarch64-linux-android-

If you followed along with me you will just have to change the name of the user ( replace <Bh-singhal> with <ur's username> )

10. Time to Compile your kernel :

export ARCH=arm64

make s2-perf_defconfig

The name of defconfig file may be different in future check it in "kernel/le2skernelsource/arch/arm64/defconfig/"

Now the final command make. It takes a parameter -jn. Where ( n = # of threads per core + 1 )

I have a Dual core processor with 2 thread per processor so for me it is " make -j3 ".

make -j3

Now sit back and relax.......let the kernel compile

Got a compilation error ?

Post it here.

NOW FINAL STEP

DUE TO WHICH MANY PEOPLE DID NOT GET KERNEL BOOTING

3. Open "kernel/le2kernelsource/arch/arm64/boot/".

4. Copy "Image.gz-dtb".

5. now take a stock boot.img of current firmware that u r using.

6. unpack the stock boot.img,search on google for that

7. after unpacking you will see various unpacked files of stock boot.img

delete the file named kernel.gz

and paste Image.gz-dtb there.

8.rename Image.gz-dtb to kernel.gz

9.Repack the kernel

10.u will have a newer boot.img

11. Flash it using twrp or fastboot

fastboot flash boot kernelfilename.img

all done

12.Clap for yourself and a salute from me :p

13.READ the next post for more things

Credits:

Our Team:

Brawn_Sg

Rishabh Rao

13THWARRIOR

Testers:

Lakshay Taneja (@Lakku)

Jignesh Jain (jhakjhuk1853)

Have Fun!

XDA:DevDB Information

Kernel compiling guide for le 2, Kernel for the LeEco Le 2

Contributors

Brawn_Sg, Rishabh Rao, 13THWARRIOR, sadiqdev, jhakjhuk1853 and Lakku

Source Code: https://github.com/s2-devs/android_kernel_leeco_msm8976

Kernel Special Features:

Version Information

Status: Stable

Created 2016-12-04

Last Updated 2016-12-05