本頁面說明如何建構支援 16 KB 的 Pixel 8、Pixel 8 Pro 和 Pixel 8a。
同步及建構 Android 開放原始碼計畫
如要同步及建構 AOSP,請執行下列操作:
- 查看 AOSP 存放區: - $ mkdir ~/aosp_main && cd ~/aosp_main $ repo init -u https://android.googlesource.com/platform/manifest -b main $ repo sync -c -j$(nproc)
- 為設定建構環境,請為 - envsetup.sh指令碼提供來源:- $ source build/envsetup.sh
- 為 Pixel 8 裝置選擇下列其中一個目標: - aosp_husky_pgagnostic-trunk_staging-userdebug(適用於 Pixel 8 Pro)
- aosp_shiba_pgagnostic-trunk_staging-userdebugPixel 8
- aosp_akita_16k-trunk_staging-userdebugfor Pixel 8a
 - _16k後置字元。- $ lunch target
- 建構程式碼: - $ m -j$(nproc)- 建構完成後,系統會生成下列圖片: - $ ls out/target/product/<husky|shiba|akita>/*.img out/target/product/husky/boot.img out/target/product/husky/vbmeta.img out/target/product/husky/dtb.img out/target/product/husky/vbmeta_system.img out/target/product/husky/dtbo.img out/target/product/husky/vendor-bootconfig.img out/target/product/husky/init_boot.img out/target/product/husky/vendor_boot-debug.img out/target/product/husky/product.img out/target/product/husky/vendor_boot.img out/target/product/husky/pvmfw.img out/target/product/husky/vendor_boot-test-harness.img out/target/product/husky/ramdisk.img out/target/product/husky/vendor.img out/target/product/husky/super_empty.img out/target/product/husky/vendor_kernel_boot.img out/target/product/husky/system_dlkm.img out/target/product/husky/vendor_kernel_ramdisk.img out/target/product/husky/system_ext.img out/target/product/husky/vendor_ramdisk-debug.img out/target/product/husky/system.img out/target/product/husky/vendor_ramdisk.img out/target/product/husky/system_other.img out/target/product/husky/vendor_ramdisk-test-harness.img out/target/product/husky/userdata.img
同步及建構核心
- 選取下列其中一個 6.1 核心: - android-gs-shusky-6.1-android15-qpr2-beta(適用於 Pixel 8 和 Pixel 8 Pro 裝置)
- Pixel 8a 裝置android-gs-akita-6.1-android15-qpr2-beta
 
- 同步處理核心: - # Sync the kernel. $ mkdir ~/android-gs-shusky-6.1 $ cd ~/android-gs-shusky-6.1 $ repo init -u https://android.googlesource.com/kernel/manifest -b kernel $ repo sync -c -j6
- 建構核心: - 如要為 Pixel 8 或 Pixel 8 Pro 建構核心,請使用: - $ ./tools/bazel run \ --config=shusky \ //private/devices/google/shusky:zuma_shusky_dist \ --config=16k [dist] INFO: Copying to ~/android14-gs-pixel-6.1/out/shusky/dist
- 如要為 Pixel 8a 建構核心,請使用: - $ ./tools/bazel run \ --config=akita \ //private/devices/google/akita:zuma_akita_dist \ --confige=16k [dist] INFO: Copying to ~/android14-gs-pixel-6.1/out/akita/dist
 
下載供應商圖片
AOSP 存放區不含啟動裝置所需的供應商映像檔。你可以從 ci.android.com 下載圖片:
- 選取與裝置對應的綠色醒目顯示版本: - 如果是 Pixel 8 Pro,請按一下 - aosp_husky_pgagnostic。
- 如果是 Pixel 8,請按一下 - aosp_shiba_pgagnostic。
- 如果是 Pixel 8a,請按一下 - aosp_akita_16k。
 - 頁面底部會顯示「構件」分頁。 
- 按一下「構件」。系統會列出裝置的構件。 
- 如要下載構件,請按一下結尾為 - .sh的檔案。
- 在下載檔案的目錄中,執行下列指令來解壓縮內容: - $ cd ~/Downloads $ chmod +x aosp_<selected target>-flashable-<build id>-with-license.sh ./aosp_<selected target>-flashable-<build id>-with-license.sh # After reading the license, type Type "I ACCEPT" if you agree to the terms of the license: I ACCEPT # The extracted file will be in the current directory $ ls aosp_<selected_target>-flashable-with-license.zip # unzip that file in a directory named aosp_vendor $ unzip aosp_<selected_target>-flashable-with-license.zip -d aosp_vendor # The content of the directory will look like: $ ls aosp_vendor android-info.txt init_boot.img super_empty.img system_other.img vbmeta_vendor.img vendor_kernel_boot.img boot.img product.img system_dlkm.img userdata.img vendor_boot.img bootloader.img pvmfw.img system_ext.img vbmeta.img vendor_dlkm.img dtbo.img radio.img system.img vbmeta_system.img vendor.img
將圖片複製到臨時目錄
依序將 AOSP、核心和供應商映像檔複製到目錄中:
 $ mkdir ~/images && cd ~/images
# Copy AOSP generated images
 $ cp ~/aosp_main/out/target/product/<akita|husky|shiba>/*.img  ./images
# Copy kernel generated images
 $ cp ~/android-gs-shusky-6.1/out/<akita|shusky>/dist ./images
# Copy the vendor images
 $ cp ~/Downloads/aosp_vendor/vendor.img  ./images
 $ cp ~/Downloads/aosp_vendor/vbmeta_vendor.img ./images
Flash 圖片
如要刷入映像檔,請按照下列步驟操作:
- 刷入動態分區映像檔: - $ IMGS_DIR=~/images $ adb reboot fastboot $ fastboot flash product $IMGS_DIR/product.img $ fastboot flash system $IMGS_DIR/system.img $ fastboot flash system_ext $IMGS_DIR/system_ext.img $ fastboot flash system_dlkm $IMGS_DIR/system_dlkm.img $ fastboot flash vendor $IMGS_DIR/vendor.img $ fastboot flash vendor_dlkm $IMGS_DIR/vendor_dlkm.img
- 刷入核心映像檔: - $ fastboot reboot bootloader # Wipe out /data partition $ fastboot -w # Disable pkvm $ fastboot oem pkvm disable $ fastboot flash boot $IMGS_DIR/boot.img $ fastboot flash init_boot $IMGS_DIR/init_boot.img $ fastboot flash dtbo $IMGS_DIR/dtbo.img $ fastboot flash vendor_kernel_boot $IMGS_DIR/vendor_kernel_boot.img $ fastboot flash pvmfw $IMGS_DIR/pvmfw.img $ fastboot flash vendor_boot $IMGS_DIR/vendor_boot.img $ fastboot flash --disable-verity --disable-verification vbmeta $IMGS_DIR/vbmeta.img $ fastboot flash --disable-verity --disable-verification vbmeta_system $IMGS_DIR/vbmeta_system.img $ fastboot flash --disable-verity --disable-verification vbmeta_vendor $IMGS_DIR/vbmeta_vendor.img
- 按下電源鍵啟動裝置。 
- 使用下列指令檢查頁面大小: - $ adb shell getconf PAGE_SIZE 16384
