Skip to content

Commit 63dac54

Browse files
authored
Enhanced cvdr.md documentation
Made it more ad-hoc to newcomers: * Added common use case - local AOSP build * Clear separation between Debian and non-Debian cases * General flow refactor
1 parent b4bffb8 commit 63dac54

1 file changed

Lines changed: 61 additions & 26 deletions

File tree

docs/cvdr.md

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cvdr
22

3-
This page describes about `cvdr` and its usage.
3+
This page describes `cvdr` and its usage.
44

55
## What's cvdr?
66

@@ -9,13 +9,13 @@ remotely.
99
It wraps [Cloud Orchestrator](cloud_orchestrator.md), to provide user-friendly
1010
interface.
1111

12-
Please run `cvdr --help` for advanced functionalities of `cvdr` not described
13-
below, such as launching Cuttlefish with locally built image.
12+
## Install and Configure cvdr
1413

15-
## Download cvdr
14+
### Debian Prebuilt Packages
1615

1716
`cuttlefish-cvdremote` is available to download via `apt install` with adding
18-
the apt repository at Artifact Registry.
17+
the apt repository at Artifact Registry:
18+
1919
```bash
2020
sudo install -m 0755 -d /etc/apt/keyrings
2121
sudo curl -fsSL https://us-apt.pkg.dev/doc/repo-signing-key.gpg -o /etc/apt/keyrings/android-cuttlefish-artifacts.asc
@@ -29,30 +29,76 @@ sudo apt install cuttlefish-cvdremote
2929
cvdr --help
3030
```
3131

32-
## Configure cvdr
32+
To configure, modify the configuration file:
33+
34+
- System-level configuration is defined in `/etc/cvdr.toml`
35+
36+
- User-level configuration is defined in `~/.config/cvdr/cvdr.toml` and takes precedence
37+
38+
### Manual Build
39+
40+
To build `cvdr` manually, please run:
3341

34-
Please check and modify the configuration file(`~/.config/cvdr/cvdr.toml`).
35-
See either
42+
```bash
43+
git clone https://github.com/google/cloud-android-orchestration.git
44+
cd cloud-android-orchestration # Root directory of git repository
45+
go build ./cmd/cvdr
46+
```
47+
48+
The `cvdr` binary will be produced in the cloned repository.
49+
50+
To configure `cvdr`, you have to provide a configuration file by setting
51+
either `CVDR_SYSTEM_CONFIG_PATH` or `CVDR_USER_CONFIG_PATH` environment variable.
52+
53+
To create a convenient alias, please run or add to `~/.bashrc`:
54+
55+
```text
56+
export CVDR_USER_CONFIG_PATH=/path/to/cvdr.toml
57+
alias cvdr="$(realpath ./cvdr)"
58+
```
59+
60+
### Examples
61+
62+
See either
3663
[build/debian/cuttlefish_cvdremote/host/etc/cvdr.toml](/build/debian/cuttlefish_cvdremote/host/etc/cvdr.toml)
3764
or
3865
[scripts/on-premises/single-server/cvdr.toml](/scripts/on-premises/single-server/cvdr.toml)
3966
as examples of how to write a configuration file.
4067

41-
## Use cvdr
68+
## Create CVD
69+
70+
### Latest Cuttlefish x86_64 Image
4271

43-
Let's assume using the latest Cuttlefish x86_64 image enrolled in
44-
[ci.android.com](https://ci.android.com/).
72+
To launch with the latest image enrolled in [ci.android.com](https://ci.android.com/), please run:
4573

46-
Please run:
4774
```bash
4875
cvdr \
4976
--branch=aosp-main \
5077
--build_target=aosp_cf_x86_64_phone-trunk_staging-userdebug \
5178
create
5279
```
5380

54-
Then we expect the result like below.
81+
### Custom AOSP build
82+
83+
Assuming you build AOSP from scratch, ensure you run `lunch $MY_BUILD_TARGET` with your target before proceeding, see [Build Android](https://source.android.com/docs/setup/build/building) for more details.
84+
85+
To create an instance using the [build artifacts](https://cs.android.com/android/platform/superproject/+/master:device/google/cuttlefish/required_images) from your local AOSP repo, please run with your working directory being your AOSP root:
86+
87+
```bash
88+
cvdr create --local_image
89+
```
90+
91+
Alternatively, manually specify the images and create an instance:
92+
93+
```bash
94+
cvdr --local_cvd_host_pkg_src="${ANDROID_PRODUCT_OUT}/dist/cvd-host_package.tar.gz --local_images_zip_src=${ANDROID_PRODUCT_OUT}/dist/your-target-img.zip"
5595
```
96+
97+
For this to work, you have to build the .zip images using `m dist` in AOSP root beforehand.
98+
99+
On success, we expect the result like below.
100+
101+
```text
56102
Creating Host........................................ OK
57103
Fetching main bundle artifacts....................... OK
58104
Starting and waiting for boot complete............... OK
@@ -64,21 +110,10 @@ Connecting to cvd-1.................................. OK
64110
Displays: [720 x 1280 ( 320 )]
65111
Logs: http://localhost:8080/v1/zones/local/hosts/2e8137432a96f93558c838da5e590ec775a97e5a7bb20e66929d1a59eb337351/cvds/1/logs/
66112
```
113+
67114
If you want to validate, please refer the first provided URL in the output log
68115
and check if the page seems like below.
69116
Also, you should be able to see the device is enrolled via `adb devices`.
70117
![cvdr_cf_creation](resources/cvdr_cf_creation_example.png)
71118

72-
## Manually build and run cvdr
73-
74-
To build `cvdr` manually, please run:
75-
```bash
76-
git clone https://github.com/google/cloud-android-orchestration.git
77-
cd cloud-android-orchestration # Root directory of git repository
78-
go build ./cmd/cvdr
79-
```
80-
81-
To run `cvdr`, please run:
82-
```bash
83-
CVDR_USER_CONFIG_PATH=/path/to/cvdr.toml ./cvdr --help
84-
```
119+
Please run `cvdr --help` for advanced functionalities of `cvdr`, including individual commands and their flags, including how to manage or delete CVDs.

0 commit comments

Comments
 (0)