Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

Build you own Android kernel with Ubuntu

Create a kernel specifically for your Android device in just 10 steps

One of the reasons Android has been able to do so well in the mobile markets is thanks to the open source, Linux base for the system. Because it has this open system, it means that the development and licensing is a lot cheaper for phone and tablet manufacturers and Google still gets to make its money via advertising revenue and the Google Play store.

While the business model is interesting in itself, it’s the core kernel, though, that we’re focussing on today. This is the element that bridges the gap between the software and the hardware, which also includes drivers and modules for specific chips in the device. On full-blown Linux distributions, you can get busy changing what modules are compiled along with the kernel, making it smaller and faster to create a speed boost on your system.

When it comes to an Android system, the kernels are quite well optimised for individual devices, however there’s always a little bit more you can do to optimise it for the way you use your phone. Removing the bluetooth module or various input drivers are a couple of examples, however you can also add elements to the kernel for if you think you are going to do some physical hacks to the device.

In order to build the kernel, you’ll need to use the Linux distribution Ubuntu. You don’t have to go to install it though; you just need to have it on some flash storage or a CD so you can live boot it on a PC or laptop. Then you are ready to get kernal building!

This tutorial first appeared in Android Magazine issue 44, which is available from all good shops and to download now.


  1. Go to Ubuntu

    If you’re using Ubuntu 12.04 or later already, you’re all good to go. Otherwise, head to the Ubuntu website and download the latest version of the operating system. Once done, burn the ISO to a disc or use Unetbootin in order to create a live-bootable USB stick.

  2. Boot into Ubuntu

    Reboot your computer with the USB stick or disc in your system. Look out for an option to open the boot menu right as it turns on and select the medium on which you’re accessing Ubuntu from. After a little wait you’ll be asked if you want to try or install Ubuntu, so click Try.

  3. Preparing Ubuntu for building

    Ubuntu is not quite ready yet for making the kernel, so first you need to install some extra software. Press the Ubuntu logo or the Windows key and search for the terminal and then type in: $ sudo apt-get install build-essential kernel-package libncurses5-dev bzip2

  4. Get your kernel source

    Each device has a specific kernel and you’ll need to Google your device to get the exact one. There are some general ones on AOSP, and HTC and Samsung have dedicated pages for kernels. Download the appropriate one to the main hard drive and create a new folder for it.

  5. Download the NDK

    Head to the Android NDK site and download the 32 or 64-bit Linux version depending on what you’re live booting. Put it in the same folder as kernel source code and extract it. If the kernel source was compressed, make sure you extract that as well.

  6. Prepare to configure

    Back in the terminal, use cd to navigate to the kernel folder and use:
    $ export CROSS_COMPILE=[folder location]/androidkernel/android-ndk-r10b/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-
    In the kernel source, find the defconfig file with your devices code on and rename it to maker.defconfig or maker_defconfig.

  7. Go to the kernel menu

    Back in the terminal use the two following commands:
    make maker.config
    make menuconfig
    After the second you’ll be shown the kernel configuration menu where you can start making changes to what modules are included in your kernel.

  8. Configure the kernel

    It’s very important that you know what you’re changing in the menu. Removing random modules will likely just result in your phone not booting but some may actually damage your device. Google the options if you don’t know what you want to change.

  9. Build your new kernel

    Once you’re happy with the configurations and have saved what you’ve done, you can now begin to build your brand new kernel. Use the following command, replacing X with the number of cores in your devices’ CPU:
    $ make -jX ARCH=arm

  10. Flash to phone

    To use the shiny new kernal on your phone, you’ll first need to find a flashable kernel zip for your device and then copy the zImage created from the build into the kernel. This is also your chance to add even more modules, such as Wi-Fi, to fully customise your phone to run exactly as you want.