Post Reply

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

OP broodplank1337

8th June 2012, 03:49 AM   |  #1  
broodplank1337's Avatar
OP Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,043
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
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.md 5". 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!





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





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.




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...



Setting up a working folder:
1. Press 1 > Enter
2. Press Enter and wait...
3. Choose (1) dummyrom.zip > Enter



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



5. Choose 2 > Enter



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)



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



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



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 by broodplank1337; 8th June 2012 at 07:28 AM.
The Following 25 Users Say Thank You to broodplank1337 For This Useful Post: [ View ]
8th June 2012, 07:00 AM   |  #2  
RyanJWZ's Avatar
Member
Flag Culemborg
Thanks Meter: 1
 
30 posts
Join Date:Joined: Feb 2012
More
Great tutorial! Btw, this works also with cm9 kernels?

Sent from my GT-I9001 using xda premium
The Following User Says Thank You to RyanJWZ For This Useful Post: [ View ]
8th June 2012, 07:01 AM   |  #3  
Costinutz32's Avatar
Senior Member
Bucharest
Thanks Meter: 786
 
1,035 posts
Join Date:Joined: Oct 2011
Donate to Me
More
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 by Costinutz32; 8th June 2012 at 07:03 AM.
The Following User Says Thank You to Costinutz32 For This Useful Post: [ View ]
8th June 2012, 07:07 AM   |  #4  
broodplank1337's Avatar
OP Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,043
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Quote:
Originally Posted by RyanJWZ

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


Quote:
Originally Posted by Costinutz32

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 by broodplank1337; 8th June 2012 at 07:26 AM.
The Following 3 Users Say Thank You to broodplank1337 For This Useful Post: [ View ]
8th June 2012, 07:23 AM   |  #5  
kingsonwongs's Avatar
Senior Member
Flag hong kong
Thanks Meter: 241
 
148 posts
Join Date:Joined: Dec 2011
Donate to Me
More
how to check init.d work?
8th June 2012, 08:02 AM   |  #6  
broodplank1337's Avatar
OP Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,043
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Quote:
Originally Posted by kingsonwongs

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
The Following 3 Users Say Thank You to broodplank1337 For This Useful Post: [ View ]
8th June 2012, 12:27 PM   |  #7  
texten's Avatar
Senior Member
Thanks Meter: 1,544
 
1,276 posts
Join Date:Joined: Apr 2012
Donate to Me
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 by texten; 8th June 2012 at 12:31 PM.
8th June 2012, 12:46 PM   |  #8  
broodplank1337's Avatar
OP Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,043
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Quote:
Originally Posted by texten

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
The Following User Says Thank You to broodplank1337 For This Useful Post: [ View ]
8th June 2012, 01:02 PM   |  #9  
texten's Avatar
Senior Member
Thanks Meter: 1,544
 
1,276 posts
Join Date:Joined: Apr 2012
Donate to Me
Quote:
Originally Posted by broodplank1337

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 by texten; 8th June 2012 at 01:13 PM.
8th June 2012, 01:31 PM   |  #10  
broodplank1337's Avatar
OP Recognized Contributor / Recognized Developer
Flag Nijmegen
Thanks Meter: 10,043
 
4,941 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Quote:
Originally Posted by texten

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

Post Reply Subscribe to Thread

Tags
custom bootanimation, init.d, kitchen, root, stock kernel
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes