Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 1 | # Building Chrome for Chrome OS (Simple Chrome) |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 2 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 3 | This workflow allows you to quickly build/deploy Chrome to a Chrome OS |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 4 | [VM] or device without needing a Chrome OS source checkout or chroot. It's useful |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 5 | for trying out your changes on Chrome OS while you're doing Chrome |
| 6 | development. If you have an OS checkout and want your local Chrome changes to |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 7 | be included when building a full OS image, see the [OS development guide]. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 8 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 9 | At its core is the `chrome-sdk` shell which sets up the shell environment and |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 10 | fetches the necessary SDK components (Chrome OS toolchain, sysroot, VM, etc.). |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 11 | |
| 12 | [TOC] |
| 13 | |
| 14 | ## Typography conventions |
| 15 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 16 | | Label | Paths, files, and commands | |
| 17 | |---------------|-------------------------------------------------------| |
| 18 | | (shell) | outside the chroot and SDK shell on your workstation | |
| 19 | | (sdk) | inside the `chrome-sdk` SDK shell on your workstation | |
| 20 | | (chroot) | inside the `cros_sdk` chroot on your workstation | |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 21 | | (device) | in your [VM] or Chrome OS device | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 22 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 23 | |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 24 | ## Getting started |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 25 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 26 | Check out a copy of the [Chrome source code and depot_tools]. |
| 27 | Be certain to [update .gclient] to include `target_os = ["chromeos"]`. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 28 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 29 | ### Get the Google API keys |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 30 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 31 | In order to sign in to Chrome OS you must have Google API keys: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 32 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 33 | * External contributors: See [api-keys]. You'll need to put them in your |
| 34 | `out_$BOARD/Release/args.gn file`, see below. |
| 35 | * *Googlers*: See [go/chrome-build-instructions] to get the internal source. |
| 36 | If you have `src-internal` in your `.gclient` file the official API keys |
| 37 | will be set up automatically. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 38 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 39 | ### Set up gsutil |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 40 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 41 | Use depot_tools/gsutil.py and run `gsutil.py config` to set the authentication |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 42 | token. (*Googlers*: Use your @google.com account.) Otherwise steps below may run |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 43 | slowly and fail with "Login Required" from gsutil. |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 44 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 45 | When prompted for a project ID, enter `134157665460` (this is the Chrome OS |
| 46 | project ID). |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 47 | |
Ben Pastene | 957ea27 | 2019-03-18 16:06:01 | [diff] [blame] | 48 | ### Install build deps |
| 49 | |
| 50 | You'll also need to pull in Android native toolchain dependencies to build |
| 51 | ARC++ support libraries. This is done by running the |
| 52 | [install-build-deps-android.sh] script in Chrome's source code, located at |
| 53 | `$CHROME_DIR/src/build/install-build-deps-android.sh`. |
| 54 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 55 | ### VM versus Device |
| 56 | |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 57 | The easiest way to develop on Chrome OS is to use a [VM]. |
| 58 | |
| 59 | If you need to test hardware-specific features such as graphics acceleration, |
| 60 | bluetooth, mouse or input events, etc, you may also use a physical device |
| 61 | (Googlers: Chromestop has the hardware). See [Set up the Chrome OS device] for |
| 62 | details. |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 63 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 64 | --- |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 65 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 66 | ## Enter the Simple Chrome environment |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 67 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 68 | Building Chrome for Chrome OS requires a toolchain customized for each |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 69 | Chromebook model (or "board"). For the Chrome OS [VM], and non-Googlers, use |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 70 | `amd64-generic`. For a physical device, look up the [Chrome OS board name] by |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 71 | navigating to the URL `about:version` on the device. For example: |
| 72 | `Platform 10176.47.0 (Official Build) beta-channel samus` has board `samus`. |
| 73 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 74 | To enter the Simple Chrome environment, run these from within your Chrome |
| 75 | checkout: |
Steven Bennetts | 5a79a1c | 2017-11-27 20:05:47 | [diff] [blame] | 76 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 77 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 78 | (shell) cd /path/to/chrome/src |
| 79 | (shell) export BOARD=amd64-generic |
Junichi Uekawa | 4db84bb | 2019-07-02 09:33:55 | [diff] [blame] | 80 | (shell) cros chrome-sdk --board=$BOARD --log-level=info [--download-vm] [--gomadir=~/goma] |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 81 | ``` |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 82 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 83 | The command prompt will change to look like `(sdk $BOARD $VERSION)`. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 84 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 85 | Entering the Simple Chrome environment does the following: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 86 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 87 | 1. Fetches the Chrome OS toolchain and sysroot (SDK) for building Chrome. |
| 88 | 1. Creates out_$BOARD/Release and generates or updates args.gn. |
Junichi Uekawa | 4db84bb | 2019-07-02 09:33:55 | [diff] [blame] | 89 | 1. Installs and starts [Goma]. (*Non-Googlers* may need to disable this with |
| 90 | `--nogoma`, Googlers would want to reuse existing installation with |
| 91 | `--gomadir`.) |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 92 | 1. `--download-vm` will download a Chrome OS VM and a QEMU binary. |
| 93 | |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 94 | ### cros chrome-sdk options |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 95 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 96 | * `--internal` Sets up Simple Chrome to build and deploy the official *Chrome* |
| 97 | instead of *Chromium*. |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 98 | * `--gn-extra-args='extra_arg=foo other_extra_arg=bar'` For setting |
| 99 | extra gn args, e.g. 'dcheck_always_on=true'. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 100 | * `--log-level=info` Sets the log level to 'info' or 'debug' (default is |
| 101 | 'warn'). |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 102 | * `--nogn-gen` Do not run 'gn gen' automatically. |
| 103 | |
| 104 | **Chrome OS developers**: Please set `dcheck_always_on=true` and file bugs if |
| 105 | you encounter any DCHECK crashes. |
| 106 | ``` |
| 107 | (shell) cros chrome-sdk --internal --board=$BOARD --log-level=info --gn-extra-args='dcheck_always_on=true' |
| 108 | ``` |
| 109 | |
| 110 | ### cros chrome-sdk tips |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 111 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 112 | > **Important:** When you sync/update your Chrome source, the Chrome OS SDK |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 113 | > version (src/chromeos/CHROMEOS_LKGM) may change. When the SDK version changes |
| 114 | > you may need to exit and re-enter the Simple Chrome environment to |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 115 | > successfully build and deploy Chrome. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 116 | |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 117 | > **Non-Googlers**: Only generic boards have publicly available SDK downloads, |
| 118 | > so you will need to use a generic board (e.g. amd64-generic) or your own |
| 119 | > Chrome OS build (see [Using a custom Chrome OS build]). For more info and |
| 120 | > updates star [crbug.com/360342]. |
| 121 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 122 | > **Note**: See also [Using a custom Chrome OS build]. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 123 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 124 | --- |
Steven Bennetts | 5a79a1c | 2017-11-27 20:05:47 | [diff] [blame] | 125 | |
| 126 | ## Build Chrome |
| 127 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 128 | To build Chrome, run: |
| 129 | |
| 130 | ``` |
Jorge Lucangeli Obes | 12c0b7a | 2019-02-26 16:36:45 | [diff] [blame] | 131 | (sdk) autoninja -C out_${SDK_BOARD}/Release chrome nacl_helper |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 132 | ``` |
| 133 | |
Jorge Lucangeli Obes | 12c0b7a | 2019-02-26 16:36:45 | [diff] [blame] | 134 | > **Note**: Targets other than **chrome**, **nacl_helper** or |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 135 | > (optionally) **chromiumos_preflight** are not supported in Simple Chrome and |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 136 | > will likely fail. browser_tests should be run outside the Simple Chrome |
| 137 | > environment. Some unit_tests may be built in the Simple Chrome environment and |
| 138 | > run in the Chrome OS VM. For details, see |
| 139 | > [Running a Chrome Google Test binary in the VM]. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 140 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 141 | > **Note**: Simple Chrome uses [Goma]. To watch the build progress, find the |
| 142 | > Goma port (`$ echo $SDK_GOMA_PORT`) and open http://localhost:<port_number> |
| 143 | > in a browser. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 144 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 145 | > **Note:** The default extensions will be installed by the test image you use |
| 146 | > below. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 147 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 148 | --- |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 149 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 150 | ## Set up the Chrome OS device |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 151 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 152 | ### Getting started |
| 153 | |
| 154 | You need the following: |
| 155 | 1. USB flash drive 4 GB or larger (for example, a Sandisk Extreme USB 3.0) |
| 156 | 1. USB to Gigabit Ethernet adapter |
| 157 | |
| 158 | Before you can deploy your build of Chrome to the device, it needs to have a |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 159 | "test" OS image loaded on it. A test image has tools like rsync that are not |
| 160 | part of the end-user image. |
| 161 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 162 | Chrome should be deployed to a recent Chrome OS test image, ideally the |
| 163 | version shown in your SDK prompt (or `(sdk) echo $SDK_VERSION`). |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 164 | |
| 165 | ### Create a bootable USB stick |
| 166 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 167 | **Googlers**: Images for all boards are available on [go/goldeneye]: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 168 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 169 | 1. Find the matching Chrome OS version and click on the column for 'Canary' |
| 170 | or 'Dev'. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 171 | 1. Click on the dropdown icon in the 'Images' column and click on 'Unsigned |
| 172 | test image'. |
| 173 | |
| 174 | **Non-Googlers**: The build infrastructure is currently in flux. See |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 175 | [crbug.com/360342] for more details. You may need to build your own Chrome OS |
| 176 | image. |
James Cook | b181cf7 | 2017-08-04 19:41:53 | [diff] [blame] | 177 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 178 | After you download the compressed tarball containing the test image (it should |
| 179 | have "test" somewhere in the file name), extract the image by running: |
| 180 | |
| 181 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 182 | (sdk) tar xvf ~/Downloads/<image-you-downloaded> |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 183 | ``` |
| 184 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 185 | Copy the image to your USB stick using `cros flash`: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 186 | |
| 187 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 188 | (sdk) cros flash usb:// chromiumos_test_image.bin |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 189 | ``` |
| 190 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 191 | > **Tip:** If you have a Chrome OS checkout, the following can be used to |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 192 | update a device that already has a test image installed. Star |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 193 | [crbug.com/403086] for updates on a proposal to support this without a |
| 194 | Chrome OS checkout. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 195 | |
| 196 | ``` |
| 197 | .../chromeos/src $ cros flash $IP_ADDR chromiumos_test_image.bin |
| 198 | ``` |
| 199 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 200 | ### Put your Chrome OS device in dev mode |
| 201 | |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 202 | You can skip this section if you're using a [VM]. |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 203 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 204 | > **Note:** Switching to dev mode wipes all data from the device (for security |
| 205 | > reasons). |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 206 | |
James Cook | 93506b0 | 2018-01-17 06:13:07 | [diff] [blame] | 207 | Most recent devices can use the [generic instructions]. To summarize: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 208 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 209 | 1. With the device on, hit Esc + Refresh (F2 or F3) + power button |
| 210 | 1. Wait for the white "recovery screen" |
| 211 | 1. Hit Ctrl-D to switch to developer mode (there's no prompt) |
| 212 | 1. Press enter to confirm |
| 213 | 1. Once it is done, hit Ctrl-D again to boot, then wait |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 214 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 215 | From this point on you'll always see the white screen when you turn on |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 216 | the device. Press Ctrl-D to boot. |
James Cook | 93506b0 | 2018-01-17 06:13:07 | [diff] [blame] | 217 | |
| 218 | Older devices may have [device-specific instructions]. |
| 219 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 220 | *Googlers*: If the device asks you to "enterprise enroll", click the X in the |
| 221 | top-right of the dialog to skip it. Trying to use your google.com credentials |
| 222 | will result in an error. |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 223 | |
James Cook | 93506b0 | 2018-01-17 06:13:07 | [diff] [blame] | 224 | ### Enable booting from USB |
| 225 | |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 226 | By default Chromebooks will not boot off a USB stick for security reasons. |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 227 | You need to enable it. |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 228 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 229 | 1. Start the device |
| 230 | 1. Press Ctrl-Alt-F2 to get a terminal. (You can use Ctrl-Alt-F1 to switch |
| 231 | back if you need to.) |
| 232 | 1. Login as `root` (no password yet, there will be one later) |
| 233 | 1. Run `enable_dev_usb_boot` |
James Cook | 3d13538 | 2017-10-16 16:58:01 | [diff] [blame] | 234 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 235 | ### Install the test image onto your device |
| 236 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 237 | > **Note:** Do not log into this test image with a username and password you |
| 238 | > care about. The root password is public ("test0000"), so anyone with SSH |
| 239 | > access could compromise the device. Create a test Gmail account and use that. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 240 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 241 | 1. Plug the USB stick into the machine and reboot. |
| 242 | 1. At the dev-mode warning screen, press Ctrl-U to boot from the USB stick. |
| 243 | 1. Switch to terminal by pressing Ctrl-Alt-F2 |
| 244 | 1. Login as user `chronos`, password `test0000`. |
| 245 | 1. Run `/usr/sbin/chromeos-install` |
| 246 | 1. Wait for it to copy the image |
| 247 | 1. Run `poweroff` |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 248 | |
| 249 | You can now unplug the USB stick. |
| 250 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 251 | ### Connect device to Ethernet |
| 252 | |
| 253 | Use your USB-to-Ethernet adapter to connect the device to a network. |
| 254 | |
James Cook | 614fafc | 2019-01-22 23:21:02 | [diff] [blame] | 255 | *Googlers*: If your building has Ethernet jacks connected to the test VLAN |
| 256 | (e.g. white ports), use one of those jacks. Otherwise get a second Ethernet |
| 257 | adapter and see [go/shortleash] to reverse tether your Chromebook to your |
| 258 | workstation. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 259 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 260 | ### Checking the IP address |
| 261 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 262 | 1. Click the status area in the lower-right corner |
| 263 | 1. Click the network icon |
| 264 | 1. Click the circled `i` symbol in the lower-right corner |
| 265 | 1. A small window pops up that shows the IP address |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 266 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 267 | You can also run `ifconfig` from the terminal (Ctrl-Alt-F2). |
James Cook | 3a2a063 | 2018-01-18 06:21:56 | [diff] [blame] | 268 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 269 | --- |
| 270 | |
| 271 | ## Deploying Chrome to the device |
| 272 | |
| 273 | To deploy the build to a device/VM, you will need direct SSH access to it from |
| 274 | your computer. The scripts below handle everything else. |
| 275 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 276 | ### Using deploy_chrome |
| 277 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 278 | The `deploy_chrome` script uses rsync to incrementally deploy Chrome to the |
| 279 | device/VM. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 280 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 281 | Specify the build output directory to deploy from using `--build-dir`. For the |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 282 | [VM]: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 283 | |
| 284 | ``` |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 285 | (sdk) deploy_chrome --build-dir=out_${SDK_BOARD}/Release --to=localhost --port=9222 |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 286 | ``` |
| 287 | |
| 288 | For a physical device, which must be ssh-able as user 'root', you must specify |
| 289 | the IP address using `--to`: |
| 290 | |
| 291 | ``` |
| 292 | (sdk) deploy_chrome --build-dir=out_${SDK_BOARD}/Release --to=$IP_ADDR |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 293 | ``` |
| 294 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 295 | > **Note:** The first time you run this you will be prompted to remove rootfs |
| 296 | > verification from the device. This is required to overwrite /opt/google/chrome |
| 297 | > and will reboot the device. You can skip the prompt with `--force`. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 298 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 299 | ### Deploying Chrome to the user partition |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 300 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 301 | It is also possible to deploy Chrome to the user partition of the device and |
Achuith Bhandarkar | d257012 | 2018-08-03 00:56:43 | [diff] [blame] | 302 | set up a temporary mount from `/opt/google/chrome` using the option `--mount`. |
| 303 | This is useful when deploying a binary that will not otherwise fit on the |
| 304 | device, e.g.: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 305 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 306 | * When using `--nostrip` to provide symbols for backtraces. |
| 307 | * When using other compile options that produce a significantly larger image. |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 308 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 309 | ``` |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 310 | (sdk) deploy_chrome --build-dir=out_$SDK_BOARD/Release --to=$IP_ADDR --mount [--nostrip] |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 311 | ``` |
| 312 | |
Achuith Bhandarkar | d257012 | 2018-08-03 00:56:43 | [diff] [blame] | 313 | > **Note:** This also prompts to remove rootfs verification so that |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 314 | > /etc/chrome_dev.conf can be modified (see [Command-line flags and |
| 315 | > environment variables]). You can skip that by adding |
| 316 | > `--noremove-rootfs-verification`. |
| 317 | |
| 318 | #### Additional Notes: |
| 319 | |
Achuith Bhandarkar | d257012 | 2018-08-03 00:56:43 | [diff] [blame] | 320 | * The mount is transient and does not survive a reboot. The easiest way to |
| 321 | reinstate the mount is to run the same deploy_chrome command after reboot. |
| 322 | It will only redeploy binaries if there is a change. To verify that the |
| 323 | mount is active, run `findmnt /opt/google/chrome`. The output should be: |
| 324 | ``` |
| 325 | TARGET SOURCE FSTYPE OPTIONS |
| 326 | /opt/google/chrome /dev/sda1[/deploy_rootfs/opt/google/chrome] ext4 rw,nodev,noatime,resgid=20119,commit=600,data=ordered |
| 327 | ``` |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 328 | * If startup needs to be tested (i.e. before deploy_chrome can be run), a |
| 329 | symbolic link will need to be created instead: |
| 330 | * ssh to device |
Roman Sorokin | 1c9c768 | 2019-09-17 02:26:26 | [diff] [blame^] | 331 | * `mkdir /usr/local/chrome` |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 332 | * `rm -R /opt/google/chrome` |
Roman Sorokin | 1c9c768 | 2019-09-17 02:26:26 | [diff] [blame^] | 333 | * `ln -s /usr/local/chrome /opt/google/chrome` |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 334 | * `deploy_chrome --build-dir=out_${SDK_BOARD}/Release --to=$IP_ADDR |
| 335 | --nostrip` |
| 336 | * The device can then be rebooted and the unstripped version of Chrome |
| 337 | will be run. |
| 338 | * `deploy_chrome` lives under `$CHROME_DIR/src/third_party/chromite/bin`. |
| 339 | You can run `deploy_chrome` outside of a `chrome-sdk` shell. |
| 340 | |
| 341 | ## Updating the Chrome OS image |
| 342 | |
| 343 | In order to keep Chrome and Chrome OS in sync, the Chrome OS test image |
| 344 | should be updated weekly. See [Create a bootable USB stick] for a tip on |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 345 | updating an existing test device if you have a Chrome OS checkout. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 346 | |
| 347 | --- |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 348 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 349 | ## Debugging |
| 350 | |
Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 351 | ### Log files |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 352 | |
Achuith Bhandarkar | 8bca781 | 2019-02-06 20:51:10 | [diff] [blame] | 353 | [Chrome-related logs] are written to several locations on the device running a |
| 354 | test image: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 355 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 356 | * `/var/log/ui/ui.LATEST` contains messages written to stderr by Chrome |
| 357 | before its log file has been initialized. |
Achuith Bhandarkar | 8bca781 | 2019-02-06 20:51:10 | [diff] [blame] | 358 | * `/var/log/chrome/chrome` contains messages logged by Chrome both before and |
| 359 | after login since Chrome runs with `--disable-logging-redirect` on test |
| 360 | images. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 361 | * `/var/log/messages` contains messages logged by `session_manager` |
| 362 | (which is responsible for starting Chrome), in addition to kernel |
| 363 | messages when a Chrome process crashes. |
Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 364 | |
| 365 | ### Command-line flags and environment variables |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 366 | |
| 367 | If you want to tweak the command line of Chrome or its environment, you have to |
| 368 | do this on the device itself. |
| 369 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 370 | Edit the `/etc/chrome_dev.conf` (device) file. Instructions on using it are in |
| 371 | the file itself. |
| 372 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 373 | ### Custom build directories |
| 374 | |
| 375 | This step is only necessary if you run `cros chrome-sdk` with `--nogn-gen`. |
| 376 | |
| 377 | To create a GN build directory, run the following inside the chrome-sdk shell: |
| 378 | |
| 379 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 380 | (sdk) gn gen out_$SDK_BOARD/Release --args="$GN_ARGS" |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 381 | ``` |
| 382 | |
| 383 | This will generate `out_$SDK_BOARD/Release/args.gn`. |
| 384 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 385 | * You must specify `--args`, otherwise your build will not work on the device. |
| 386 | * You only need to run `gn gen` once within the same `cros chrome-sdk` |
| 387 | session. |
| 388 | * However, if you exit the session or sync/update Chrome the `$GN_ARGS` might |
| 389 | change and you need to `gn gen` again. |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 390 | |
| 391 | You can edit the args with: |
| 392 | |
| 393 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 394 | (sdk) gn args out_$SDK_BOARD/Release |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 395 | ``` |
| 396 | |
| 397 | You can replace `Release` with `Debug` (or something else) for different |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 398 | configurations. See [Debug builds]. |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 399 | |
| 400 | [GN build configuration] discusses various GN build configurations. For more |
| 401 | info on GN, run `gn help` on the command line or read the [quick start guide]. |
| 402 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 403 | ### Debug builds |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 404 | |
| 405 | For cros chrome-sdk GN configurations, Release is the default. A debug build of |
| 406 | Chrome will include useful tools like DCHECK and debug logs like DVLOG. For a |
| 407 | Debug configuration, specify |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 408 | `--args="$GN_ARGS is_debug=true is_component_build=false"`. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 409 | |
| 410 | Alternately, you can just turn on DCHECKs for a release build. You can do this |
| 411 | with `--args="$GN_ARGS dcheck_always_on=true"`. |
| 412 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 413 | To deploy a debug build you need to add `--nostrip` to `deploy_chrome` because |
| 414 | otherwise it will strip symbols even from a debug build. This requires |
| 415 | [Deploying Chrome to the user partition]. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 416 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 417 | > **Note:** If you just want crash backtraces in the logs you can deploy a |
| 418 | > release build with `--nostrip`. You don't need a debug build (but you still |
| 419 | > need to deploy to a user partition). |
| 420 | > |
| 421 | > **Note:** You may hit `DCHECKs` during startup time, or when you login, which |
| 422 | > eventually may reboot the device. You can check log files in `/var/log/chrome` |
| 423 | > or `/home/chronos/user/log`. |
| 424 | > |
| 425 | > You can create `/run/disable_chrome_restart` to prevent a restart loop and |
| 426 | > investigate. |
| 427 | > |
| 428 | > You can temporarily disable these `DCHECKs` to proceed, but please file a |
| 429 | > bug for such `DCHECK` because it's most likely a bug. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 430 | |
| 431 | ### Remote GDB |
| 432 | |
Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 433 | Core dumps are disabled by default. See [additional debugging tips] for how to |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 434 | enable core files. |
| 435 | |
| 436 | On the target machine, open up a port for the gdb server to listen on, and |
Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 437 | attach the gdb server to the top-level Chrome process. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 438 | |
| 439 | ``` |
| 440 | (device) sudo /sbin/iptables -A INPUT -p tcp --dport 1234 -j ACCEPT |
Steven Bennetts | 8a0efd9 | 2018-11-27 17:32:52 | [diff] [blame] | 441 | (device) sudo gdbserver --attach :1234 $(pgrep chrome -P $(pgrep session_manager)) |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 442 | ``` |
| 443 | |
| 444 | On your host machine (inside the chrome-sdk shell), run gdb and start the Python |
| 445 | interpreter: |
| 446 | |
| 447 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 448 | (sdk) cd %CHROME_DIR%/src |
| 449 | (sdk) gdb out_${SDK_BOARD}/Release/chrome |
| 450 | Reading symbols from /usr/local/google2/chromium2/src/out_amd64-generic/Release/chrome... |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 451 | (gdb) pi |
| 452 | >>> |
| 453 | ``` |
| 454 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 455 | > **Note:** These instructions are for targeting an x86_64 device. For now, to |
| 456 | > target an ARM device, you need to run the cross-compiled gdb from within a |
| 457 | > chroot. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 458 | |
| 459 | Then from within the Python interpreter, run these commands: |
| 460 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 461 | ```python |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 462 | import os |
| 463 | sysroot = os.environ['SYSROOT'] |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 464 | board = os.environ['SDK_BOARD'] |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 465 | gdb.execute('set sysroot %s' % sysroot) |
| 466 | gdb.execute('set solib-absolute-prefix %s' % sysroot) |
| 467 | gdb.execute('set debug-file-directory %s/usr/lib/debug' % sysroot) |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 468 | # "Debug" for a debug build |
| 469 | gdb.execute('set solib-search-path out_%s/Release/lib' % board) |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 470 | gdb.execute('target remote $IP_ADDR:1234') |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 471 | ``` |
| 472 | |
| 473 | If you wish, after you connect, you can Ctrl-D out of the Python shell. |
| 474 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 475 | Extra debugging instructions are located at [debugging tips]. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 476 | |
| 477 | --- |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 478 | |
| 479 | ## Additional instructions |
| 480 | |
| 481 | ### Updating the version of the Chrome OS SDK |
| 482 | |
| 483 | When you invoke `cros chrome-sdk`, the script fetches the version of the SDK |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 484 | that corresponds to your Chrome checkout. To update the SDK, sync your Chrome |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 485 | checkout and re-run `cros chrome-sdk`. |
| 486 | |
| 487 | **IMPORTANT NOTES:** |
| 488 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 489 | * Every time that you update Chrome or the Chrome OS SDK, it is possible |
| 490 | that Chrome may start depending on new features from a new Chrome OS |
| 491 | image. This can cause unexpected problems, so it is important to update |
| 492 | your image regularly. Instructions for updating your Chrome OS image are |
| 493 | above in [Set up the Chrome OS device]. This is not a concern for a |
| 494 | downloaded VM. |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 495 | * Don't forget to re-configure your custom build directories if you have them |
| 496 | (see [Custom build directories]). |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 497 | |
| 498 | ### Specifying the version of the Chrome OS SDK to use |
| 499 | |
| 500 | You can specify a version of Chrome OS to build against. This is handy for |
| 501 | tracking down when a particular bug was introduced. |
| 502 | |
| 503 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 504 | (shell) cros chrome-sdk --board=$BOARD --version=11005.0.0 |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 505 | ``` |
| 506 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 507 | Once you are finished testing the old version of the chrome-sdk, you can |
| 508 | always start a new shell with the latest version again. Here's an example: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 509 | |
| 510 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 511 | (shell) cros chrome-sdk --board=$BOARD --clear-sdk-cache |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 512 | ``` |
| 513 | |
| 514 | ### Updating Chrome |
| 515 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 516 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 517 | (sdk) exit |
| 518 | (shell) git checkout master && git pull # (or if you prefer, git rebase-update) |
| 519 | (shell) gclient sync |
| 520 | (shell) cros chrome-sdk --board=$BOARD --log-level=info |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 521 | ``` |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 522 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 523 | > **Tip:** If you update Chrome inside the chrome-sdk, you may then be using an |
| 524 | > SDK that is out of date with the current Chrome. |
| 525 | > See [Updating the version of the Chrome OS SDK] section above. |
| 526 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 527 | |
| 528 | ### Updating Deployed Files |
| 529 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 530 | `deploy_chrome` determines which files to copy in `chrome_util.py` in the |
| 531 | [chromite repo] which is pulled into `chrome/src/third_party/chromite` via DEPS. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 532 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 533 | When updating the list: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 534 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 535 | 1. Make changes to the appropriate list (e.g. `_COPY_PATHS_CHROME`). |
| 536 | 1. Be aware that deploy_chrome is used by the chromeos-chrome ebuild, so when |
| 537 | adding new files make sure to set optional=True initially. |
| 538 | 1. Changes to chromite will not affect Simple Chrome until a chromite roll |
| 539 | occurs. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 540 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 541 | ### Using a custom Chrome OS build |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 542 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 543 | If you are making changes to Chrome OS and have a Chrome OS build inside a |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 544 | chroot that you want to build against, run `cros chrome-sdk` with the `--chroot` |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 545 | option: |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 546 | |
| 547 | ``` |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 548 | (shell) cros chrome-sdk --board=$BOARD --chroot=/path/to/chromiumos/chroot |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 549 | ``` |
| 550 | |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 551 | ### Using cros flash with xbuddy to download images |
| 552 | |
| 553 | `cros flash` with `xbuddy` will automatically download an image and write it to |
| 554 | USB for you. It's very convenient, but for now it requires a full Chrome OS |
| 555 | checkout and must be run inside the Chrome OS chroot. ([issue 437877]) |
| 556 | |
| 557 | ``` |
Satoru Takabayashi | e0af9cb | 2017-06-23 05:26:08 | [diff] [blame] | 558 | (chroot) cros flash usb:// xbuddy://remote/$BOARD/<version>/test |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 559 | ``` |
| 560 | |
| 561 | Replace `$BOARD` and `<version>` with the right values. Both can be seen in your |
| 562 | SDK prompt (e.g. `(sdk lumpy R27-3789.0.0)` is the lumpy board using version |
| 563 | R27-3789.0.0). |
| 564 | |
| 565 | See the [Cros Flash page] for more details. |
| 566 | |
Harry Cutts | 2cfd02d | 2019-03-23 00:33:11 | [diff] [blame] | 567 | ### Running tests |
| 568 | |
Xiyuan Xia | 6c8ef61 | 2019-04-26 22:30:22 | [diff] [blame] | 569 | Chrome's unit and browser tests are compiled into test binaries. At the moment, |
| 570 | not all of them run on a Chrome OS device. Most of the unit tests and part of |
| 571 | interactive_ui_tests that measure Chrome OS performance should work. |
| 572 | |
| 573 | To build and run a chrome test on device (or VM), |
| 574 | ```bash |
| 575 | (sdk) .../chrome/src $ cros_run_test --build --device=$IP --chrome-test -- \ |
David Pursehouse | b3b7da1 | 2019-06-17 12:23:39 | [diff] [blame] | 576 | out_$SDK_BOARD/Release/interactive_ui_tests \ |
Xiyuan Xia | 6c8ef61 | 2019-04-26 22:30:22 | [diff] [blame] | 577 | --dbus-stub \ |
| 578 | --enable-pixel-output-in-tests \ |
| 579 | --gtest_filter=SplitViewTest.SplitViewResize |
| 580 | ``` |
| 581 | |
| 582 | Alternatively, manually build and use the generated `run_$TEST` scripts to run |
| 583 | like build bots: |
| 584 | ```bash |
| 585 | (sdk) .../chrome/src $ autoninja -C out_$SDK_BOARD/Release interactive_ui_tests |
| 586 | (sdk) .../chrome/src $ out_$SDK_BOARD/Release/bin/run_interactive_ui_tests \ |
| 587 | --device=$IP \ |
| 588 | --dbus-stub \ |
| 589 | --enable-pixel-output-in-tests \ |
| 590 | --gtest_filter=SplitViewTest.SplitViewResize |
| 591 | ``` |
| 592 | |
| 593 | To run tests locally on dev box, follow the [instructions for running tests on |
| 594 | Linux] using a separate GN build directory with `target_os = "chromeos"` in its |
| 595 | arguments. (You can create one using the `gn args` command.) |
Harry Cutts | 2cfd02d | 2019-03-23 00:33:11 | [diff] [blame] | 596 | |
| 597 | If you're running tests which create windows on-screen, you might find the |
| 598 | instructions for using an embedded X server in [web_tests_linux.md] useful. |
| 599 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 600 | ### Setting a custom prompt |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 601 | |
| 602 | By default, cros chrome-sdk prepends something like '`(sdk link R52-8315.0.0)`' |
Satoru Takabayashi | 7cc76c9 | 2017-06-26 04:46:05 | [diff] [blame] | 603 | to the prompt (with the version of the prebuilt system being used). |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 604 | |
| 605 | If you prefer to colorize the prompt, you can set `PS1` in |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 606 | `~/.chromite/chrome_sdk.bashrc`, e.g. to prepend a yellow |
| 607 | '`(sdk link 8315.0.0)`' to the prompt: |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 608 | |
| 609 | ``` |
| 610 | PS1='\[\033[01;33m\](sdk ${SDK_BOARD} ${SDK_VERSION})\[\033[00m\] \w \[\033[01;36m\]$(__git_ps1 "(%s)")\[\033[00m\] \$ ' |
| 611 | ``` |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 612 | NOTE: Currently the release version (e.g. 52) is not available as an |
| 613 | environment variable. |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 614 | |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 615 | ### GYP |
| 616 | |
James Cook | 961c57d | 2018-01-23 21:34:05 | [diff] [blame] | 617 | The legacy `GYP` build system is no longer supported. |
James Cook | ba126f1 | 2017-08-21 19:59:07 | [diff] [blame] | 618 | |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 619 | [Custom build directories]: #custom-build-directories |
| 620 | [Updating the version of the Chrome OS SDK]: #updating-the-version-of-the-chrome-os-sdk |
| 621 | [Using a custom Chrome OS build]: #using-a-custom-chrome-os-build |
| 622 | [Command-line flags and environment variables]: #command-line-flags-and-environment-variables |
| 623 | [Deploying Chrome to the user partition]: #deploying-chrome-to-the-user-partition |
| 624 | [Debug builds]: #debug-builds |
| 625 | [Create a bootable USB stick]: #create-a-bootable-usb-stick |
| 626 | [Set up the Chrome OS device]: #set-up-the-chrome-os-device |
| 627 | [OS development guide]: https://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md |
| 628 | [Chrome source code and depot_tools]: https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md |
Harry Cutts | 2cfd02d | 2019-03-23 00:33:11 | [diff] [blame] | 629 | [instructions for running tests on Linux]: https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md#Running-test-targets |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 630 | [update .gclient]: https://chromium.googlesource.com/chromium/src/+/HEAD/docs/chromeos_build_instructions.md#updating-your-gclient-config |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 631 | [Chrome OS board name]: https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 632 | [GN build configuration]: https://www.chromium.org/developers/gn-build-configuration |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 633 | [quick start guide]: https://gn.googlesource.com/gn/+/master/docs/quick_start.md |
James Cook | 3d13538 | 2017-10-16 16:58:01 | [diff] [blame] | 634 | [device-specific instructions]: https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices |
| 635 | [generic instructions]: https://www.chromium.org/a/chromium.org/dev/chromium-os/developer-information-for-chrome-os-devices/generic |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 636 | [rootfs has been removed]: https://www.chromium.org/chromium-os/poking-around-your-chrome-os-device#TOC-Making-changes-to-the-filesystem |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 637 | [remounted as read-write]: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips#TOC-Setting-up-the-device |
| 638 | [additional debugging tips]: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips#TOC-Enabling-core-dumps |
Satoru Takabayashi | eef6f59 | 2017-06-23 04:16:36 | [diff] [blame] | 639 | [chromite repo]: https://chromium.googlesource.com/chromiumos/chromite/ |
| 640 | [issue 437877]: https://bugs.chromium.org/p/chromium/issues/detail?id=403086 |
Will Bradley | ca8befd | 2019-02-22 21:31:51 | [diff] [blame] | 641 | [Cros Flash page]: https://chromium.googlesource.com/chromiumos/docs/+/master/cros_flash.md |
Steven Bennetts | 0d19591 | 2018-09-18 23:37:39 | [diff] [blame] | 642 | [VM]: https://chromium.googlesource.com/chromiumos/docs/+/master/cros_vm.md |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 643 | [Running a Chrome Google Test binary in the VM]: https://chromium.googlesource.com/chromiumos/docs/+/master/cros_vm.md#Run-a-Chrome-GTest-binary-in-the-VM |
| 644 | [go/goldeneye]: https://cros-goldeneye.corp.google.com/chromeos/console/listBuild |
James Cook | 614fafc | 2019-01-22 23:21:02 | [diff] [blame] | 645 | [go/shortleash]: https://goto.google.com/shortleash |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 646 | [debugging tips]: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips |
| 647 | [go/chrome-build-instructions]: https://companydoc.corp.google.com/company/teams/chrome/chrome_build_instructions.md |
| 648 | [api-keys]: https://www.chromium.org/developers/how-tos/api-keys |
Ben Pastene | 957ea27 | 2019-03-18 16:06:01 | [diff] [blame] | 649 | [install-build-deps-android.sh]: https://chromium.googlesource.com/chromium/src/+/master/build/install-build-deps-android.sh |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 650 | [Goma]: https://sites.google.com/a/google.com/goma/ |
Achuith Bhandarkar | 8bca781 | 2019-02-06 20:51:10 | [diff] [blame] | 651 | [Chrome-related logs]: https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chrome_os_logging.md |
Achuith Bhandarkar | 61f5896 | 2018-08-29 00:05:31 | [diff] [blame] | 652 | [crbug.com/360342]: https://bugs.chromium.org/p/chromium/issues/detail?id=360342 |
| 653 | [crbug.com/403086]: https://bugs.chromium.org/p/chromium/issues/detail?id=403086 |
Harry Cutts | 2cfd02d | 2019-03-23 00:33:11 | [diff] [blame] | 654 | [web_tests_linux.md]: https://chromium.googlesource.com/chromium/src/+show/master/docs/web_tests_linux.md |