How To: Extract a Kernel From a ROM

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Updated 10/25

There's a kernel you like, but it is only available packaged with the developer's ROM. You like the features of a different ROM, but want to use the kernel of the first ROM. Or maybe you want to keep your stock ROM, but use a kernel packaged in a custom ROM. What do you do? You extract the kernel (this sounds a lot cooler than it actually is).

Standard disclaimer: this procedure should not be done by anyone ever. But if you do do it and blow your phone up into tiny little pieces, I am not responsible :p

You might have noticed that all ROMs and kernels come in zip files, which you install in ClockworkMod Recovery. Ever tried looking in one of those zip files? You'll find a bunch of files and folders. One of these files, called "zImage", is the kernel. Here is how to take a kernel out of a ROM to use in another ROM or by itself, in 3 (you should already have done step 0 but I put it there just in case) easy steps:

0) Make a backup of your phone using ClockworkMod Recovery. This is extremely important - if you mess anything up, you'll have a system backup as a restore point. If you don't know how to do this or what I'm talking about, there are several threads in this sub-forum explaining how.

1) If you don't already have it, download ASTRO file manager - this will let you view and modify the internals of zip files without extracting them. This is important because other users have reported problems with the unzip ROM>modify ROM>re-zip ROM method.

2) On your computer, unzip the ROM you want to extract the kernel from (it's ok to unzip this ROM since you won't be flashing it) and find the "zImage" file. It will be in a folder called "kernel_update". Set this file aside.

Now, if you are putting the extracted kernel into a ROM that comes with its own kernel, go to step 3a. If the ROM does not come with its own kernel or you want to install the extracted kernel without a ROM, go to step 3b.

3a) Place the ROM you plan on flashing as well as the extracted "zImage" file onto the root of your phone's SD card. Using ASTRO file manager, look inside the ROM and find the "kernel_update" folder and delete the "zImage" file there, then replace it with the "zImage" from step 2. That's it, you're done! Now just boot into ClockworkMod Recovery and flash.

3b) This step is for installing the extracted kernel by itself, and for users who want to use the extracted kernel with a ROM that does not come with its own kernel. To insert a kernel into a ROM that does not come with its own kernel is beyond the scope of this guide (it's a bit messier). So for those users it is easiest to first flash your ROM, then flash the kernel as a separate zip. To do this, first download any stand-alone kernel such as MixUp, Fluff, Andromeda, Phoenix, etc. Then place both the stand-alone kernel as well as the "zImage" from step 2 onto the root of your SD card. Using ASTRO, Find the "kernel_update" folder in the stand-alone kernel zip, delete "zImage" and replace it with the "zImage" from step 2. That's it, you're done! Now just boot into ClockworkMod Recovery and flash.

Thanks to shaundizzle for testing the original method of manipulating the zip file on a computer, and to GhostDecon for suggesting the use of ASTRO as an archive utility.

If you use this procedure, let me know how it went :D
 
Last edited:

shaundizzle

Well-known member
Oct 19, 2010
602
29
0
Visit site
can you explain to me how in the world i use sarchiver because i dont think just rezipping it is working for me so i downloaded sarchiver and idk what im doing with it

so i ended up unzipping baked and getting z image - unzipping wisdom and deleting zimage and then pasting baked zimage into wisdom and then zipping that file using sarchiver and its stuck at "installing zip" on clockwork
 

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Interesting, so unzipping and re-zipping doesn't work. I'll modify the original post.

As for sArchiver, the trick is not to click directly on the zip - instead open sArchiver, hit the "Open" button, navigate to and select your zip you plan on flashing. After a few seconds the rows under the "Open" button will propagate with the contents of the zip. You can delete the "zImage" from here. Now you get the zImage you extracted, put it in an empty folder named "kernel_update" (since you can only add files in sArchiver to the zip root), and drag and drop onto the rows in sArchiver. You now have your extracted kernel in the ROM you're going to flash.

Sorry, I really should have put that part in the guide. Please tell me if this is clear enough and how your next flashing attempt goes.
 

shaundizzle

Well-known member
Oct 19, 2010
602
29
0
Visit site
for some reason when i click on remove in sarchiver it does not delete it. i see it process that i clicked remove but the file is still there.

and dragging and dropping does not work. i can only click "add" to put things into the zip. its probably cuz im running 3.0.1
 
  • Like
Reactions: ragnarokx

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
for some reason when i click on remove in sarchiver it does not delete it. i see it process that i clicked remove but the file is still there.

and dragging and dropping does not work. i can only click "add" to put things into the zip. its probably cuz im running 3.0.1

I'll try and find an alternative archive program and post a link to it here.
 

GhostDecon

Member
Oct 25, 2010
19
1
0
Visit site
Thanks for the instructions. I was able to get this to work using astro, I just put the zImage file (from Bakedsnack) along with my rom of choice (in this case Wisdom) on my sdcard. Opened the rom in astro and replaced the zImage file with the one from Bakedsnack. Flashed the rom and it worked like a charm.

The problem I?ve been having is that after restoring apps/data I?m getting constant FC with the market. I?ve read that this is due to restoring my system data. I?ve tried different options in clockwork and this always happens. Not sure exactly what I should/shouldn?t restore. I?ve also tried titanium backup but again not sure what I should/shouldn?t be restoring.
 
  • Like
Reactions: ragnarokx

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Restoring apps/data can get you into trouble with certain ROMs. Personally, that is why I reinstall all apps and restore all settings manually. I think this is why my ROMs seem to run much more bug-free than others' do. The only thing I restore using MyBackup Pro is Angry Birds (can't lose those high scores!).
 

shaundizzle

Well-known member
Oct 19, 2010
602
29
0
Visit site
hahaha same here i only make sure to keep angry birds up to date. everything else i could care less about.

but dont sweat it, i got over trying to install wisdom after i found out the lockscreen does not act like the real htc sense. does your dock act like the real sense ui? if it does that may be a reason to get it...
although i could not get it to look anything like yours so i ended up going back to baked 1.3
 

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
hahaha same here i only make sure to keep angry birds up to date. everything else i could care less about.

but dont sweat it, i got over trying to install wisdom after i found out the lockscreen does not act like the real htc sense. does your dock act like the real sense ui? if it does that may be a reason to get it...
although i could not get it to look anything like yours so i ended up going back to baked 1.3

Sorry to hear that! Well if you ever want to put the Baked Snack kernel in a ROM besides Wisdom I hope this guide works for you.
My lock screen doesn't act like the Sense one, it just replicates the look.
 

MeOverTrance

Member
Oct 11, 2010
18
1
0
Visit site
I've heard SO many good things about the dev of Epic Experience. Would you suggest I toss in the Baked kernel or just leave the MixUp one he has in there ? As far as overclocking is concerned push out 1200 tops ( 13 on my phone keeps messing up )
 

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
I haven't tried the latest release of MixUp, but I am very happy with Baked Snack (kernel). You could always give both a try. Just flash Epic Experience, try it out with MixUp, then use this guide to make a stand-alone kernel zip of Baked Snack and you can flash that on top of Epic Experience without having to reinstall anything. 1.3GHz was unstable for me on Baked Snack, but both MixUp and Baked Snack should run well at 1.2GHz.
 

HeisRisen

Well-known member
Oct 29, 2010
91
2
0
Visit site
Okay, say I just want to flash Baked Snack Kernel and not the ROM. Is there any reason I can't do the zImage procedure on my computer first and then just copy the modified kernel package to my SD card and flash it in clockwork? Why do I have to delete the old zimage, copy and paste the new zimage into the kernel zip on my phone? Why can't I do that on my PC?
 

shaundizzle

Well-known member
Oct 19, 2010
602
29
0
Visit site
you can but you need to make sure you dont unzip the package.
well at least thats how it seemed for me. when i unzipped it and rezipped i could not get it to flash correctly.

try using sarchiver for mac os, or another similar app if you dont want to deal with rezipping and risking it not flashing.

but you cant just take the kernel_update folder out of the bakedsnack.zip and rezip it and flash it. definitely deos not work like that
 

ragnarokx

Well-known member
Apr 20, 2010
6,915
1,696
0
Visit site
Okay, say I just want to flash Baked Snack Kernel and not the ROM. Is there any reason I can't do the zImage procedure on my computer first and then just copy the modified kernel package to my SD card and flash it in clockwork? Why do I have to delete the old zimage, copy and paste the new zimage into the kernel zip on my phone? Why can't I do that on my PC?

That was actually the original procedure I had up, but people were having a hard time finding/working with archive programs that allow you to edit the internals of a zip without decompressing it. I switched to the ASTRO phone method because it seemed more universal. But by all means, if you know how to remove and replace the zImage on your computer without unzipping it then go ahead.
 

HeisRisen

Well-known member
Oct 29, 2010
91
2
0
Visit site
That was actually the original procedure I had up, but people were having a hard time finding/working with archive programs that allow you to edit the internals of a zip without decompressing it. I switched to the ASTRO phone method because it seemed more universal. But by all means, if you know how to remove and replace the zImage on your computer without unzipping it then go ahead.

Pretty sure WinRAR will modify contents of a packed file.
 

shaundizzle

Well-known member
Oct 19, 2010
602
29
0
Visit site
sounds good. I'm pretty sure rag and I are on Mac os so its way different.
its pretty easy to do though. good luck

Sent from my SPH-D700 using Tapatalk