How to automatically build the Linux kernel
1. Set up the source code and environment
Select one of the Android build guides (see the AOSP build instructions page) and do the following steps of the guide:
- Prepare your Java environment
- Install the necessary tools to make an Android build
- Download Repo tool and set PATH
- Initialise the AOSP tree
- Add the necessary patches from the AOSP upstream branch
Note: If you already have the environment set then steps 1-3 are optional. This automatically rebuild only works with Android 6.0.1 and newer build guides.
2. Prepare the repository for kernel rebuild
To rebuild the kernel you have to remove the pre-build kernel folder by typing the command:
rm –r device/sony/common-kernel
Note: The open device tree will automatically build the kernel from source if a pre-built kernel is not found.Next
3. Rebuild the boot image
To rebuild the boot image with a kernel built from source, use the following commands:
source build/envsetup.sh && lunch
When prompted, pick the number corresponding to your device in the list displayed and press enter. To start the build, type:
make -j <insert the cpu thread number of your computer> bootimage
Note: The build will take some minutes to complete.
4. Flash the boot image file
Use the Fastboot protocol to flash the boot image file to your phone or tablet. Enter the following command:
fastboot flash boot out/target/product/<device>/boot.img
When prompted to connect your device, first make sure that your device is turned off. Then, hold down the Volume Up button and connect the device to your computer with a USB cable. Your device’s notification light should shine blue to confirm it’s in Fastboot mode.
When the flashing is completed, reboot your device by entering: