为 Pixel 3 构建自定义内核的 Android 11
My Environment
OS:
Debian 11
Mobile Device:
Google Pixel 3
AOSP Tag:
android-11.0.0_r1
AOSP Build ID:
RP1A.200720.009
Prepare Building Environment
Make sure you have installed adb
and
fastboot
, if not
Download from Google (recommended!!)
or
1 | sudo apt install android-tools-adb |
Install some tools
1 | sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig |
Install repo
1 | mkdir ~/.bin |
Build Kernel
Get the source code, it will take about 30GB of disk space after building.
1 | mkdir kernel && cd kernel |
1 | cd prebuilts |
android-11.0.0_r1
, checkout msm
to
commit 5bded8e40b62
. You can get this commit id in
${WORK_DIR}/android11/device/google/crosshatch-kernel/Image.lz4
after downloading the Android source. 1 | cd ${WORK_DIR}/kernel/private/msm-google |
1 | cd ${WORK_DIR}/kernel |
Build Android
Get the source, it will take about 200GB of disk space after building.
1 | mkdir android11 && cd android11 |
1 | wget https://dl.google.com/dl/android/aosp/google_devices-blueline-rp1a.200720.009-6cd41940.tgz |
1 | cp ${WORK_DIR}/kernel/out/android-msm-pixel-4.9/dist/Image.lz4 ${WORK_DIR}/android11/device/google/crosshatch-kernel/Image.lz4 |
Flash Device
After getting the building output, let's flash them to the device.
Since $ANDROID_PRODUCT_OUT
will be set automatically, we
can just use command flashall
. If not, set it to
${WORK_DIR}/android11/out/target/product/blueline
.
1 | adb reboot bootloader |
Update Drivers
Actually now your device can work well via adb. But due to driver mismatching, you may not be able to use the touchscreen, wlan etc. To fix this problem
1 | adb root |
Result
References
mkbootfs command not found while trying to build aosp kernel
Built kernel from scratch, touchscreen doesn't work?
Touchscreen not working after building and flashing clean msm kernel for the Google Pixel blueline
Pixel 3 Aosp 自编译内核如何正确的驱动设备正常运行
Gitalking ...