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