How to build and flash a Linux kernel for AOSP supported devices
Why rebuild the kernel?
There can be several reasons for why you want to rebuild and compile a custom kernel. You might, for instance, be a kernel developer, or you might have custom hardware that the standard kernel doesn’t support. Rebuilding a kernel enables you to make modifications to your device that are normally not supported by the manufacturer.
Note: If you’re not an experienced developer, Sony advises you not to rebuild the original kernel, as it is normally not needed. At Sony, we’re proud to deliver great software experiences through our rigorously tested and official software releases.
Prerequisites
This tutorial assumes that you are running Linux or Mac. On the Android Open Source Project website, you can find detailed instructions on how to set up and initialise a Linux build environment. You will probably also want to use a version control system like Git to handle your project. You can download Git from the Git webpage.
Rebuild the kernel
In order to rebuild the Linux kernel for your Sony Xperia device, you need to carefully follow the steps below. All code commands should be entered in the command prompt.