Tạo bản dựng và cài đặt ROM cho các thiết bị Pixel 8 có hỗ trợ 16 KB

Trang này hướng dẫn cách tạo Pixel 8, Pixel 8 Pro và Pixel 8a có hỗ trợ 16 KB.

Đồng bộ hoá và tạo AOSP

Cách đồng bộ hoá và tạo AOSP:

  1. Kiểm tra kho lưu trữ AOSP:

     $ mkdir ~/aosp_main && cd ~/aosp_main
     $ repo init -u https://android.googlesource.com/platform/manifest -b main
     $ repo sync -c -j$(nproc)
    
  2. Chạy tập lệnh envsetup.sh để thiết lập môi trường tạo bản dựng:

     $ source build/envsetup.sh
    
  3. Chọn một trong 3 mục tiêu cho thiết bị Pixel 8:

    • aosp_husky_pgagnostic-trunk_staging-userdebug cho Pixel 8 Pro
    • aosp_shiba_pgagnostic-trunk_staging-userdebug cho Pixel 8
    • aosp_akita_16k-trunk_staging-userdebug cho Pixel 8a
     $ lunch target
    
  4. Tạo mã:

     $ m -j$(nproc)
    

    Những hình ảnh này được tạo sau khi quá trình tạo hoàn tất:

     $ 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
    

Đồng bộ hoá và tạo nhân

  1. Chọn một trong các nhân 6.1 sau:

    • android-gs-shusky-6.1-android15-qpr2-beta cho thiết bị Pixel 8 và Pixel 8 Pro
    • android-gs-akita-6.1-android15-qpr2-beta cho thiết bị Pixel 8a
  2. Đồng bộ hoá nhân:

    # 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
    
  3. Tạo nhân:

    • Để tạo kernel cho Pixel 8 hoặc Pixel 8 Pro, hãy sử dụng:

      $ ./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
      
    • Để tạo kernel cho Pixel 8a, hãy dùng:

      $ ./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
      

Tải hình ảnh của nhà cung cấp xuống

Kho lưu trữ AOSP không chứa hình ảnh nhà cung cấp. Đây là những hình ảnh bắt buộc để khởi động thiết bị. Bạn có thể tải hình ảnh xuống từ ci.android.com:

  1. Truy cập vào trang ci.android.com/git_aosp-main-with-phones-throttled.

  2. Chọn một bản dựng được đánh dấu màu xanh lục tương ứng với thiết bị của bạn:

    • Đối với Pixel 8 Pro, hãy nhấp vào biểu tượng aosp_husky_pgagnostic.

    • Đối với điện thoại Pixel 8, hãy nhấp vào biểu tượng aosp_shiba_pgagnostic.

    • Đối với Pixel 8a, hãy nhấp vào biểu tượng aosp_akita_16k.

    Thẻ Cấu phần phần mềm xuất hiện ở cuối trang.

  3. Nhấp vào Artifacts (Hiện vật). Các cấu phần phần mềm cho thiết bị của bạn sẽ xuất hiện.

  4. Để tải cấu phần phần mềm xuống, hãy nhấp vào tệp có đuôi .sh.

  5. Trong thư mục nơi tệp được tải xuống, hãy chạy lệnh sau để trích xuất nội dung:

     $ 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
    

Sao chép hình ảnh vào một thư mục tạm thời

Sao chép AOSP, kernel và hình ảnh nhà cung cấp vào một thư mục theo thứ tự sau:

 $ 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

Hình ảnh nhấp nháy

Để nhấp nháy hình ảnh, hãy làm theo các bước sau:

  1. Nạp hình ảnh phân vùng động:

     $ 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
    
  2. Nạp hình ảnh nhân hệ điều hành:

     $ 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
    
  3. Nhấn nút nguồn để khởi động thiết bị.

  4. Kiểm tra kích thước trang bằng cách:

     $ adb shell getconf PAGE_SIZE
    16384