Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,305 Members 44,554 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
broodplank1337
Old
(Last edited by broodplank1337; 8th June 2012 at 07:28 AM.)
#1  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9917
Posts: 4,925
Join Date: Nov 2011
Location: Nijmegen

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

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!
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

The Following 24 Users Say Thank You to broodplank1337 For This Useful Post: [ Click to Expand ]
 
RyanJWZ
Old
#2  
RyanJWZ's Avatar
Member
Thanks Meter 1
Posts: 30
Join Date: Feb 2012
Location: Culemborg
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: [ Click to Expand ]
 
Costinutz32
Old
(Last edited by Costinutz32; 8th June 2012 at 07:03 AM.)
#3  
Costinutz32's Avatar
Senior Member
Thanks Meter 751
Posts: 1,017
Join Date: Oct 2011
Location: Bucharest

 
DONATE TO ME
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.
The Following User Says Thank You to Costinutz32 For This Useful Post: [ Click to Expand ]
 
broodplank1337
Old
(Last edited by broodplank1337; 8th June 2012 at 07:26 AM.)
#4  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9917
Posts: 4,925
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by RyanJWZ View Post
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 View Post
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
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

The Following 3 Users Say Thank You to broodplank1337 For This Useful Post: [ Click to Expand ]
 
kingsonwongs
Old
#5  
kingsonwongs's Avatar
Senior Member
Thanks Meter 241
Posts: 148
Join Date: Dec 2011
Location: hong kong

 
DONATE TO ME
how to check init.d work?
 
broodplank1337
Old
#6  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9917
Posts: 4,925
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by kingsonwongs View Post
how to check init.d work?
for example:

/system/etc/init.d/00test
Code:
Select Code
#!/system/bin/sh
su -c "echo "pass" > /sdcard/pass"
If a file called "pass" will appear on your sdcard it's working
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

The Following 3 Users Say Thank You to broodplank1337 For This Useful Post: [ Click to Expand ]
 
texten
Old
(Last edited by texten; 8th June 2012 at 12:31 PM.)
#7  
texten's Avatar
Senior Member
Thanks Meter 1540
Posts: 1,276
Join Date: 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
been there, done that.
 
broodplank1337
Old
#8  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9917
Posts: 4,925
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by texten View Post
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
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects

The Following User Says Thank You to broodplank1337 For This Useful Post: [ Click to Expand ]
 
texten
Old
(Last edited by texten; 8th June 2012 at 01:13 PM.)
#9  
texten's Avatar
Senior Member
Thanks Meter 1540
Posts: 1,276
Join Date: Apr 2012

 
DONATE TO ME
Quote:
Originally Posted by broodplank1337 View Post
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.
been there, done that.
 
broodplank1337
Old
#10  
broodplank1337's Avatar
Recognized Contributor / Recognized Developer - OP
Thanks Meter 9917
Posts: 4,925
Join Date: Nov 2011
Location: Nijmegen

 
DONATE TO ME
Quote:
Originally Posted by texten View Post
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
Device: Samsung Galaxy S4 (i9505)

Latest Development:
 

Roms:
AOSP v4.4.4 (KTU84P) from source for I9505 (Github)
- Cleanest ROM available for i9505. along with up-to-date stock kernel, also forms a perfect base for ROM developers.

Apps:
Galaxy S4 Glove Mode App (Playstore link)
- Do you want the Glove Mode of the S4 but your ROM doesn't support it? Use this app to enable/disable it easily.

Latest Scraps:
Proprietary Lib Cleaner / Silent proprietary libs / Live Thermal Monitor / GIT Conflict Fixer

Projects in development:
 

broodROM KitKat "Aiming for perfection"
- Custom ROM with really high standards, more info soon

For sources you can visit my Github. Or take a look at all my projects


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

Advanced Search
Display Modes