Intro: I had an issue getting the build to compile, but finally got it to successfully build/compile, & installed on my phone, as covered here: mkbootfs command not found while trying to build aosp kernel I followed the guide here: https://source.android.com/setup/build/building-kernels

BUT... I made NO CHANGES to the kernel as I want it to work first. My phone boots fine, but the touchscreen doesnt work! Am I missing something?

To say it again if I wasn't clear, I have vanilla AOSP Android 11, made no changes, compiled the kernel, flashed it to my phone, and the touchscreen doesnt work.

If I can't figure this out, at least I'm sharing a complete guide on how to build this...without a functional touch screen!

Here's exactly what I did:


Unlock bootloader (not covered here)

Install kernel-build-tools (not included in repo for some reason):
cd ~/
mkdir kernel-build-tools
git clone https://android.googlesource.com/kernel/prebuilts/build-tools
ls -l kernel-build-tools
nano ~/.profile
Add lines to path: (this will work as current user NOT SUDO!!)
# add Kernel tools to path
if [ -d "$HOME/kernel-build-tools/build-tools/linux-x86/bin" ] ; then
Refresh environment: source ~/.profile

Install/Setup adb & fastboot
Download adb & fastboot & unzip:
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
sudo apt-get install unzip
unzip platform-tools-latest-linux.zip -d ~
nano ~/.profile
Add lines:
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
Update environment: source ~/.profile

Install build tools:
sudo apt-get update
sudo apt-get install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev

Create build directories:
mkdir -p ~/bin
mkdir -p ~/android/lineage

Install Repo cmd:
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Fix Python:
sudo ln -s /usr/bin/python3 /usr/bin/python

Configure Git:
git config --global user.email "[email]"
git config --global user.name "[user]"

Turn on Caching to speed up build:
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 25G


cd ~/
mkdir aosp && cd aosp
repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r38 --depth=1
repo sync

cd ~/
mkdir aosp-kernel && cd aosp-kernel
repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-bonito-4.9-android11-qpr2
repo sync

KERNEL CONFIGS: (I did NOT do this; left here for reference for others)
ls -l ~/android/aosp-kernel/build.config -> [symbolic path to actual file]
Edit this file:
(orig) POST_DEFCONFIG_CMDS="check_defconfig && update_nocfi_config" ->
*Note: This file indicates the kernel config file: bonito_defconfig
Edit & add to: ~/android/aosp-kernel/private/msm-google/arch/arm64/configs/bonito_defconfig
# Kevin added - IPTables TTL support
[Need a blank carriage return at bottom!]

BUILD Image.lz4 via AOSP Kernel repo: (I tried both)
-OR: BUILD_CONFIG=./private/msm-google/build.config.bonito_no-cfi build/build.sh (if you want to specify a different build that the default)

CONVERT Image.lz4->boot.img via AOSP repo:
Copy newly created \aosp-kernel\out\android-msm-pixel-4.9\dist\Image.lz4
-> \aosp\device\google\bonito-kernel\
cd ~/android/aosp
source build/envsetup.sh
Setup device:
lunch aosp_sargo (Just lunch to get device list)
Make only boot image:
m bootimage

adb reboot bootloader
fastboot flash boot boot.img
fastboot reboot
  • Uh android-msm-bonito-4.9-android11-qpr2 Why are you using a older (beta?) kernel tag? groups.google.com/g/android-building/c/aOj7GU1X3JI/m/… Jul 8, 2021 at 21:49
  • LOL sounds like youre on to something...I used that because Im new to this :) I followed the Google guide source.android.com/setup/build/building-kernels & they say there to use android-msm-bonito-4.9-android11-qpr2 for Pixel 3a. Did I read that wrong? Is there a better way to find out this info? Where? Thanks so far!!
    – Kevin
    Jul 8, 2021 at 22:29
  • Ah website not updated. Don't know if that is your problem or not. Anyway the Google group in the link of my prior comment is probably the best source (for Nexus/Pixel/AOSP building - anything else is off-topic there). Jul 8, 2021 at 22:40
  • BTW how do "I" tell that this is an older beta tag? I'm not sure what I'm looking at in that link. Do you happen to know what "branch" I should be using, android-msm-bonito-4.9-android11-qpr3? And is that the correct repo URL, "repo init -u android.googlesource.com/kernel/manifest -b BRANCH"? Thanks!
    – Kevin
    Jul 8, 2021 at 22:58
  • And looks like I dont have permission to post on there :(
    – Kevin
    Jul 8, 2021 at 23:05

1 Answer 1


I'd to know how an issue like this still exists, but here's the fix:

File: aosp-kernel\private\msm-google\arch\arm64\configs\bonito_defconfig

Change these to "y" & rebuild:


Also found here: https://github.com/facebookexperimental/ExtendedAndroidTools/issues/3

  • I'm pretty sure this means they were being loaded as separate modules so they could be updated or something. I know this is old, but do you still have the phone around to run lsmod on? On a stock build of AOSP, these four modules are listed. Oct 19, 2022 at 16:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .