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

Search This thread

ric105

Member
Jan 31, 2013
5
1
Make no assumptions !

After (too) many failed attempts, I resorted to following the aforementioned steps to the letter. It seems that toolchain selection is important! I had been using (because of some other kernel work) the Android NDK 4.4.3 toolchain.

Once I switched to the Code Sourcery G+ toolchain, my kernel would finally boot.

Just thought I'd make this more obvious, in case someone else made the same assumption.
(And thanks everyone.)

Best Regards
 

Seket3

New member
Feb 6, 2013
2
0
Tembisa
Nandroid Backup B5510

He did help, thanks ;)

question now is...while trying to revive the phone I installed Creed's Rom for Gt-s5360, I got quiet, and obviously it doesnt work that well in my GT-B5510, so I need a custom Rom for my device or a Stock Rom, but I cant find neither :S

any lights??


can you perhaps make and upload your nandroid backup i need to backup my phone please
 

dabeez98

Senior Member
Jul 2, 2012
370
61
Malmö
Hello there...
I have a problem while compiling kernel for S5830i. I loaded the CooperVE config.

Code:
[email protected]:/home/dabeez/Documents/sgai/kernel/common# make -j3
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
gcc: error trying to exec 'cc1': execvp: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
[email protected]:/home/dabeez/Documents/sgai/kernel/common#
Using real PC,btw
 
Last edited:

hell_lock

Inactive Recognized Developer
Jan 20, 2012
5,972
5,173
24
New Delhi
Hello there...
I have a problem while compiling kernel for S5830i. I loaded the CooperVE config.

[email protected]:/home/dabeez/Documents/sgai/kernel/common# make -j3
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
gcc: error trying to exec 'cc1': execvp: No such file or directory
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
[email protected]:/home/dabeez/Documents/sgai/kernel/common#
Using real PC,btw

I think you need to install gcc again..

Sent from my HTC Desire X using xda app-developers app
 
  • Like
Reactions: dabeez98

dabeez98

Senior Member
Jul 2, 2012
370
61
Malmö
Now i've corrected a lil mistake...
But still error...
Code:
make: /home/dabeez/Documents/sgai/arm-2009q3/arm-none-eabi/gcc: Command not found
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
/bin/sh: 1: /home/dabeez/Documents/sgai/arm-2009q3/arm-none-eabi/gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
 

hell_lock

Inactive Recognized Developer
Jan 20, 2012
5,972
5,173
24
New Delhi
Now i've corrected a lil mistake...
But still error...
Code:
make: /home/dabeez/Documents/sgai/arm-2009q3/arm-none-eabi/gcc: Command not found
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/empty.o
/bin/sh: 1: /home/dabeez/Documents/sgai/arm-2009q3/arm-none-eabi/gcc: not found
make[2]: *** [scripts/mod/empty.o] Error 127
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2

You put the wrong path to gcc. Search for arm-none-eabi in the toolchain folder and tell me where it is

Sent from my HTC Desire X using xda app-developers app
 

dabeez98

Senior Member
Jul 2, 2012
370
61
Malmö
Corrected. Its in bin folder in arm none eabi. But now still the error from post 64

---------- Post added at 08:59 PM ---------- Previous post was at 08:57 PM ----------

Its some error with the cc1. Its not found. Im using 64bit 12.10
 

hell_lock

Inactive Recognized Developer
Jan 20, 2012
5,972
5,173
24
New Delhi
Corrected. Its in bin folder in arm none eabi. But now still the error from post 64

---------- Post added at 08:59 PM ---------- Previous post was at 08:57 PM ----------

Its some error with the cc1. Its not found. Im using 64bit 12.10

Just put these commands..
C++ --version
C --version
Gcc --version
If you get all the versions then tell me else install them

Sent from my HTC Desire X using xda app-developers app
 
  • Like
Reactions: dabeez98

hell_lock

Inactive Recognized Developer
Jan 20, 2012
5,972
5,173
24
New Delhi
Just doesnt show up C. GCC and C++ version 4.7.2 ubuntu/linaro
Doesnt found c in apt

uninstall gcc by opening the ubuntu store or wateva its called.. look in upper right corner and type gcc in it... uninstall it... and then install it again... use those commands again this time.. it will work :D
 
  • Like
Reactions: dabeez98

dabeez98

Senior Member
Jul 2, 2012
370
61
Malmö
Maybe you meant CC not C?

If i enter CC not C,then this is showing:
Code:
[email protected]:/home/dabeez/Documents/sgai/kernel/common# gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[email protected]:/home/dabeez/Documents/sgai/kernel/common# cc --version
cc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[email protected]:/home/dabeez/Documents/sgai/kernel/common# c++ --version
c++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[email protected]:/home/dabeez/Documents/sgai/kernel/common#

If I enter C not CC, then this is showing:
Code:
[email protected]:/home/dabeez/Documents/sgai/kernel/common# gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[email protected]:/home/dabeez/Documents/sgai/kernel/common# c --version
c: command not found
[email protected]:/home/dabeez/Documents/sgai/kernel/common# c++ --version
c++ (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[email protected]:/home/dabeez/Documents/sgai/kernel/common#

I did these after ubuntu software center reinstall
 

hellfire695

New member
Dec 3, 2012
1
0
64bit

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://forum.xda-developers.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


Can I use a 64bit linux box as well?
 

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://forum.xda-developers.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
    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).
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone