[Galaxy Grand Duos i9082 General] ##W4TCH0UT##:
Hi guys!

I wrote this guide because after a few month of kernel development i found useful tools and tricks than helped me a lot and speeded up my work and i want to share with you this knowledge.

Setup computer and download sources​

Minumum reqirement:
* C knowledge
* Ubuntu 12.04 or higher, 32 bit or 64 bit (13.10 if you want use Kdevelop + linux kernel plugin)
* Internet connection, possibly fast and unlimited
* the boot.img of the ROM you want to support with your kernel (AOSP, SENSE etc etc...)
* [URL="http://xdaforums.com/showthread.php?t=2519416"]zImage switcher[/URL]

NOTE:

Some toolchains dont work on 32 bit. Using 64 bit is recommended.

Install required package:

Linux 12.04;

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal

linux 13.10(and above):

sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal

and restart your PC.

Download Source:

Go to /home/, create a new folder called "kernel", and enter in that folder.

right click somewhere in "kernel" folder and select "open terminal here" (CooL AH?)

and run

git clone https://github.com/pawitp/android_kernel_samsung_i9082.git -b cm-11.0

Download the toolchain

There are a lot of toolchain, stock, linaro optimized, based on gcc 4.7, based on gcc 4.8 the choice is yours! in this tutorial we use google gcc 4.8 toolchain.

NOTE:

this toolchain below will not work with 32 bit. Use the arm-eabi-4.4.3, from the ndk toolchains, and if you need any help on its path, or anything, reply in this thread.

Go to /home/, create a new folder called "toolchains", and enter in that folder.

right click -> open terminal here

git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8

Build the kernel​

Build the kernel:

in this part we will work in "/home//kernel/android_kernel_samsung_i9082" folder, i'll call it

go to "/arch/arm/configs" and copy "cyanogenmod_i9082_defconfig" to

rename cyanogenmod_i9082_defconfig to ".config"

open a terminal window in

type:

make ARCH=arm CROSS_COMPILE=/home/toolchains/arm-eabi-4.8/bin/arm-eabi- > compileLog

and the compilation will start.

Some explanation:

Pack the kernel to boot.img:

Unpack zImage switcher somewhere, i'll call that folder .(for 32 bit, download both 64 bit and 32 bit and copy the files "mkbootfs" "mkbootimg" from tools folder of 32 bit one and replace these files with the files in tools folder of 64 bit one)

copy the stock boot.img and your zImage in the folder , you can find it in /arch/arm/boot.

run the script

./repack.sh

now in there's a new file called newBoot.img, that's your kernel!

to find the modules (*.ko files) open a teminal windows to and type

find ./ -name "*.ko" -exec cp {} <absolute/path/destination/folder> \;

now you have the boot.img and the modules, download a custom kernel and use the flashable zip to make your flashable zip, just replace the modules and the boot.img!

Add features​

Add features to kernel:

"Woah! i'd like to add smartass v2 governor and sio i/o scheduler to my kernel"

First you need to find a git repository that contains smartass v2 governor and sio i/o scheduler, then the commit that added the governor and sio i/o scheduler.

for example https://github.com/akiratoriyama/an...mmit/6a43329a08ec0282e951049ae15a497b121aa8ef

Open a terminal window in

type:

git remote add akiratoriyama https://github.com/akiratoriyama/android_kernel_samsung_i9082.git -b experimental
git fetch akiratoriyama
git cherry-pick 6a43329a08ec0282e951049ae15a497b121aa8ef

NOTE:

I have used akiratoriyama's github as reference. If you want to add any other features,like f2fs or frandom module, you can ask the dev to help you or you can simply cherry-pick the code. Remember to thank everyone you borrowed the code from and mention them in your thread, whenever you release your kernel.

in termial window type:

make ARCH=arm xconfig

will open a new window where you can configure your kernel's features

press ctrl+f (find) and serach for "smartass2" and "sio" and tick the checkbox. save clicking the floppy disk in upper left corner.

the modified configuration file will be saved in ".config"

now we can build the kernel again, but first type

make ARCH=arm clean CROSS_COMPILE=/home/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi-

this will remove all the compiled files of previous build.

View git commits history​

you can easly view all the commits in your repo:

open a terminal window in and type

gitk

will open a GUI where you can see all the commits, what files were modified for each commit, the author of the commit.

you can also revert commits.

There are other GUI for git, i also like "gitg"

Hacking the kernel

suggested by [MENTION=2351000]pirlano[/MENTION]​

for easy work on kernel sources, add features & co. you can use kdevelop + linux kernel plugin, here is a guide

http://www.gnurou.org/code/kdevelop-kernel

and a video guide:

http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop

NOTE: for linux kernel plugin ubuntu 13.10 is required

CREDITS:

[MENTION=4487443]rmbq[/MENTION], this is his guide. I just modified and compiled it especially for our device. Thanks,rmbq.