This is a general guide for building kernels and modifying them. Device-specific articles for getting the kernel source and setting up the build environment are provided in their respective sections.

Getting the kernel sourceEdit

The source for your kernel must be made available by your device's manufacturer in order to comply with the GPL.

Motorola maintains a list of their devices' source code here.

HTC's device source code is available at

Your device's source code can be found on it's device page. See the Devices page to find your device. mm

Setting up the environmentEdit

Instructions for setting up the development environment should be included in your source code package. This should tell you the parts of the Android Open Source Project that must be in your working directory in order to allow the kernel to build. It will tell you what version as well. All of the Android Operating System source code is available at [] and most projects are mirrored at []. Both are accessible via your internet browser as well as git.

Modifying the kernelEdit

After the kernel source has been downloaded and your environment is set up, you can begin modifying the kernel. It is recommended (in most cases mandatory) that you run the standard "make xxx_defconfig" for your device before modifying the configuration.




make -jX [where X is the number of operations to perform at a time]

at this point will make the stock kernel that your phone's official system has. To modify it, we can go two ways: 1) modify the file '.config' in a text editor, or 2) run

make menuconfig

for a graphical interface.

Modifying '.config' with menuconfigEdit


make menuconfig

will bring up the aforementioned graphical interface for modifying your kernel. Striking the "y" key when an option is selected (with "< >" or "[ ]" before it) will include it in the kernel. Striking the "m" key will add those options with a "< >" as a Linux kernel module (*.ko).

Adding tethering support (netfilter/iptables)Edit

Adding VPN support (TUN)Edit

Adding Linux swap supportEdit

Adding ext3/ext4 supporttEdit

Mofifying '.config' manuallyEdit

The alternative to using menuconfig is editing '.config' in your preferred text editor. Options that are not to be included in the build are commented out with a "#". Options that are to be included inside the kernel image are uncommented and have the value of "y". Options with the value "m" are to be built into loadable kernel modules.

Adding tethering support (netfilter/iptables)Edit

Adding VPN support (TUN)Edit

Adding Linux swap supportEdit

Adding ext3/ext4 supportEdit

touch yourself now.

Packaging and flashing your kernelEdit

Additional stepsEdit

You may find that you want to play around with '.config', but don't want to lose your configuration. You can rename your '.config' to whatever you want and give it the suffix "_defconfig" and put it in "arch/arm/configs/" for the next time you wish to use it.

For example: if you had a kernel that had tethering and ReiserFS support, and you wanted to try enabling VPN without breaking your current setup, you could rename your '.config' to 'my_rfs_tethering_defconfig' and move it to "arch/arm/configs/". The next time you wanted to make this kernel you could run

make my_rfs_tethering_defconfig

and have your kernel configuration just as you left it.

Note that this would overwrite your kernel configuration stored in '.config'

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.