[KERNEL]How to build a custom Android Kernel for your device

Search This thread
1

1chris89

Guest
From needrom.com for my device they some how built a new kernel called the "Master Lu" kernel which is better than stock. I suppose I'd have to find and speak to this "Master Lu" character. I think he is chinese and I'd have to brush up on my chinese, which is none existent. lol

Anyway so what can be done to modify the stock (modded) kernel? all I have is the boot.img-kernel...

Thanks
 

Androlover98

Senior Member
Jan 30, 2013
124
56
25
Mumbai
Help!

Sir help! I am getting this error while using backtrack 5 R3.

Code:
root@bt:~/sgy/kernel/common# make
make: /home/root/sgy/arm-2009q3/bin/arm-none-eabi-gcc: Command not found
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
/bin/sh: /home/root/sgy/arm-2009q3/bin/arm-none-eabi-gcc: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

This error is popping up even though I have a proper toolchain for arm 6 (or none) GCC.
Screenshot of arm libs -
y6ybynaz.jpg
 
Last edited:

tabenf

Senior Member
May 12, 2013
266
90
XDA
Sir help! I am getting this error while using backtrack 5 R3.

Code:
root@bt:~/sgy/kernel/common# make
make: /home/root/sgy/arm-2009q3/bin/arm-none-eabi-gcc: Command not found
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
/bin/sh: /home/root/sgy/arm-2009q3/bin/arm-none-eabi-gcc: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

This error is popping up even though I have a proper toolchain for arm 6 (or none) GCC.
Screenshot of arm libs -
y6ybynaz.jpg

Hi have u fixed this?if not can you show me the path u put in make file
 

Mr.Shahid

Member
Feb 28, 2013
13
0
How to rename the kernel

it's not working. sgy stock kernel do not have /proc/config.gz and gcc version in arm-2011.03 not compatible with other precompiled module.

this is work for me

requirement :
1. linux box 32 bit with working gcc. you can use real linux machine or virtual machine
2. Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI from http://www.codesourcery.com/ (Linux version without installer arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2)
3. mkbootimg with md5support. got it from http://xdaforums.com/showpost.php?p=22224170&postcount=241 . credit to harish2704
4. split_bootimg.pl (google it)
5. kernel source from http://opensource.samsung.com . i use GT-S5360_GB_Opensource_Update2.zip
6. stock boot.img (or from your custom kernel).

step :
1. make folder "sgy" in your home. the result is folder "/home/<yourname>/sgy". <yourname> is your linux user name, and from now replace <yourname> with your user name. put all file you already download there
2. extract "GT-S5360_Kernel.tar.gz" from "GT-S5360_GB_Opensource_Update2.zip". put also in "sgy" folder
3. open terminal emulator and go to your working path with command

Code:
cd ~/sgy

4. extract your compiler with

Code:
tar -xvf arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

5. create folder "kernel" and extract kernel source there

Code:
mkdir kernel
cd kernel
tar -xvf ../GT-S5360_Kernel.tar.gz

you got 2 folder, "common" and "modules"

6. open folder "common", there is file "Makefile". open with text editor and find line with content "/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-". replace with "/home/<yourname>/sgy/arm-2009q3/bin/arm-none-eabi-", don't forget replace <yourname>.

7. in terminal goto folder "common" and load default config for sgy

Code:
cd ~/sgy/kernel/common
make bcm21553_totoro_05_defconfig

8. if you want change you config run

Code:
make menuconfig

9. if you ready to build then run

Code:
make

or if you have dual core cpu and want to make it faster

Code:
make -j3

10. when complete and no error appear, copy your kernel to "sgy" folder

Code:
cp arch/arm/boot/zImage ~/sgy

11. extract ramdisk from your boot.img

Code:
cd ~/sgy/
perl split_bootimg.pl boot.img

you got "boot.img-kernel" and "boot.img-ramdisk.gz". move "boot.img" and "boot.img-kernel" to other place.

12. repack your new kernel and ramdisk. but first get md5sum of your new kernel

Code:
md5sum zImage

you got something like

Code:
1fd319aa60abc2abae2e5932bcb9fc77  zImage

you need that "1fd319aa60abc2abae2e5932bcb9fc77" write it or copy to text editor. you need run it every time compile new kernel

13. repack

Code:
chmod +x mkbootimg
./mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --base 0x81600000 --kernelMD5 <your md5sum result> -o boot.img

14. make odin flash-able

Code:
tar -cf boot-sgy.tar boot.img


ur methode work for me...!!! i apply this on samsung galaxy 5830i ..!!! but tell me how to rename the kernel..!!!
as in device info it is mentioned by the name "2.6.35.7" dpi@DELL179#1
please help me to solve this...
i want custom name here...
what will be the procedure..????

thanx in advance..!!
 

inogbox

Member
Apr 29, 2013
18
1
SGY Kernel Source for other galaxy model

Main question is : Can I use this downloaded kernel source from http://opensource.samsung.com/ to create kernel for other model (e.g Galaxy Mini GT-S5570 code name TASS) if ihave :
  1. GT-S5360_GB_Opensource_Update3.zip
  2. And because i saw "bcm21553_tassve_defconfig" in folder /Kernel_GTS5360/common/arch/arm/configs
 
Main question is : Can I use this downloaded kernel source from http://opensource.samsung.com/ to create kernel for other model (e.g Galaxy Mini GT-S5570 code name TASS) if ihave :
  1. GT-S5360_GB_Opensource_Update3.zip
  2. And because i saw "bcm21553_tassve_defconfig" in folder /Kernel_GTS5360/common/arch/arm/configs
No. Galaxy Y chipset and Galaxy Mini (not the i variant) have different chipset.
 

inogbox

Member
Apr 29, 2013
18
1
Don't talk about HTC One X and Galaxy S 4/5 ;)
Sorry ... ;) I don't mean to OFF TOPIC just try to understand what all those extracted file's purpose and to start learning kernel development. I'm new on this thing:eek:. And i have most comfortable ROM for my galaxy Y, but this ROM is perfect with stock kernel and stock kernel lack on init.d support, swap support. This is why i want to start to build my own kernel.
 

Androlover98

Senior Member
Jan 30, 2013
124
56
25
Mumbai
Sorry ... ;) I don't mean to OFF TOPIC just try to understand what all those extracted file's purpose and to start learning kernel development. I'm new on this thing:eek:. And i have most comfortable ROM for my galaxy Y, but this ROM is perfect with stock kernel and stock kernel lack on init.d support, swap support. This is why i want to start to build my own kernel.

You don't need init.d support on a kernel. Download Init.d toggler from play store.

Sent from my Nexus 7 using Tapatalk

tabenf said:
Hi have u fixed this?if not can you show me the path u put in make file,

Ya I fixed it. It wasn't a path issue, it was a permission issue.

I tried to compile in mint. Now I am getting

hostcc BASIC/scripts/fixdep.c not found

I fixed it and I forgot what fix was it.?

After fixing that I got

make execvp:cc1 not found.
 
Last edited:

hanuhimanshu17

New member
Jul 22, 2015
2
0
it's not working. sgy stock kernel do not have /proc/config.gz and gcc version in arm-2011.03 not compatible with other precompiled module.

this is work for me

requirement :
1. linux box 32 bit with working gcc. you can use real linux machine or virtual machine
2. Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI from http://www.codesourcery.com/ (Linux version without installer arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2)
3. mkbootimg with md5support. got it from http://xdaforums.com/showpost.php?p=22224170&postcount=241 . credit to harish2704
4. split_bootimg.pl (google it)
5. kernel source from http://opensource.samsung.com . i use GT-S5360_GB_Opensource_Update2.zip
6. stock boot.img (or from your custom kernel).

step :
1. make folder "sgy" in your home. the result is folder "/home/<yourname>/sgy". <yourname> is your linux user name, and from now replace <yourname> with your user name. put all file you already download there
2. extract "GT-S5360_Kernel.tar.gz" from "GT-S5360_GB_Opensource_Update2.zip". put also in "sgy" folder
3. open terminal emulator and go to your working path with command

Code:
cd ~/sgy

4. extract your compiler with

Code:
tar -xvf arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

5. create folder "kernel" and extract kernel source there

Code:
mkdir kernel
cd kernel
tar -xvf ../GT-S5360_Kernel.tar.gz

you got 2 folder, "common" and "modules"

6. open folder "common", there is file "Makefile". open with text editor and find line with content "/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-". replace with "/home/<yourname>/sgy/arm-2009q3/bin/arm-none-eabi-", don't forget replace <yourname>.

7. in terminal goto folder "common" and load default config for sgy

Code:
cd ~/sgy/kernel/common
make bcm21553_totoro_05_defconfig

8. if you want change you config run

Code:
make menuconfig

9. if you ready to build then run

Code:
make

or if you have dual core cpu and want to make it faster

Code:
make -j3

10. when complete and no error appear, copy your kernel to "sgy" folder

Code:
cp arch/arm/boot/zImage ~/sgy

11. extract ramdisk from your boot.img

Code:
cd ~/sgy/
perl split_bootimg.pl boot.img

you got "boot.img-kernel" and "boot.img-ramdisk.gz". move "boot.img" and "boot.img-kernel" to other place.

12. repack your new kernel and ramdisk. but first get md5sum of your new kernel

Code:
md5sum zImage

you got something like

Code:
1fd319aa60abc2abae2e5932bcb9fc77  zImage

you need that "1fd319aa60abc2abae2e5932bcb9fc77" write it or copy to text editor. you need run it every time compile new kernel

13. repack

Code:
chmod +x mkbootimg
./mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --base 0x81600000 --kernelMD5 <your md5sum result> -o boot.img

14. make odin flash-able

Code:
tar -cf boot-sgy.tar boot.img


In requirement one will Linux 64bit (ubuntu 15.10 ) work??
 

Top Liked Posts

  • There are no posts matching your filters.
  • 71
    it's not working. sgy stock kernel do not have /proc/config.gz and gcc version in arm-2011.03 not compatible with other precompiled module.

    this is work for me

    requirement :
    1. linux box 32 bit with working gcc. you can use real linux machine or virtual machine
    2. Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI from http://www.codesourcery.com/ (Linux version without installer arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2)
    3. mkbootimg with md5support. got it from http://xdaforums.com/showpost.php?p=22224170&postcount=241 . credit to harish2704
    4. split_bootimg.pl (google it)
    5. kernel source from http://opensource.samsung.com . i use GT-S5360_GB_Opensource_Update2.zip
    6. stock boot.img (or from your custom kernel).

    step :
    1. make folder "sgy" in your home. the result is folder "/home/<yourname>/sgy". <yourname> is your linux user name, and from now replace <yourname> with your user name. put all file you already download there
    2. extract "GT-S5360_Kernel.tar.gz" from "GT-S5360_GB_Opensource_Update2.zip". put also in "sgy" folder
    3. open terminal emulator and go to your working path with command

    Code:
    cd ~/sgy

    4. extract your compiler with

    Code:
    tar -xvf arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

    5. create folder "kernel" and extract kernel source there

    Code:
    mkdir kernel
    cd kernel
    tar -xvf ../GT-S5360_Kernel.tar.gz

    you got 2 folder, "common" and "modules"

    6. open folder "common", there is file "Makefile". open with text editor and find line with content "/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-". replace with "/home/<yourname>/sgy/arm-2009q3/bin/arm-none-eabi-", don't forget replace <yourname>.

    7. in terminal goto folder "common" and load default config for sgy

    Code:
    cd ~/sgy/kernel/common
    make bcm21553_totoro_05_defconfig

    8. if you want change you config run

    Code:
    make menuconfig

    9. if you ready to build then run

    Code:
    make

    or if you have dual core cpu and want to make it faster

    Code:
    make -j3

    10. when complete and no error appear, copy your kernel to "sgy" folder

    Code:
    cp arch/arm/boot/zImage ~/sgy

    11. extract ramdisk from your boot.img

    Code:
    cd ~/sgy/
    perl split_bootimg.pl boot.img

    you got "boot.img-kernel" and "boot.img-ramdisk.gz". move "boot.img" and "boot.img-kernel" to other place.

    12. repack your new kernel and ramdisk. but first get md5sum of your new kernel

    Code:
    md5sum zImage

    you got something like

    Code:
    1fd319aa60abc2abae2e5932bcb9fc77  zImage

    you need that "1fd319aa60abc2abae2e5932bcb9fc77" write it or copy to text editor. you need run it every time compile new kernel

    13. repack

    Code:
    chmod +x mkbootimg
    ./mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --base 0x81600000 --kernelMD5 <your md5sum result> -o boot.img

    14. make odin flash-able

    Code:
    tar -cf boot-sgy.tar boot.img
    21
    here is the guide

    http://xdaforums.com/showpost.php?p=24747881&postcount=4


    thakz irfanbagus for the guide :)
    2
    I used google.
    The most powerful tool. :p

    Sent from my GT-S5360 using xda app-developers app

    lol, how can you find it in google if nobody ever wrote it. can you find guide to build kernel for galaxy y which not related to harish2704 post and write before 6 february ?
    2
    To both.

    zImage compiled using a good source and correct method as stated by samsung is always good to go.

    The only thing you need is a working ramdisk to combine that image with.

    make xx_xx_xx_defconfig
    make -j4

    This is the easiest way to compile (only make commands are given above)

    you still don't understand. i know how to compile kernel. i already have more than dozen kernel in my pc. in fact i write this step/tutorial more than a month after i did my first bootable kernel.

    the real problem with samsung guide is it does not tell you how to install compiled kernel. back before february, few people already try to make custom kernel. none working. not before harish2704 find that we need mkbootimg which support md5 checksum. he post it here, in 6 feb, a month before meruk release his kernel for the first time.

    the funny thing is all people waiting for custom kernel at that time, but nobody seem to care about his post.
    1
    I thought you have to put your post into a new thread irfan...this one is a fake guide.
    i don't call it fake. it's just too general and missing some detail (but critical) for our device. and in the 'spirit of operation iron fist', i think it's better to put here :D

    Irfan must create a guide.yes yes..I also think Irfan sahab must compile a CM7.2 from sources.
    with my internet connection, it will take weeks just to download the source. and i think cm, like android source, use repo. so you can't just download it. you clone it from their source repository, that mean no download accelerator.

    btw beside kernel source, samsung also release their mod to android source. but to build it, you still need to get android source (about 10GB according their website).