The Quest for Kali Nethunter – Part 3

In this third post, we shall look at the patching of the kernel sources for cm-11.

The kernel sources is located at /root/android/system/kernel// which in my case is root/android/system/kernel/htc/endeavoru.

Next we change to kernel source tree root location and get patches from the following


Now, we patch it.


Now we download the kernel patch from pelya repository at

Next we patch it as shown below:-


As we can see the patching worked apart from android.c in drivers/usb/gadget . Upon looking at the code, it became clear that it could be manually patched in android.c at line 1704 as shown below:-


Now that we have patched the kernel, we need to apply the eventdrc patch in /root/android/system/system/core/rootdir as shown below:-


Now head to the android/system and type ‘make clean’ to clean the build system. Now rebuilt the rom, as per the previous posts.

11 responses to “The Quest for Kali Nethunter – Part 3

    • Unfortunately, not at present as I am still working on issues with 3.1 kernel branch. I also don’t have an M7 to test, but the process should be similar as outlined in the posts as it is a Cyanogenmod supported device.

  1. Great write up. I have the M7 and may try this. I already use custom roms, so I guess patching the kernel is the only part I’d need to do. I may give it a shot over the holidays.

  2. How about just compiling the kernel for any android device, and generate and Nethunter zip file that can be flashed on using a recovery?

  3. Sorry for what may be a stupid question…

    I was able to follow use this blog as a guide along with the CM build guides to successfully compile CM12.1 for my Tab Pro 8.4.. the rom works just fine. I am now going to patch with the above two patches.. I get how to do that. My question is now that the kernel is patched and ready, how exactly do I get nethunter built into the rom? I don’t see anything here that has anything to do with nethunter itself.. I know I am missing something completely obvious but this is my first attempt building a rom from source.

    Thanks for the terrific blog articles..

    • Pay close attention to the usb patches otherwise the USB HID attacks will not work, you need to patch the USB gadget code. However, it could not be integrated in your kernel source tree.There should be wireless patches for the kernel available. Good Luck. You can always sent me a tweet if you are having issues. I am always looking for people with similar interests to collaborate / swap ideas with.

      Cheers Cyberkryption

      • I have no idea how to even find the usb gadget code, however I was able to run the wireless patch, compile cm12.1 for mondrianwifi, then I flashed the nethunter-grouper-lollipop zip file from the nethunter site and so far everything I have tried is working. Now I am sure I need to modify the kernel more like you mentioned.. but I at least have a pretty functional galaxy pro tab with kali on it… I’m hang10z on twitter, I’ll shoot you a tweet as I try more things..

      • Hi hang10z, firstly well done on your efforts. My suggestion, would be to hit the Kali / Nethunter irc and talk to people on there. Muts should be able to help. Explain, what you have been doing so far,he may know someone who either has the patch or how you modify usbgadet in source tree for your kernel. Second option, post what you are doing on XDA site and someone will probably help there. You need to patch your kernel to get the usb keyboard app from pelya to work. Keep me informed of your progess. If you have a blog publish your work for others to follow or gelp out.

        Kind Regards


  4. cyberkryption Im lost here, every command i enter gives me an error. This is a great guide but i just cant follow it. Thank you for this anyway

    • The problems is that there is no kernel sources for this phone that allows us to build custom kernel needed by Nethunter. I may look at building on another android phone soon, maybe a Moto G4

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s