低于5.0的内核会卡触屏

参考链接:

Building Kernels  |  Android Open Source Project

编译

先决条件:

系统:Ubuntu20.04(最好不要有桌面)

内存:16G

安装依赖库

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
sudo apt install libssl-dev

下载源码

安装repo

mkdir ~/bin
PATH=~/bin:$PATH
curl <https://storage.googleapis.com/git-repo-downloads/repo> > ~/bin/repo
chmod a+x ~/bin/repo

国外

mkdir android-kernel && cd android-kernel
repo init -u <https://android.googlesource.com/kernel/manifest> -b BRANCH
repo sync

国内

mkdir android-kernel && cd android-kernel
export REPO_URL="<https://gerrit-googlesource.proxy.ustclug.org/git-repo>"
repo init -u git://mirrors.ustc.edu.cn/aosp/kernel/manifest -b BRANCH
repo sync

如何确定想要编译的分支,举例如下:

手机Pixel 4

去下面页面找到对应的别称,Pixel 4 对应的是:android-msm-coral-4.14-android13

Building Pixel Kernels  |  Android Open Source Project