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:
PREREQS:
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
PATH="$HOME/kernel-build-tools/build-tools/linux-x86/bin:$PATH"
fi
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
PATH="$HOME/platform-tools:$PATH"
fi
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
STEPS:
AOSP REPO:
cd ~/
mkdir aosp && cd aosp
repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r38 --depth=1
repo sync
AOSP KERNEL REPO:
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]
->~/android/aosp-kernel/private/msm-google/build.config.bonito_no-cfi
Edit this file:
(orig) POST_DEFCONFIG_CMDS="check_defconfig && update_nocfi_config" ->
POST_DEFCONFIG_CMDS="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
CONFIG_NETFILTER_XT_TARGET_HL=y
CONFIG_NETFILTER_XT_TARGET_HMARK=y
[Need a blank carriage return at bottom!]
BUILD Image.lz4 via AOSP Kernel repo: (I tried both)
build/build.sh
-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
FLASH TO PHONE:
adb reboot bootloader
fastboot flash boot boot.img
fastboot reboot
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/…