pixel2-manifest
pixel2-manifest copied to clipboard
Minimal manifest for building Pixel 2 (XL) boot images
Minimal Pixel 2 (XL) manifest
Purpose
Currently, the state of TWRP makes using AnyKernel2 very impractical. Additionally, AOSP can consume a lot of space, even with a --depth=1
flag. With this manifest, syncing and building are quicker as there are less files for ninja and soong to parse. Win win!
NOTE: Most of the still tracked repos aren't necessarily for compilation but to make the build start. This could be slimmed down by including a prebuilt recovery ramdisk but I'm not interested in that.
Size comparison (done with android-8.1.0_r1 using du -sh
):
Manifest | --clone-depth=1 ? |
Size | Projects |
---|---|---|---|
AOSP | No | 55GB | 592 |
AOSP | Yes | 43GB | 592 |
Minimal | N/A | 22GB | 206 |
Usage
- Sync the manifest
repo init -u https://github.com/nathanchance/pixel2-manifest -b 8.1.0
repo sync -j$(nproc --all)
-
Add your kernel binary (Image.lz4-dtb) to the prebuilts location (device/google/wahoo-kernel). Follow the below steps to do this if you don't know how.
-
Lunch and build!
Pixel 2:
. build/envsetup.sh
lunch aosp_walleye-user
make -j$(nproc --all) clean
make -j$(nproc --all) bootimage
Pixel 2 XL:
. build/envsetup.sh
lunch aosp_taimen-user
make -j$(nproc --all) clean
make -j$(nproc --all) bootimage
Building the kernel image
The Pixel 2 has two oddities when it comes to building the kernel: Clang and dtbo. Clang is just another compiler like GCC and dtbo stands for device tree blob overlay, which allows Google to keep the kernel source for the two Pixels unified. However, to build it, you need two tools from AOSP (dtc and mkdtimg). Here are the step by step instructions to build the kernel!
-
Sync the manifest using step 1 above.
-
Generate the dtc and mkdtimg files (these are host tools so lunch isn't necessary)
. build/envsetup.sh
make -j$(nproc --all) dtc mkdtimg
export AOSP_FOLDER=$(pwd)
-
Copy these files to somewhere in your path (like /usr/local/bin) or run
export PATH=${AOSP_FOLDER}/out/host/linux-x86/bin:${PATH}
-
Download the kernel source from Google:
git clone -b android-msm-wahoo-4.4-oreo-mr1 https://android.googlesource.com/kernel/msm ../wahoo-kernel
- Start building the kernel!
cd ../wahoo-kernel
make -j$(nproc --all) ARCH=arm64 O=out wahoo_defconfig
make -j$(nproc --all) ARCH=arm64 CC=${AOSP_FOLDER}/prebuilts/clang/host/linux-x86/clang-4053586/bin/clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=${AOSP_FOLDER}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- O=out
If successful, the kernel will be located at out/arch/arm64/boot/Image.lz4-dtb
, which you can build and flash using the Usage section above.