How to Compile Android Kernel from Beginning to End[Latest] 2018
How to Compile Android Kernel[Latest] 2018
Compile Android Kernel[Latest] 2018
This article is generally for beginners. Those who show some interest in how Android platform work. Android is the most used platform in the world as it covers around 80percent of the world population. It runs on some code and also kernel give boost support to code and hardware. Kernels are basically a set of programs that run while bootload. They are the first programs that loaded on startup. They control everything in the System as they give support to hardware and software. While Compiling Kernel, you must have some knowledge about the Linux Operating System. It’s Command Line and how to run an executable files etc.
compile android kernel anykernel 2
Have a look – Greenify Pro Donation Apk XDA v3.9.3
- 64bit Linux Environment.
- Some Knowledge of Linux Command Language.
- There should be a learning spirit inside you.
- In addition, a little common sense.
This Article will cover these points
- Downloading the Source
- Downloading the Cross Compiler
- Building the Kernel
- Flashing the Kernel
This Article will not cover these points
- Setting up a building environment.
- Adding Features to the Kernel.
Downloading the Source to Compile Android Kernel
Firstly, If you are compiling your stock kernel, you know where to get your kernel sources. Some are-
Pick your archtiecture
Secondly, If you have a custom kernel, want to build, move along after cloning the kernel using git clone command below-
git clone -b <branch_to_checkout> <url> <desired_folder_name>
tar -xvf <filename>
For Instance, if you wanted to grab the latest Nexus 6P from Google.
git clone -b android-msm-angler-3.10-nougat-mr2 https://android.googlesource.com/kernel/msm/ angler
This will clone the Kernel/msm repo into the angler folder and check out the android-msm-angler-3.10-nougat-mr2 automatically.
Check this out – Xposed Framework Nougat Apk – Rolled out for Nougat, Oreo[XDA]
Downloading the Cross Compiler to compile Android Kernel
Since most of the Android are ARM-based, we need a compiler that is targeting the ARM devices. A host compiler will not work unless you are compiling on another ARM device. You can compile one yourself if you know how(crosstool-NG is a great tool for this) or download a pre-built one. Luckily Google provides a high-quality toolchain for this, in both an x86bit and 64bit. It’s up to you know which your device is running on. Since past three years, most of the devices are manufactured with 64bit architecture.
Another popular toolchain is UBERTC . Most kernels will need patches for anything higher than 4.9 and while I don’t mind assisting with finding them, you should compile with Google’s toolchain first.
compile android kernel learn and flash, compile android kernel android image kitchen download
Once you have decided, clone the toolchain-
git clone <url>
Compile Android Kernel
Point the Makefile to your computer(run this from the toolchain folder)
Tell the makefile the architecture of the device
export ARCH=<arch> && export SUBARCH=<arch>
export ARCH=arm64 && export SUBARCH=arm64
Locate your proper defconfig
Navigate the arch/<arch>/configs folder within the kernel source(e.g. arch/arm64/configs) and locate your device’s or custom kernel developer proper config file. A defconfig tells the compiler what options to add to the compiler.
Build the Kernel
make -j$(nproc –all)
Conclusion, If those commands succeed, you will have an image, image-dtb, image.gz at the end.
Flash Android Kernel
Suppose you were able to compile the kernel, now next step is to flash the kernel. I will be covering two different ways to flash a compiled kernel: unpacking and repacking the boot image using Android Kitchen.
- Pull your device boot image.
- Download the Latest Android Kitchen from above Save button.
- Run the given Code with the boot image.
- Locate the zImagre file and replace it with your kernel image.
- Run the given code to repack.
- Flash the New boot image with fastboot or TWRP.
compile android kernel in mac
Have a look at:
As a result, found any bug or problem, Please do mention your problem in the Inbox!
Support us by Subscribing us or Sharing our Posts!