A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 1 | # Cuttlefish Getting Started |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 2 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 3 | ## Try Cuttlefish |
Cody Schuffelen | babc8bb | 2019-10-22 18:47:40 -0700 | [diff] [blame] | 4 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 5 | 1. Make sure virtualization with KVM is available. |
Cody Schuffelen | babc8bb | 2019-10-22 18:47:40 -0700 | [diff] [blame] | 6 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 7 | ```bash |
Roger Ellis | 652db67 | 2022-01-26 13:09:58 -0800 | [diff] [blame] | 8 | grep -c -w "vmx\|svm" /proc/cpuinfo |
| 9 | ``` |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 10 | |
| 11 | This should return a non-zero value. If running on a cloud machine, this may |
| 12 | take cloud-vendor-specific steps to enable. For Google Compute Engine |
| 13 | specifically, see the [GCE guide]. |
| 14 | |
Guang Zhu | 70f1408 | 2021-09-24 12:28:50 -0700 | [diff] [blame] | 15 | [GCE guide]: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 16 | |
Guang Zhu | 70f1408 | 2021-09-24 12:28:50 -0700 | [diff] [blame] | 17 | *** promo |
| 18 | ARM specific steps: |
| 19 | - When running on an ARM machine, the most direct way is to check |
| 20 | for the existence of `/dev/kvm`. Note that this method can also be used to |
| 21 | confirm support of KVM on any environment. |
| 22 | - Before proceeding to the next step, please first follow |
| 23 | [the guide](multiarch-howto.md) to adjust APT sources. |
| 24 | *** |
| 25 | |
Guang Zhu | 6cb6294 | 2021-09-27 23:59:58 +0000 | [diff] [blame] | 26 | 2. Download, build, and install the host debian package: |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 27 | |
| 28 | ```bash |
Jorge E. Moreira | ca3d172 | 2022-01-06 12:10:37 -0800 | [diff] [blame] | 29 | sudo apt install -y git devscripts config-package-dev debhelper-compat golang |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 30 | git clone https://github.com/google/android-cuttlefish |
| 31 | cd android-cuttlefish |
Alistair Delva | 85cd7d6 | 2022-03-07 12:15:53 -0800 | [diff] [blame] | 32 | debuild -i -us -uc -b -d |
Guang Zhu | 6cb6294 | 2021-09-27 23:59:58 +0000 | [diff] [blame] | 33 | sudo dpkg -i ../cuttlefish-common_*_*64.deb || sudo apt-get install -f |
Roger Ellis | 652db67 | 2022-01-26 13:09:58 -0800 | [diff] [blame] | 34 | sudo usermod -aG kvm,cvdnetwork,render $USER |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 35 | sudo reboot |
| 36 | ``` |
| 37 | |
| 38 | The reboot will trigger installing additional kernel modules and applying |
| 39 | udev rules. |
| 40 | |
| 41 | 3. Go to http://ci.android.com/ |
| 42 | 4. Enter a branch name. Start with `aosp-master` if you don't know what you're |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 43 | looking for |
Ram Muthiah | d3816a3 | 2021-04-19 10:49:01 -0700 | [diff] [blame] | 44 | 5. Navigate to `aosp_cf_x86_64_phone` and click on `userdebug` for the latest build |
Roger Ellis | 652db67 | 2022-01-26 13:09:58 -0800 | [diff] [blame] | 45 | |
Guang Zhu | 0fc44e2 | 2022-01-26 00:22:48 +0000 | [diff] [blame] | 46 | *** promo |
| 47 | For ARM, use branch `aosp-master-throttled-copped` and device target `aosp_cf_arm64_only_phone-userdebug` |
| 48 | *** |
| 49 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 50 | 6. Click on `Artifacts` |
| 51 | 7. Scroll down to the OTA images. These packages look like |
Ram Muthiah | d3816a3 | 2021-04-19 10:49:01 -0700 | [diff] [blame] | 52 | `aosp_cf_x86_64_phone-img-xxxxxx.zip` -- it will always have `img` in the name. |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 53 | Download this file |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 54 | 8. Scroll down to `cvd-host_package.tar.gz`. You should always download a host |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 55 | package from the same build as your images. |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 56 | 9. On your local system, combine the packages: |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 57 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 58 | ```bash |
| 59 | mkdir cf |
| 60 | cd cf |
| 61 | tar xvf /path/to/cvd-host_package.tar.gz |
Ram Muthiah | d3816a3 | 2021-04-19 10:49:01 -0700 | [diff] [blame] | 62 | unzip /path/to/aosp_cf_x86_64_phone-img-xxxxxx.zip |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 63 | ``` |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 64 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 65 | 10. Launch cuttlefish with: |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 66 | |
| 67 | `$ HOME=$PWD ./bin/launch_cvd` |
| 68 | |
A. Cody Schuffelen | d5d3c1f | 2020-08-11 18:54:14 -0700 | [diff] [blame] | 69 | ## Debug Cuttlefish |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 70 | |
| 71 | You can use `adb` to debug it, just like a physical device: |
| 72 | |
| 73 | `$ ./bin/adb -e shell` |
| 74 | |
A. Cody Schuffelen | 80b5846 | 2021-05-12 15:52:24 -0700 | [diff] [blame] | 75 | ## Launch Viewer (WebRTC) |
Alistair Delva | 6ff7b06 | 2019-10-14 16:50:30 -0700 | [diff] [blame] | 76 | |
A. Cody Schuffelen | 80b5846 | 2021-05-12 15:52:24 -0700 | [diff] [blame] | 77 | When launching with `---start_webrtc` (the default), you can see a list of all |
| 78 | available devices at `https://localhost:8443` . For more information, see the |
| 79 | WebRTC on Cuttlefish |
| 80 | [documentation](https://source.android.com/setup/create/cuttlefish-ref-webrtc). |
| 81 | |
Roger Ellis | 652db67 | 2022-01-26 13:09:58 -0800 | [diff] [blame] | 82 | ## Stop Cuttlefish |
| 83 | |
| 84 | You will need to stop the virtual device within the same directory as you used |
| 85 | to launch the device. |
| 86 | |
| 87 | `$ HOME=$PWD ./bin/stop_cvd` |
| 88 | |