• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [HOW TO] Build kernel (zImage) into boot.img

Rxpert83

Dr. Feelgood
Aug 30, 2011
17,908
13,152
MN
Hey Everyone!

I've gotten a few PM's from members trying to follow this guide and are S-ON about how to fastboot flash a kernel when it isn't packaged into a boot.img for you.


A good example of this is the arc reactor kernel:
[Kernel][JB][SENSE] Arc-Reactor [3.4.40][S2W][linaro] [-O3][WIP] - xda-developers

nfz.png


When you download and extract the kernel you'll notice there is no boot.img! However, the kernel is located inside of /kernel. The zImage is the output of the compiler when you build a kernel from source.

In order to flash that zImage, you'll need to incorporate it into the boot.img along with the proper ramdisk.


Step One: Download your files
Get the Android Image Kitchen:
[DEV][TOOL] Android Image Kitchen - Unpack/Repack Kernel/Recovery + ramdisk [Win32] - xda-developers

Arc Reactor Kernel (MikMik):
[Kernel][JB][SENSE] Arc-Reactor [3.4.40][S2W][linaro] [-O3][WIP] - theMikMik
Dev-Host:
Dev-Host - The Ultimate Free File Hosting / File Sharing Service

Stock boot.img for your ROM


Step 2: Extract the 2 zip files
Its also a good idea to place them somewhere convenient (I just do the desktop)

Step 3: Move the stock boot.img into the folder for the Android Image Kitchen
yq43.png


Step 4: Drag the boot.img onto unpackimg.bat
This unpackages the boot.img into the split_img and ramdisk folders.
ca5o.png


Step 5:Inside of the split_img folder, youll see boot.img-zImage...remove or delete it from the folder.
pmz8.png


Step 6: Place your zImage containing the arc reactor kernel (or whatever kernel you're using) into the folder. You may need to rename it to boot.img-zImage

Step 7: Go back one level to the android kitchen image folder, and click on the repackimg.bat file. This will rebuild your boot.img while incorporating the new zImage. Your boot image will be named image-new.img
5dlo.png


You can now fastboot flash this using the command
Code:
fastboot flash boot image-new.img
just like before!
 

Attachments

  • step 2.png
    step 2.png
    8.4 KB · Views: 1,110
  • step3.jpg
    step3.jpg
    16.2 KB · Views: 1,149
  • step 4.jpg
    step 4.jpg
    17.9 KB · Views: 1,070
  • step 5.jpg
    step 5.jpg
    17 KB · Views: 1,060
  • step 6.png
    step 6.png
    11 KB · Views: 1,132
  • step 7.png
    step 7.png
    21 KB · Views: 1,025
Thanx rxpert.

So this is for s-on folks?

That particular example is, as the updater script from the kernels zip file can't decompile and recompile the boot.IMG on an s-on device. If the user is s-off they can flash that kernel as is.

Other than that, can be applicable to anyone wanting to decompile/recompile a boot.IMG to change things in the ramdisk or as the last step to compiling a kernel from source (compiling a kernel from source gives you the zImage, not the boot.img)
 
  • Like
Reactions: ocnbrze
Upvote 0
That particular example is, as the updater script from the kernels zip file can't decompile and recompile the boot.IMG on an s-on device. If the user is s-off they can flash that kernel as is.

Other than that, can be applicable to anyone wanting to decompile/recompile a boot.IMG to change things in the ramdisk or as the last step to compiling a kernel from source (compiling a kernel from source gives you the zImage, not the boot.img)

ahhhh got it.....pretty cool
 
Upvote 0
Pretty cool, Rx. ;)

Now ...can you tell me why my Evo 4g lte just won't get s-off?

Anyway, I hope this tutorial will suffice many concerned questions.

That I can't answer. I havent been on the LTEvo in nearly a year and aren't aware of the nuances of s-off.

I just made a thread about a brand new S-OFF method. Perhaps that will work
 
  • Like
Reactions: Rush and ocnbrze
Upvote 0
That I can't answer. I havent been on the LTEvo in nearly a year and aren't aware of the nuances of s-off.

I just made a thread about a brand new S-OFF method. Perhaps that will work
I'm 85% certain that the problem with this phone not being able to get s-off is software-related.

Yeah, as for that new method of getting s-off — I'll try it out on Monday evening.

Thanks again. ;)
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones