[Galaxy Y GT-S5360 General] dhruvpandit:
hey amal, use

etc [/code*] like this
it will help users.
BTW, very good HOW TO, will try it soon.

Hi guys,
This guide teaches how to make a new kernel for your device, it works in most of the cases but doesnt mean it will work for everyone
You need a minimal linux experice to know WTF you are doing
If you have any questions, post Belloowww
Download the required files
You will need a linux machine with the basic development tools or a virtualbox machine running a linux distribution (ubuntu 64bits will do fine)
I use the codesourcery package
Download the IA32 GNU/Linux TAR
The tar package is the easier to install
You will also need your kernel source from your manufacturer, for samsung the sources are available here

Install the cross compiler
Enter the folder were you downloaded the package and extract it, you will get something like arm-2011.03
Move that folder to some location, i use opt
ex:
[CODE]mv arm-2011.03 /opt/

or

sudo mv arm-2011.03 /opt

Done!

Extract and prepare the kernel sources

I will use the samsung sources as example, but anything can be used

For the samsung sources, after you extract the zip, you will get something like DEVICE_Platform.tar and DEVICE_Kernel.tar.gz

Extract the kernel:

tar zxvf DEVICE_Kernel.tar.gz

Enter the kernel folder and list the folder contents

ls

The structure is something like this:

Most devices contain the config file inside the device

You can extract it like this:

adb shell
su
cp /proc/config.gz /sdcard/
exit
exit
adb pull /sdcard/config.gz

Good, now we have the sources, compiler and configuration

Compiling the kernel

To compile ther kernel, i usually clean the sources first, with this i know for sure nothing will go wrong (usually )

make ARCH=arm CROSS_COMPILE=/opt/arm-2011.03/bin/arm-none-eabi- distclean

(Remember to replace acordingly the compiler folder)

Sources cleaned, time to load the config file

gunzip config.gz
cp config ./.config

Good, now lets check the

menuconfig

(menuconfig is a menu to choose the kernel options, created to make it easy to select)

make ARCH=arm CROSS_COMPILE=/opt/arm-2011.03/bin/arm-none-eabi- menuconfig

Change whatever you want and exit and save

good, now its time to build

make ARCH=arm CROSS_COMPILE=/opt/arm-2011.03/bin/arm-none-eabi- -j2

Now wait for it to finish!

Your compiled kernel will be located inside arch/arm/boot/zImage

Extracting a boot.img

Good, now we have the zImage, but WTF to do with it?

Well, android usually (some samsung devices use a different boot.img method, ex: I9000) has the boot.img, inside of it we contain:

- ramdisk (required files to load the /system partition and continue the boot sequence)

- zImage (our kernel)

- pagesize

- base

- cmdline (some kernel paremetes used on boot)

To create your own boot.img, you need one from a nandroid backup that was made from CWM or AmonRA custom recoveries (there are other methods, but for those use the madteam forum )

The boot.img is located inside your /sdcard/clockworkmod/backup/somedate/boot.img

You will also need the unpackbootimg and mkbootimg binaries, i this link there is the 64 bit version (wont work on 32 bit linux)

create an empty folder, copy the downloaded file inside, enter it and do:

tar zxvf bootimgtools.tar.gz
chmod 755 *

now copy the boot.img you got from the backup

and extract the boot.img with:

./unpackbootimg -i boot.img

this will create the files as explained above

Creating the boot.img

Before making the boot.img, we need some information from the files extracted

cat boot.img-base ( save the output #1)
cat boot.img-pagesize (save the output , place the value inside the Hex Value of this site, and copy the decimal value and save it #2)
cat boot.img-cmdline (save the output #3)

Good, now copy the compiled kernel (zImage) inside the current folder and do:

mkbootimg –kernel zImage –ramdisk boot.img-ramdisk.gz –cmdline “(replace with output#3)” –base (replace withoutput #1) –pagesize (replace with output#2) -o /tmp/boot.img

Good, the boot.img is created!

Now test on your device!

If you dont know how to flash the boot.img, enter the madteam forum and request help (its too difficult to explain the flashing of boot.img if you dont know how to do it )

Take care!