---
tags: Android
---
# How to compile Android kernel
## Prerequisites
### Download Kernel source from Google git
Download Android-7.0(nougat) kernel source. Its platform is "Google Nexus 6P(angler)" and kernel version is 3.10.
```
$ cd ~
$ git clone -b android-msm-angler-3.10-nougat-mr2 https://android.googlesource.com/kernel/msm/ angler
```
### Download Cross Compiler from Google
```
$ cd ~
$ mkdir bin
$ cd bin
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9
$ cd aarch64-linux-android-4.9
$ git checkout android-7.1.2_r1
```
### Setting Env for build
```
$ export SUBARCH=arm64
$ export ARCH=arm64
$ export CROSS_COMPILE=~/bin/aarch64-linux-android-4.9/bin/aarch64-linux-android-
$ cd angler
$ make clean
$ make mrproper
$ make angler_defconfig
$ make -j 8
```