- Packages to install in Fedora
sudo yum -y install gcc ncurses-devel
- Packages to install in Ubuntu or Debian
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
- Prepare your kernel source for compilation:
make clean && make mrproper
*You must be within your kernel source directory when executing this command.
- Pull config from device as a starting point:
*Your default doncifg is located in your kernel source directory in /arch/arm/configs/yourdevice_defconfig
- Execute the command:
- Or if you have the Android SDK installed you can get your config by executing the following:
adb pull /proc/config.gz
*This requires that the Android SDK be installed. Please see my Android SDK installation and set up videos for more information.
- Point the "Makefile" to the compilation tools:
*This is the path for the location where you have the Android NDK stored. All you have to do is replace the beginning of the above path "/home/rizzo/ndk/" to your location, the rest of the path stays the same.
*Or you can edit the cross_compile flag in the "Makefile"
- Edit "Makefile" to add a name to your custom kernel:
*Search for "Extraversion" at the top of the "Makefile" now add your own custom name with no spaces or capital letters name cannot exceed 64 characters use “-” to separate your words there cannot be empty spaces separating characters.
- Move the config you pulled from your device into your kernel source directory and rename it to ".config":
- Apply any kernel patches ie. BFS, BFQ etc:
patch -p1 < yourpatch.patch
- Further configure your kernel if so desired:
*Load the config you pulled from you device in the above step by using the “Load an Alternate Configuration File” option.
- Execute compile command:
make -j5 ARCH=arm
*Using the "-J" flag optimizes the compilation process for the number of cores your host system has. The general rule of thumb is to add "1" to the number of cores on your host system in my case I have a quad core system so I would use -J5.
- Kernel & Wifi module locations after compilation:
With an archive manager open "AnyKernel.zip" and place "zImage" in the "kernel" directory then place your wifi module "bcm4329.ko" in the "/system/lib/modules" directory.
Take special precautions not to unzip the AnyKernel tool in doing so you will break the signing of the package and your recovery will not allow you to flash your new kernel!
Place your custom kernel .zip on the root of your SD card and flash in recovery just as you would a Rom. Wiping your dalvik cache is recommended before installing your kernel. This kernel can also be shared and installed with other individuals with the SAME device.
Please note this guide is meant to accompany the corresponding YouTube video which goes into much greater detail of the Android kernel compilation process.
*Android NDK,r5c used for demonstration*