[Guide]How to mod a stock kernel (add adb root, init.d & bootanim support)

Search This thread

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
How to mod a stock kernel Tutorial (with Windows)
by: broodplank1337

In this tutorial I will explain how to unsecure a kernel and how to add init.d / custom bootanimation support to a stock kernel, in this tutorial we will be using Cygwin as shell, with Dsixda's Android Kitchen.

Requirements:
- Cygwin with Packages and Dsixda's Android Kitchen
- JRE or JDK
- Winrar
- A stock Kernel
- Some common sense





Chapters:
1. Getting the kernel
2. Setting up Cygwin
3. Setting up the Kitchen
4. Modifying the Kernel
5. Testing results




Chapter 1. Getting the Kernel
Since the kernel that you are going to use is a stock kernel, it can be found within the latest stock firmware. for example for the i9001, I have this Odin flashable: "I9001XXKQE_I9001ATOKP3_I9001XXKPL_HOME.tar.md5". Open this file with Winrar and you will see the boot.img in there, just extract it and your currently done. It may also be a zImage!

modkerneltut-1.png




Chapter 2. Setting up Cygwin
The Cygwin package you downloaded needs to be extracted, the default folder of a Cygwin installation is: "C:\cygwin". This is recommended in most cases. Once unpacked navigate to the "home" folder. In this home folder you need to create a folder that has the same username as your current windows username. Once you made that folder you have to extract the contents of "kitchen.rar" to that folder. So you will get a folder structure like this: C:\cygwin\home\username\kitchen

modkerneltut-2.png




Chapter 3. Setting up Kitchen

Go to the original_update folder (located in: C:\cygwin\home\username\kitchen) and open dummyrom.zip with Winrar, now move your own boot.img inside the zip and choose "Store" as compression, Press ok to update the archive. If you have an zImage instead, please remove the boot.img from the archive first. Now browse to the system folder inside the archive and replace the build.prop with a build.prop from your phone. Also choose "Store" as compression and update the archive.

modkerneltut-3.png



Starting the Kitchen:

1. Open Cygwin (X:\Cygwin\Cygwin.bat)
2. Once loaded, enter: "cd kitchen" > Enter
3. now type "sh menu" The kitchen menu will now start...​

modkerneltut-4.png



Setting up a working folder:

1. Press 1 > Enter
2. Press Enter and wait...
3. Choose (1) dummyrom.zip > Enter

modkerneltut-5.png


4. Choose "y" > Enter > Enter a new name (I chose WORKING_KERNEL) > Enter
(now wait until the zip is extracted)

modkerneltut-6.png


5. Choose 2 > Enter

modkerneltut-7.png


6. Enter to return to main menu​



Chapter 4. Modifying the Kernel

Unsecuring the kernel (to use properly with ADB)

1. Press 2 > Enter (to add root permissions)
2. Press "s" > Enter (now wait until the process is done)

modkerneltut-8.png


3. Press Enter to return to main menu​



Adding init.d support (for using startup scripts in /system/etc/init.d)

1. Press 0 > Enter

modkerneltut-9.png


2. Press 17 > Enter (to add init.d support)
3. Enter "y" > Enter (now wait until the process is done)

modkerneltut-10.png


4. Press Enter to return to main menu​

Adding custom bootanimation support

Since the bootanimation support is already inside the dummyrom.zip file, you don't need to add it again.



Chapter 5. Testing the results

Now you will find a working boot.img / zImage under: C:\cygwin\home\username\kitchen\WORKING_KERNEL\
You can copy this file directly to your phone but it won't have bootanimation support.

That's why you need to enter in the Kitchen menu:

1. Press 99 > Enter
2. Press 1 > Enter
3. Press "n" > Enter
4. Press "y" > Enter
5. Press "y" > Enter > "EnterANewZipName" > Enter
6. Now your cwm zip will be located at: C:\cygwin\home\username\kitchen\OUTPUT_ZIP​

The zip that can be found in the directory above can be flashable in CWM. Ejoy your own stock kernel with init.d/bootanimation support!
 
Last edited:

Costinutz32

Senior Member
Oct 22, 2011
1,046
783
27
Bucharest
Third post reserved for further use:).
Just joking.You should make a tutorial to teach.us how to make an overclocked kernel and so on.
Btw nice tutorial from a great dev.
 
Last edited:
  • Like
Reactions: broodplank1337

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
Great tutorial! Btw, this works also with cm9 kernels?

Sent from my GT-I9001 using xda premium

Thank you :)
And honestly I have no idea if it's working on CM9 kernels, I think it does work actually, you should give it a try :eek:


Third post reserved for further use:).
Just joking.You should make a tutorial to teach.us how to make an overclocked kernel and so on.
Btw nice tutorial from a great dev.

lol hehe, I wish I knew how to do that, If I knew that I would have posted a tutorial for sure :p. I'm totally inexperienced with coding kernels unfortunately :p
and thanks btw ^^


edit: added screenshots
 
Last edited:

texten

Senior Member
Apr 4, 2012
1,309
1,506
this is more a tutorial for how to make a rom flashable for cwm with kitchen ;)

bootanimation with kitchen is not working for me, had to modify the init.rc manually in boot.img. but you can use the kitchen for extract the boot.img.

however, the headline of this thread is a bit confusing, the tutorial is ok.

i guess, it is not complete.
for set up working folder, you will need
system.ext4.tar
cache.ext4.tar
boot.img
from a nandroid backup of your rom
 
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
this is more a tutorial for how to make a rom flashable for cwm with kitchen ;)

bootanimation with kitchen is not working for me, had to modify the init.rc manually in boot.img. but you can use the kitchen for extract the boot.img.

however, the headline of this thread is a bit confusing, the tutorial is ok.

i guess, it is not complete.
for set up working folder, you will need
system.ext4.tar
cache.ext4.tar
boot.img
from a nandroid backup of your rom

Well actually, I've kept the dummyrom.zip so minimalistic that boot.img is fully compatible with the kitchen (it needed app/bin folder and build.prop), but all other things are basically removed.

And you don't need all those files, we are not trying to create a working rom here, and the bootanimation is idd not working correctly, that's why I added the AOSP bootanimation library to the dummyrom.zip
 

texten

Senior Member
Apr 4, 2012
1,309
1,506
Well actually, I've kept the dummyrom.zip so minimalistic that boot.img is fully compatible with the kitchen (it needed app/bin folder and build.prop), but all other things are basically removed.

And you don't need all those files, we are not trying to create a working rom here, and the bootanimation is idd not working correctly, that's why I added the AOSP bootanimation library to the dummyrom.zip

ah, ok i didn't know about the dummyrom.zip :)
but only for extract boot.img and make the small changesfor init.d and bootanimation, you can use other methods, not the kitchen.
the setup for kitchen is much more work as needed for this.
you can also use the tool "disk internals linux reader" and change everything you want manually.
just my 2 cents.
maybe with alle that what you have done for this tutorial, you can change/expand it to "how to make a rom with kitchen"...

well whatever. do it as you want. good luck.
 
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
ah, ok i didn't know about the dummyrom.zip :)
but only for extract boot.img and make the small changesfor init.d and bootanimation, you can use other methods, not the kitchen.
the setup for kitchen is much more work as needed for this.
you can also use the tool "disk internals linux reader" and change everything you want manually.
just my 2 cents.
maybe with alle that what you have done for this tutorial, you can change/expand it to "how to make a rom with kitchen"...

well whatever. do it as you want. good luck.

about that, you're right, it can be done allot easier, but the thing is, I never got any working kernel when I manually packed them (or with some scripts), so I'm very thankful to the kitchen, which allows me to make an actual working boot.img ;)
 

EternalFame

Senior Member
Jan 11, 2011
330
63
Hey brood i tried this tutorial with my stock XXKG3 kernel and did it step by step :D
Then i flashed the output.zip and added the folder init.d in system/etc/ and the pass script you posted above but there isnt any pass file on my sdcard ):
what went wrong?

//edit: tried pushing a bootanimation (sanim.zip) to /system/media/ but after the reboot it shows the old galaxy s plus bootanimation );
 
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
Hey brood i tried this tutorial with my stock XXKG3 kernel and did it step by step :D
Then i flashed the output.zip and added the folder init.d in system/etc/ and the pass script you posted above but there isnt any pass file on my sdcard ):
what went wrong?

//edit: tried pushing a bootanimation (sanim.zip) to /system/media/ but after the reboot it shows the old galaxy s plus bootanimation );

hmm the init.d part should work. try it without "su -c" this time
the name of the bootanimation has to be "bootanimation.zip" instead of "sanim.zip"
;)
 

EternalFame

Senior Member
Jan 11, 2011
330
63
hmm the init.d part should work. try it without "su -c" this time
the name of the bootanimation has to be "bootanimation.zip" instead of "sanim.zip"
;)

also doesnt work without su -c and renamed to bootanimation.zip but theres still stock bootanim ):

isnt this tut working with 2.3.3 kernel?


BTW: here is my kernel:
www.hengelmueller.bplaced.net/OUTPUT_ZIP.zip

Sent from my GT-I9001 using XDA
 
Last edited:

broodplank1337

Inactive Recognized Developer
Nov 24, 2011
4,992
10,155
Nijmegen
www.broodplank.net
also doesnt work without su -c and renamed to bootanimation.zip but theres still stock bootanim ):

isnt this tut working with 2.3.3 kernel?

Sent from my GT-I9001 using XDA

Hmm then I don't know atm what the problem, but about the bootanimation, did you build a zip from the working folder? Or did you just copy boot.img? Since it needs the bootanimation library which is included in dummyrom.zip
 

EternalFame

Senior Member
Jan 11, 2011
330
63
Hmm then I don't know atm what the problem, but about the bootanimation, did you build a zip from the working folder? Or did you just copy boot.img? Since it needs the bootanimation library which is included in dummyrom.zip

i have the bootanimation file in system/bin so that shouldnt be the problem ):
could you pls try with my kernel from the link i posted above?
it drives me nuts that i am not able to do such "easy" things ): ^^


btw: do i need something in init.rc or something which tells the system when it should execute the scripts?

Sent from my GT-I9001 using XDA
 

crybert

Senior Member
Oct 15, 2011
869
2,009
Search in the init.rc for system/bin/samsungani and replace it with system/bin/bootanimation.
This should work I guess. AT least this is what i did with my Stock Kernels.

Sent from my GT-I9001 using XDA
 

EternalFame

Senior Member
Jan 11, 2011
330
63
Does not work either ):
could you pls try with my kernel above?

Sent from my GT-I9001 using XDA
 

EternalFame

Senior Member
Jan 11, 2011
330
63
Tried also with skyhigh and feacore and init.d also doesnt work :)

could it be that they dont work with 2.3.3 ?

Sent from my GT-I9001 using XDA
 

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    How to mod a stock kernel Tutorial (with Windows)
    by: broodplank1337

    In this tutorial I will explain how to unsecure a kernel and how to add init.d / custom bootanimation support to a stock kernel, in this tutorial we will be using Cygwin as shell, with Dsixda's Android Kitchen.

    Requirements:
    - Cygwin with Packages and Dsixda's Android Kitchen
    - JRE or JDK
    - Winrar
    - A stock Kernel
    - Some common sense





    Chapters:
    1. Getting the kernel
    2. Setting up Cygwin
    3. Setting up the Kitchen
    4. Modifying the Kernel
    5. Testing results




    Chapter 1. Getting the Kernel
    Since the kernel that you are going to use is a stock kernel, it can be found within the latest stock firmware. for example for the i9001, I have this Odin flashable: "I9001XXKQE_I9001ATOKP3_I9001XXKPL_HOME.tar.md5". Open this file with Winrar and you will see the boot.img in there, just extract it and your currently done. It may also be a zImage!

    modkerneltut-1.png




    Chapter 2. Setting up Cygwin
    The Cygwin package you downloaded needs to be extracted, the default folder of a Cygwin installation is: "C:\cygwin". This is recommended in most cases. Once unpacked navigate to the "home" folder. In this home folder you need to create a folder that has the same username as your current windows username. Once you made that folder you have to extract the contents of "kitchen.rar" to that folder. So you will get a folder structure like this: C:\cygwin\home\username\kitchen

    modkerneltut-2.png




    Chapter 3. Setting up Kitchen

    Go to the original_update folder (located in: C:\cygwin\home\username\kitchen) and open dummyrom.zip with Winrar, now move your own boot.img inside the zip and choose "Store" as compression, Press ok to update the archive. If you have an zImage instead, please remove the boot.img from the archive first. Now browse to the system folder inside the archive and replace the build.prop with a build.prop from your phone. Also choose "Store" as compression and update the archive.

    modkerneltut-3.png



    Starting the Kitchen:

    1. Open Cygwin (X:\Cygwin\Cygwin.bat)
    2. Once loaded, enter: "cd kitchen" > Enter
    3. now type "sh menu" The kitchen menu will now start...​

    modkerneltut-4.png



    Setting up a working folder:

    1. Press 1 > Enter
    2. Press Enter and wait...
    3. Choose (1) dummyrom.zip > Enter

    modkerneltut-5.png


    4. Choose "y" > Enter > Enter a new name (I chose WORKING_KERNEL) > Enter
    (now wait until the zip is extracted)

    modkerneltut-6.png


    5. Choose 2 > Enter

    modkerneltut-7.png


    6. Enter to return to main menu​



    Chapter 4. Modifying the Kernel

    Unsecuring the kernel (to use properly with ADB)

    1. Press 2 > Enter (to add root permissions)
    2. Press "s" > Enter (now wait until the process is done)

    modkerneltut-8.png


    3. Press Enter to return to main menu​



    Adding init.d support (for using startup scripts in /system/etc/init.d)

    1. Press 0 > Enter

    modkerneltut-9.png


    2. Press 17 > Enter (to add init.d support)
    3. Enter "y" > Enter (now wait until the process is done)

    modkerneltut-10.png


    4. Press Enter to return to main menu​

    Adding custom bootanimation support

    Since the bootanimation support is already inside the dummyrom.zip file, you don't need to add it again.



    Chapter 5. Testing the results

    Now you will find a working boot.img / zImage under: C:\cygwin\home\username\kitchen\WORKING_KERNEL\
    You can copy this file directly to your phone but it won't have bootanimation support.

    That's why you need to enter in the Kitchen menu:

    1. Press 99 > Enter
    2. Press 1 > Enter
    3. Press "n" > Enter
    4. Press "y" > Enter
    5. Press "y" > Enter > "EnterANewZipName" > Enter
    6. Now your cwm zip will be located at: C:\cygwin\home\username\kitchen\OUTPUT_ZIP​

    The zip that can be found in the directory above can be flashable in CWM. Ejoy your own stock kernel with init.d/bootanimation support!
    3
    Great tutorial! Btw, this works also with cm9 kernels?

    Sent from my GT-I9001 using xda premium

    Thank you :)
    And honestly I have no idea if it's working on CM9 kernels, I think it does work actually, you should give it a try :eek:


    Third post reserved for further use:).
    Just joking.You should make a tutorial to teach.us how to make an overclocked kernel and so on.
    Btw nice tutorial from a great dev.

    lol hehe, I wish I knew how to do that, If I knew that I would have posted a tutorial for sure :p. I'm totally inexperienced with coding kernels unfortunately :p
    and thanks btw ^^


    edit: added screenshots
    3
    how to check init.d work?

    for example:

    /system/etc/init.d/00test
    Code:
    #!/system/bin/sh
    su -c "echo "pass" > /sdcard/pass"

    If a file called "pass" will appear on your sdcard it's working
    2
    this is more a tutorial for how to make a rom flashable for cwm with kitchen ;)

    bootanimation with kitchen is not working for me, had to modify the init.rc manually in boot.img. but you can use the kitchen for extract the boot.img.

    however, the headline of this thread is a bit confusing, the tutorial is ok.

    i guess, it is not complete.
    for set up working folder, you will need
    system.ext4.tar
    cache.ext4.tar
    boot.img
    from a nandroid backup of your rom

    Well actually, I've kept the dummyrom.zip so minimalistic that boot.img is fully compatible with the kitchen (it needed app/bin folder and build.prop), but all other things are basically removed.

    And you don't need all those files, we are not trying to create a working rom here, and the bootanimation is idd not working correctly, that's why I added the AOSP bootanimation library to the dummyrom.zip
    1
    Great tutorial! Btw, this works also with cm9 kernels?

    Sent from my GT-I9001 using xda premium