Use Cuttlefish with 16 KB page size on ARM64

This setup requires an ARM64 Linux host. This page shows how to build and start Cuttlefish with 16 KB page size support on ARM64. The instructions on this page assume that Cuttlefish packages are installed in your machine. For instructions to install them, see Step 1 of Install Cuttlefish.

You can launch Cuttlefish by either downloading the prebuilt artifacts directly from the Android Continuous Integration site or build them from AOSP if you need to modify the source code.

Launch Cuttlefish by downloading the artifacts

Navigate to Android Continuous Integration site and enter aosp-main-throttled as the branch name. Click the latest build for the aosp_cf_arm64_phone_pgagnostic target. Now, follow the instructions from Step 5 of Install Cuttlefish.

Launch Cuttlefish by building from AOSP

Build and launch Cuttlefish with a page-agnostic target:

$ mkdir main && cd main
$ repo init -u https://android.googlesource.com/platform/manifest -b main
$ repo sync -c -j32

# Build cf agnostic target.
$ source build/envsetup.sh
$ lunch aosp_cf_arm64_phone_pgagnostic-trunk_staging-userdebug
$ m

# Launch cf with a kernel with 16 KB page size support.
$ launch_cvd
...
...
VIRTUAL_DEVICE_DISPLAY_POWER_MODE_CHANGED
virtio_input_hid_handle_status: unknown type 20
virtio_input_hid_handle_status: unknown type 20
virtio_input_hid_handle_status: unknown type 20
virtio_input_hid_handle_status: unknown type 20
Generating new secret with slot ID: 4
VIRTUAL_DEVICE_BOOT_STARTED
VIRTUAL_DEVICE_NETWORK_MOBILE_CONNECTED

Verify page size and boot

To verify page size and boot status:

  1. Access the shell as root:

    $ adb root
    adbd is already running as root
    $ adb shell
    vsoc_arm64_pgagnostic:/ #
    
  2. Verify page size and boot status:

    vsoc_arm64_pgagnostic:/ # getconf PAGE_SIZE
    16384
    vsoc_arm64_pgagnostic:/ # getprop | grep sys.boot.completed
    sys.boot_completed: 1
    

Use Cuttlefish with custom 16 KB page size kernel

To use a custom kernel, instead of a prebuilt kernel:

  1. Create a repo directory for an android common kernel and sync the directory:

    $ mkdir common-android14-6.1 && cd common-android14-6.1
    $ repo init -u https://android.googlesource.com/kernel/manifest -b common-android14-6.1
    $ repo sync -c -j$(nproc)
    
  2. Build 16 KB page size kernel:

    $ tools/bazel run --lto=none //common:kernel_aarch64_16k_dist
    $ tools/bazel run --lto=none //common-modules/virtual-device:virtual_device_aarch64_16k_dist -- \
        --dist_dir=out/android14-6.1/dist
    
  3. Verify that the build executed successfully:

    # Generated files
    $ ls out/android14-6.1/dist/Image
    $ ls out/android14-6.1/dist/initramfs.img
    

Start Cuttlefish with the custom 16 KB page size kernel

To use your newly built kernel in Cuttlefish:

$ launch_cvd -kernel_path ~/common-android14-6.1/out/android14-6.1/dist/Image \
      -initramfs_path ~/common-android14-6.1/out/android14-6.1/dist/initramfs.img \
      --resume=false --userdata_format=ext4 \
      --data_policy=always_create --blank_data_image_mb=8000
      -userdata_format=ext4