Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1 | # Chromium OS Developer Guide |
| 2 | |
Mike Frysinger | 05bebd5 | 2021-01-27 18:48:11 | [diff] [blame] | 3 | *** note |
| 4 | **Warning: This document is old & has moved. Please update any links:**<br> |
| 5 | https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_guide.md |
| 6 | *** |
| 7 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 8 | ## Introduction |
| 9 | |
| 10 | This guide describes how to work on Chromium OS. If you want to help develop |
| 11 | Chromium OS and you're looking for detailed information about how to get |
| 12 | started, you're in the right place. You can also use the [quick-start guide] |
| 13 | instead, which gives just the basic steps that work for most people. |
| 14 | |
| 15 | [TOC] |
| 16 | |
| 17 | ### Target audience |
| 18 | |
| 19 | The target audience of this guide is anyone who wants to obtain, build, or |
| 20 | contribute to Chromium OS. That includes new developers who are interested in |
| 21 | the project and who simply want to browse through the Chromium OS code, as well |
| 22 | as developers who have been working on Chromium OS for a long time. |
| 23 | |
| 24 | ### Organization & content |
| 25 | |
| 26 | This guide describes the common tasks required to develop Chromium OS. The guide |
| 27 | is organized linearly, so that developers who are new to Chromium OS can follow |
| 28 | the tasks in sequence. The tasks are grouped into the following sections: |
| 29 | |
| 30 | * [Prerequisites] |
| 31 | * [Getting the source code] |
| 32 | * [Building Chromium OS] |
| 33 | * [Installing Chromium OS on your Device] |
| 34 | * [Making changes to packages whose source code is checked into Chromium OS git repositories] |
| 35 | * [Making changes to non-cros_workon-able packages] |
| 36 | * [Using Clang to get better compiler diagnostics] |
| 37 | * [Local Debugging] |
| 38 | * [Remote Debugging] |
| 39 | * [Troubleshooting] |
| 40 | * [Running Tests] |
| 41 | * [Additional information] |
| 42 | |
| 43 | ### Typography conventions |
| 44 | |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 45 | * **Commands** are shown with different labels to indicate whether they apply |
| 46 | to (1) your build computer (the computer on which you're doing development), |
Josie Nordrum | c4b63aa | 2020-04-03 17:46:43 | [diff] [blame] | 47 | (2) the [chroot] (Chrome OS SDK) on your build computer, or (3) your Chromium OS computer (the |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 48 | device on which you run the images you build): |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 49 | |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 50 | Label | Commands |
| 51 | --- | --- |
| 52 | `(outside)` | on your build computer, outside the chroot |
| 53 | `(inside)` | inside the chroot on your build computer |
| 54 | `(in/out)` | on your build computer, either inside or outside the chroot |
| 55 | `(device)` | on your Chromium OS computer |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 56 | |
| 57 | * **Notes** are shown using the following conventions: |
| 58 | * **IMPORTANT NOTE** describes required actions and critical information |
| 59 | * **SIDE NOTE** describes explanations, related information, and |
| 60 | alternative options |
| 61 | * **TODO** describes questions or work that is needed on this document |
| 62 | |
| 63 | ### Modifying this document |
| 64 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 65 | If you're a Chromium OS developer, **YOU SHOULD UPDATE THIS DOCUMENT** and fix |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 66 | things as appropriate. See [README.md] for how to update this document. Bias |
| 67 | towards action: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 68 | |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 69 | * If you see a TODO and you know the right answer, fix it! |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 70 | * If you see something wrong, fix it. |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 71 | * If you're not sure of the perfect answer, still fix it. Stick in a TODO |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 72 | noting your uncertainty if you aren't sure, but don't let anything you know |
| 73 | to be wrong stick around. |
| 74 | |
| 75 | Please try to abide by the following guidelines when you modify this document: |
| 76 | |
| 77 | * Put all general "getting started" information directly on this page. It's OK |
| 78 | if this document grows big. |
| 79 | * If some information is also relevant for other documents, put the |
| 80 | information in this document and add links from the other documents to this |
| 81 | document. If you do not have a choice and must put information relevant to |
| 82 | getting started in other documents, add links in this document to discrete |
| 83 | chunks of information in the other documents. Following a web of links can |
| 84 | be very confusing, especially for people who are new to a project, so it's |
| 85 | very important to maintain a linear flow as much as possible. |
| 86 | * Where possible, describe a single way of doing things. If you specify |
| 87 | multiple options, provide a clear explanation why someone following the |
| 88 | instructions would pick one option over the others. If there is disagreement |
| 89 | about how to do things, consider listing alternative options in a SIDE NOTE. |
| 90 | * Keep Google-specific references to a minimum. A large number of the people |
| 91 | working on Chromium OS work at Google, and this document may occasionally |
| 92 | contain references that are only relevant to engineers at Google. Google |
| 93 | engineers, please keep such references to a minimum – Chromium OS is an open |
| 94 | source project that should stay as open as possible. |
| 95 | |
| 96 | ### More information |
| 97 | |
| 98 | This document provides an overview of the tasks required to develop Chromium |
| 99 | OS. After you've learned the basics, check out the links in the [Additional |
| 100 | information] section at the end of this document for tips and tricks, FAQs, and |
| 101 | important details (e.g., the Chromium OS directory structure, using the dev |
| 102 | server, etc.). |
| 103 | |
| 104 | Finally, if you build a Chromium OS image, please read this important note about |
| 105 | [Attribution requirements]. |
| 106 | |
| 107 | ## Prerequisites |
| 108 | |
| 109 | You must have Linux to develop Chromium OS. Any recent or up-to-date |
| 110 | distribution should work. However, we can't support everyone and their dog's |
| 111 | Linux distro, so the only official supported environment is listed below. If you |
| 112 | encounter issues with other setups, patches are generally welcomed, but please |
| 113 | do not expect us to figure out your distro. |
| 114 | |
Mike Frysinger | ff3f4e1 | 2019-02-05 21:23:44 | [diff] [blame] | 115 | * [Ubuntu] Linux (version 16.04 - Xenial) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 116 | |
Mike Frysinger | ff3f4e1 | 2019-02-05 21:23:44 | [diff] [blame] | 117 | Most developers working on Chromium OS are using Xenial (the LTS version of |
| 118 | Ubuntu) and Debian testing. It is possible that things will work if you're |
| 119 | running a different Linux distribution, but you will probably find life |
| 120 | easier if you're on one of these. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 121 | |
| 122 | * an x86_64 64-bit system for performing the build |
| 123 | |
| 124 | * an account with `sudo` access |
| 125 | |
| 126 | You need root access to run the `chroot` command and to modify the mount |
| 127 | table. **NOTE:** Do not run any of the commands listed in this document as |
| 128 | root – the commands themselves will run sudo to get root access when needed. |
| 129 | |
| 130 | * many gigabytes of RAM |
| 131 | |
| 132 | Per [this thread][RAM-thread], linking Chrome requires somewhere between 8 |
| 133 | GB and 28 GB of RAM as of March 2017; you may be able to get by with less at |
| 134 | the cost of slower builds with adequate swap space. Seeing an error like |
| 135 | `error: ld terminated with signal 9 [Killed]` while building the |
| 136 | `chromeos-chrome` package indicates that you need more RAM. If you are not |
| 137 | building your own copy of Chrome, the RAM requirements will be substantially |
| 138 | lower. |
| 139 | |
| 140 | You will have a much nicer time if you also have: |
| 141 | |
| 142 | * a fast multi-processor machine with lots of memory |
| 143 | |
| 144 | The build system is optimized to make good use of all processors, and an 8 |
| 145 | core machine will build nearly 8x faster than a single core machine. |
| 146 | |
| 147 | * a good Internet connection |
| 148 | |
| 149 | This will help for the initial download (minimum of about 2 GB) and any |
| 150 | further updates. |
| 151 | |
| 152 | ### Install git and curl |
| 153 | |
| 154 | Install the git revision control system, the curl download helper, and lvm |
Daniel Ng | 7efd91c | 2020-09-24 02:16:29 | [diff] [blame] | 155 | tools. On Ubuntu 16.04, the magic incantation to do this is (all on one line): |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 156 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 157 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 158 | (outside) |
Pawit Pornkitprasan | 8a2f235 | 2018-07-01 00:57:06 | [diff] [blame] | 159 | sudo apt-get install git-core gitk git-gui curl lvm2 thin-provisioning-tools \ |
Mike Frysinger | c4bdf29 | 2020-02-27 23:29:51 | [diff] [blame] | 160 | python-pkg-resources python-virtualenv python-oauth2client xz-utils \ |
| 161 | python3.6 |
Daniel Ng | 7efd91c | 2020-09-24 02:16:29 | [diff] [blame] | 162 | ``` |
Mike Frysinger | c4bdf29 | 2020-02-27 23:29:51 | [diff] [blame] | 163 | |
Daniel Ng | 7efd91c | 2020-09-24 02:16:29 | [diff] [blame] | 164 | More recent Debian-based distributions (such as Googlers' workstations) |
| 165 | might qualify the Python package names and you'll need to run this instead: |
Stephane Belmon | 3aa40b1 | 2020-07-23 23:51:50 | [diff] [blame] | 166 | |
Daniel Ng | 7efd91c | 2020-09-24 02:16:29 | [diff] [blame] | 167 | ```bash |
| 168 | (outside) |
| 169 | sudo apt-get install git-core gitk git-gui curl lvm2 thin-provisioning-tools \ |
| 170 | python3-pkg-resources python3-virtualenv python3-oauth2client xz-utils \ |
| 171 | python3.6 |
| 172 | ``` |
| 173 | |
| 174 | These command also installs git's graphical front end (`git gui`) and revision |
| 175 | history browser (`gitk`). |
| 176 | |
| 177 | If Python 3.5 is the default, switch it to at least Python 3.6. You can check what |
| 178 | version you're using with: |
| 179 | |
| 180 | ```bash |
| 181 | (outside) |
Mike Frysinger | c4bdf29 | 2020-02-27 23:29:51 | [diff] [blame] | 182 | python3 --version |
Daniel Ng | 7efd91c | 2020-09-24 02:16:29 | [diff] [blame] | 183 | ``` |
| 184 | |
| 185 | If the above says 3.5, or below, you'll need to switch it to 3.6+ (Googlers |
| 186 | should be wary of modifying any python configurations). This can be done with: |
| 187 | |
| 188 | ```bash |
| 189 | (outside) |
Mike Frysinger | c4bdf29 | 2020-02-27 23:29:51 | [diff] [blame] | 190 | sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 |
| 191 | sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 |
| 192 | sudo update-alternatives --config python3 |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 193 | ``` |
| 194 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 195 | ### Install depot_tools |
| 196 | |
| 197 | To get started, follow the instructions at [install depot_tools]. This step is |
| 198 | required so that you can use the repo command to get/sync the source code. |
| 199 | |
| 200 | ### Tweak your sudoers configuration |
| 201 | |
| 202 | You must tweak your sudoers configuration to turn off the tty_tickets option as |
| 203 | described in [Making sudo a little more permissive]. This is required for using |
| 204 | `cros_sdk`. |
| 205 | |
Andrew de los Reyes | 5d4f4b3 | 2020-07-15 18:41:09 | [diff] [blame] | 206 | ### Set locale |
| 207 | |
| 208 | These may not be needed if you are building on a system that you |
| 209 | already use, however if you have a clean instance on GCE, you'll need |
| 210 | to set a better locale. For example, on Debian Buster on GCE, do: |
| 211 | |
| 212 | ```bash |
| 213 | (outside) |
| 214 | sudo apt-get install locales |
| 215 | sudo dpkg-reconfigure locales |
| 216 | ``` |
| 217 | |
| 218 | When running `dpkg-reconfigure locales`, choose a language with UTF-8, |
| 219 | e.g. `en_US.UTF-8`. For this change to take effect, you will need to |
| 220 | log out and back in (closing all term windows, tmux/screen sessions, |
| 221 | etc.). |
| 222 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 223 | ### Configure git |
| 224 | |
| 225 | Setup git now. If you don't do this, you may run into errors/issues |
| 226 | later. Replace `[email protected]` and `Your Name` with your information: |
| 227 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 228 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 229 | (outside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 230 | git config --global user.email "[email protected]" |
| 231 | git config --global user.name "Your Name" |
| 232 | ``` |
| 233 | |
| 234 | ### Preparations to submit changes |
| 235 | |
| 236 | **IMPORTANT NOTE:** If you are new to Chromium OS, you can skip this step (go to |
| 237 | "[Decide where your source will live]"). This is only for people who wish to |
| 238 | make changes to the tree. Remember: anyone can post changes to Gerrit for |
| 239 | review. |
| 240 | |
| 241 | Follow the instructions [here][gerrit-guide] to setup your code review |
| 242 | account(s) and machine access credentials for the source repos. Remember a |
| 243 | @chromium.org account is not required to submit code for review. |
| 244 | |
| 245 | ### Double-check that you are running a 64-bit architecture |
| 246 | |
| 247 | Run the following command: |
| 248 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 249 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 250 | (outside) uname -m |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 251 | ``` |
| 252 | |
| 253 | You should see the result: `x86_64` |
| 254 | |
| 255 | If you see something else (for example, `i686`, which means you are on a 32-bit |
| 256 | machine or a 64-bit machine running a 32-bit OS) then you won't be able to build |
| 257 | Chromium OS. The project would happily welcome patches to fix this. |
| 258 | |
| 259 | ### Verify that your default file permissions (umask) setting is correct |
| 260 | |
| 261 | Sources need to be world-readable to properly function inside the chroot |
| 262 | (described later). For that reason, the last digit of your umask should not be |
| 263 | higher than 2, eg. '002' or '022'. Many distros have this by default, Ubuntu, |
| 264 | for instance, does not. It is essential to put the following line into your |
| 265 | `~/.bashrc` file before you checkout or sync your sources. |
| 266 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 267 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 268 | (outside) umask 022 |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 269 | ``` |
| 270 | |
| 271 | You can verify that this works by creating any file and checking if its |
| 272 | permissions are correct. |
| 273 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 274 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 275 | (outside) |
| 276 | touch ~/foo |
| 277 | ls -la ~/foo |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 278 | -rw-r--r-- 1 user group 0 2012-08-30 23:09 /home/user/foo |
| 279 | ``` |
| 280 | |
| 281 | ## Get the Source |
| 282 | |
| 283 | ### Decide where your source will live |
| 284 | |
| 285 | Chromium OS developers commonly put their source code in |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 286 | `~/chromiumos`. If you feel strongly, put your own source elsewhere, but |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 287 | note that **all commands in this document assume that your source code is in** |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 288 | `~/chromiumos`. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 289 | |
| 290 | Create the directory for your source code with this command: |
| 291 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 292 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 293 | (outside) mkdir -p ~/chromiumos |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 294 | ``` |
| 295 | |
| 296 | **IMPORTANT NOTE:** If your home directory is on NFS, you **must** place your |
| 297 | code somewhere else. Not only is it a bad idea to build directly from NFS for |
| 298 | performance reasons, but builds won't actually work (builds use sudo, and root |
| 299 | doesn't have access to your NFS mount, unless your NFS server has the |
| 300 | `no_root_squash` option). Wherever you place your source, you can still add a |
| 301 | symbolic link to it from your home directory (this is suggested), like so: |
| 302 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 303 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 304 | (outside) |
| 305 | mkdir -p /usr/local/path/to/source/chromiumos |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 306 | ln -s /usr/local/path/to/source/chromiumos ~/chromiumos |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 307 | ``` |
| 308 | |
| 309 | ### Get the source code |
| 310 | |
| 311 | Chromium OS uses [repo] to sync down source code. `repo` is a wrapper for the |
| 312 | [git] that helps deal with a large number of `git` repositories. You already |
| 313 | installed `repo` when you [installed `depot_tools` above][install depot_tools]. |
| 314 | |
| 315 | **Make sure you have followed the gerrit credentials setup instructions |
| 316 | [here][gerrit-guide].** |
| 317 | |
Tom Hughes | cd21534 | 2019-08-06 00:44:37 | [diff] [blame] | 318 | **Public:** |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 319 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 320 | (outside) |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 321 | cd ~/chromiumos |
Tom Hughes | cd21534 | 2019-08-06 00:44:37 | [diff] [blame] | 322 | repo init -u https://chromium.googlesource.com/chromiumos/manifest.git --repo-url https://chromium.googlesource.com/external/repo.git |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 323 | repo sync -j4 |
| 324 | ``` |
| 325 | |
Tom Hughes | cd21534 | 2019-08-06 00:44:37 | [diff] [blame] | 326 | **Googlers/internal manifest:** |
| 327 | ```shell |
| 328 | (outside) |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 329 | cd ~/chromiumos |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 330 | repo init -u https://chrome-internal.googlesource.com/chromeos/manifest-internal.git --repo-url https://chromium.googlesource.com/external/repo.git -b stable |
Tom Hughes | cd21534 | 2019-08-06 00:44:37 | [diff] [blame] | 331 | repo sync -j4 |
| 332 | ``` |
| 333 | |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 334 | For Googlers: the instructions above add `-b stable` to the init instructions vs |
| 335 | the external version without. This feature is known as "sync-to-green"; the |
| 336 | version of the source that you will sync to is 5-10 hours old but is guaranteed |
| 337 | to be verified by our CI system and have prebuilt binaries available. For more |
| 338 | information about this see [Sync to Green]. |
| 339 | |
Tom Hughes | cd21534 | 2019-08-06 00:44:37 | [diff] [blame] | 340 | *** note |
| 341 | **Note:** `-j4` tells `repo` to concurrently sync up to 4 repositories at once. |
| 342 | You can adjust the number based on how fast your internet connection is. For |
| 343 | the initial sync, it's generally requested that you use no more than 8 |
| 344 | concurrent jobs. (For later syncs, when you already have the majority of the |
| 345 | source local, using -j16 or so is generally okay.) |
| 346 | *** |
| 347 | |
| 348 | *** note |
| 349 | **Note:** If you are on a slow network connection or have low disk space, you |
| 350 | can use the `-g minilayout` option. This starts you out with a minimum |
| 351 | amount of source code. This isn't a particularly well tested configuration and |
| 352 | has been known to break from time-to-time, so we usually recommend against it. |
| 353 | *** |
| 354 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 355 | #### Optionally add Google API keys |
| 356 | |
| 357 | Secondly, decide whether you need to use features of Chromium that access Google |
| 358 | APIs from the image you are building (**signing in**, translating web pages, |
Nick Peterson | b5cbc6a | 2018-10-24 17:24:48 | [diff] [blame] | 359 | geolocation, etc). If the answer is yes, you will need to have keys (see |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 360 | [API Keys]) either in your include.gypi, or in a file in your home directory |
| 361 | called ".googleapikeys". If either of these file are present for step 1 of |
| 362 | building (below) they will be included automatically. If you don't have these |
| 363 | keys, these features of chromium will be quietly disabled. |
| 364 | |
| 365 | #### Branch Builds |
| 366 | |
| 367 | If you want to build on a branch, pass the branch name to repo init (e.g: `repo |
Ben Pastene | 96c25a8 | 2020-06-18 00:05:19 | [diff] [blame] | 368 | init -u <URL> [-g minilayout] -b release-R80-12739.B`). |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 369 | |
| 370 | When you use `repo init` you will be asked to confirm your name, email address, |
| 371 | and whether you want color in your terminal. This command runs quickly. The |
| 372 | `repo sync` command takes a lot longer. |
| 373 | |
| 374 | More info can be found in the [working on a branch page]. |
| 375 | |
David Pursehouse | b3b7da1 | 2019-06-17 12:23:39 | [diff] [blame] | 376 | ### Make sure you are authorized to access Google Storage (GS) buckets |
Andrew McRae | 4f3e97c | 2019-05-30 06:07:35 | [diff] [blame] | 377 | |
| 378 | Building and testing Chromium OS requires access to Google Storage. |
David Pursehouse | b3b7da1 | 2019-06-17 12:23:39 | [diff] [blame] | 379 | This is done via [gsutil]. Once configured, an authorization key is placed in `~/.boto`. |
| 380 | Every time you access the [chroot] via `cros_sdk`, the `.boto` file is copied to the [chroot]. |
Andrew McRae | 4f3e97c | 2019-05-30 06:07:35 | [diff] [blame] | 381 | If you run [gsutil] inside the chroot, it will configure the key in the chroot version of `~/.boto`, |
| 382 | but every time you re-run `cros_sdk`, it will overwrite the `~/.boto` file in the chroot. |
| 383 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 384 | ## Building Chromium OS |
| 385 | |
| 386 | ### Create a chroot |
| 387 | |
| 388 | To make sure everyone uses the same exact environment and tools to build |
| 389 | Chromium OS, all building is done inside a [chroot]. This chroot is its own |
| 390 | little world: it contains its own compiler, its own tools (its own copy of bash, |
| 391 | its own copy of sudo), etc. Now that you've synced down the source code, you |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 392 | need to create this chroot. Assuming you're already in `~/chromiumos` (or |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 393 | wherever your source lives), the command to download and install the chroot is: |
| 394 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 395 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 396 | (outside) cros_sdk |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 397 | ``` |
| 398 | |
| 399 | If this does not work, make sure you've added the depot_tools directory to your |
| 400 | PATH already (as was needed above with using `repo`). |
| 401 | |
| 402 | This will download and setup a prebuilt chroot from Chromium OS mirrors (under |
| 403 | 400M). If you prefer to rather build it from source, or have trouble accessing |
| 404 | the servers, use `cros_sdk --bootstrap`. Note that this will also enter the |
| 405 | chroot. If you prefer to build only, use `--download`. |
| 406 | |
| 407 | The command with `--bootstrap` takes about half an hour to run on a four core |
| 408 | machine. It compiles quite a bit of software, which it installs into your |
| 409 | chroot, and downloads some additional items (around 300MB). While it is building |
| 410 | you will see a regular update of the number of packages left to build. Once the |
| 411 | command finishes, the chroot will take up total disk space of a little over 3GB. |
| 412 | |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 413 | The chroot lives by default at `~/chromiumos/chroot`. Inside that |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 414 | directory you will find system directories like `/usr/bin` and `/etc`. These are |
| 415 | local to the chroot and are separate from the system directories on your |
| 416 | machine. For example, the chroot has its own version of the `ls` utility. It |
| 417 | will be very similar, but it is actually a different binary than the normal one |
| 418 | you use on your machine. |
| 419 | |
| 420 | **SIDE NOTES:** |
| 421 | |
| 422 | * You shouldn't have to create the chroot very often. Most developers create |
| 423 | it once and never touch it again unless someone explicitly sends out an |
| 424 | email telling them to recreate their chroot. |
| 425 | * The `cros_sdk` command currently doesn't work behind a proxy server, but |
| 426 | there is a [workaround][crosbug/10048]. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 427 | |
| 428 | ### Enter the chroot |
| 429 | |
| 430 | Most of the commands that Chromium OS developers use on a day-to-day basis |
| 431 | (including the commands to build a Chromium OS image) expect to be run from |
| 432 | within the chroot. You can enter the chroot by calling: |
| 433 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 434 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 435 | (outside) cros_sdk |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 436 | ``` |
| 437 | |
| 438 | This is the same command used to create the chroot, but if the chroot already |
| 439 | exists, it will just enter. |
| 440 | |
| 441 | NOTE: if you want to run a single command in the chroot (rather than entering |
| 442 | the chroot), prefix that command with `cros_sdk -- `. |
| 443 | |
| 444 | This command will probably prompt you for your password for the `sudo` command |
| 445 | (entering the chroot requires root privileges). Once the command finishes, that |
| 446 | terminal is in the chroot and you'll be in the `~/trunk/src/scripts` directory, |
| 447 | where most build commands live. In the chroot you can only see a subset of the |
| 448 | filesystem on your machine. However, through some trickery (bind mounts), you |
| 449 | will have access to the whole `src` directory from within the chroot – this is |
| 450 | so that you can build the software within the chroot. |
| 451 | |
| 452 | Note in particular that the `src/scripts` directory is the same `src/scripts` |
| 453 | directory found within the Chromium OS directory you were in before you entered |
| 454 | the chroot, even though it looks like a different location. That's because when |
| 455 | you enter the chroot, the `~/trunk` directory in the chroot is mounted such that |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 456 | it points to the main Chromium OS directory `~/chromiumos`. That means |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 457 | that changes that you make to the source code outside of the chroot immediately |
| 458 | take effect inside the chroot. |
| 459 | |
| 460 | Calling this will also install a chroot, if you don't have one yet, for example |
| 461 | by not following the above. |
| 462 | |
Nick Peterson | b5cbc6a | 2018-10-24 17:24:48 | [diff] [blame] | 463 | While in the chroot you will see a special "(cr)" prompt to remind you |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 464 | that you are there: |
| 465 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 466 | ```bash |
Nick Peterson | b5cbc6a | 2018-10-24 17:24:48 | [diff] [blame] | 467 | (cr) ((...)) johnnyrotten@flyingkite ~/trunk/src/scripts $ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 468 | ``` |
| 469 | |
| 470 | You generally cannot run programs on your filesystem from within the chroot. For |
| 471 | example, if you are using eclipse as an IDE, or gedit to edit a text file, you |
| 472 | will need to run those programs outside the chroot. As a consolation, you can |
| 473 | use vim. If you are desperate for emacs, try typing `sudo emerge emacs`. Of |
| 474 | course this command will build emacs from source so allow 5-10mins. |
| 475 | |
| 476 | **IMPORTANT NOTES**: |
| 477 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 478 | * **If you need to delete your chroot**, use `cros_sdk --delete` to delete it |
| 479 | properly. Using `rm -rf` could end up deleting your source tree due to the |
| 480 | active bind mounts. |
| 481 | |
| 482 | **SIDE NOTES:** |
| 483 | |
| 484 | * If you need to share lots of files inside and outside chroot (for example, |
| 485 | settings for your favorite editor / tools, or files downloaded by browser |
| 486 | outside chroot, etc.), read [Tips and Tricks]. |
| 487 | * There is a file system loop because inside `~/trunk` you will find the |
| 488 | chroot again. Don't think about this for too long. If you try to use `du -s |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 489 | ~/chromiumos/chroot/home` you might get a message about a corrupted |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 490 | file system. This is nothing to worry about, and just means that your |
| 491 | computer doesn't understand this loop either. (If you _can_ understand this |
| 492 | loop, try [something harder].) |
| 493 | |
| 494 | ### Select a board |
| 495 | |
| 496 | Building Chromium OS produces a disk image (usually just called an "image") that |
| 497 | can be copied directly onto the boot disk of a computer intended to run Chromium |
| 498 | OS. Depending on the specifics of that computer, you may want different files in |
| 499 | the disk image. For example, if your computer has an ARM processor, you'll want |
| 500 | to make sure that all executables in the image are compiled for the ARM |
| 501 | instruction set. Similarly, if your computer has special hardware, you'll want |
| 502 | to include a matching set of device drivers. |
| 503 | |
| 504 | Different classes of computers are referred to by Chromium OS as different |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 505 | target "boards". The following are some example boards: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 506 | |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 507 | * **amd64-generic** - builds a generic image suitable for computers with an |
| 508 | x86_64-compatible CPU (64 bit) or for running in a VM |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 509 | * **arm-generic** - builds a generic image suitable for computers with an ARM |
| 510 | CPU (32 bit) |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 511 | * **arm64-generic** - builds a generic image suitable for computers with an |
| 512 | ARM CPU (64 bit) |
| 513 | * **samus, eve, \<your board name>** - builds an image specific to the chosen |
| 514 | device (find your board name [here][Chrome OS Devices]); recommended for |
| 515 | deploying to official hardware |
| 516 | * **betty** - (Googlers only) builds an ARC++-enabled image for running in a |
| 517 | VM |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 518 | |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 519 | You need to choose a board for your first build. Be aware that the generic |
| 520 | images may not work well (or not at all) when run on official hardware. Don't |
| 521 | worry too much about this choice, though – you can always build for another |
| 522 | board later. If you want a list of known boards, you can look in |
| 523 | `~/trunk/src/overlays`. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 524 | |
| 525 | Each command in the build processes takes a `--board` parameter. To facilitate |
| 526 | this, it can be helpful to keep the name of the board in a shell variable. This |
| 527 | is not strictly necessary, but if you do this, you can simply copy and paste the |
| 528 | commands below into your terminal program. Enter the following inside your |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 529 | chroot: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 530 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 531 | ```bash |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 532 | (inside) export BOARD=<your pick of board> |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 533 | ``` |
| 534 | |
| 535 | This setting only holds while you stay in the chroot. If you leave and come |
Matthew Duggan | 472da13 | 2020-08-18 01:05:32 | [diff] [blame] | 536 | back, you need to specify this setting again. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 537 | |
| 538 | **SIDE NOTES:** |
| 539 | |
| 540 | * If you look at `~/trunk/src/overlays`, you may notice two different naming |
| 541 | patterns: `overlay-BOARD` and `overlay-variant-BOARD-VARIANT` (note the dash |
| 542 | here). If you intend to build for particular board variant, you'll want to |
| 543 | use `BOARD_VARIANT` pair (note the underscore here) as your board |
| 544 | name. E.g. for overlay-variant-peach-pi the correct value for `BOARD` would |
| 545 | be `peach_pi`. |
| 546 | |
| 547 | ### Initialize the build for a board |
| 548 | |
| 549 | To start building for a given board, issue the following command inside your |
| 550 | chroot (you should be in the `~/trunk/src/scripts` directory): |
| 551 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 552 | ```bash |
Alex Klein | 841bc6d | 2019-01-14 17:40:11 | [diff] [blame] | 553 | (inside) setup_board --board=${BOARD} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 554 | ``` |
| 555 | |
| 556 | This command sets up the board target with a default sysroot of |
| 557 | `/build/${BOARD}`. The command downloads a small amount of stuff and takes a few |
| 558 | minutes to complete. |
Evan Benn | 8fe69b1 | 2019-11-05 04:45:59 | [diff] [blame] | 559 | `setup_board` also calls `update_chroot`, which will update the toolchain if |
| 560 | `repo sync` has been run and the toolchain is out of date. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 561 | |
| 562 | **SIDE NOTES:** |
| 563 | |
| 564 | * If you pass the `--default` flag to `setup_board`, the command writes the |
| 565 | board name in the file `~/trunk/src/scripts/.default_board` (it does the |
| 566 | same thing as `echo ${BOARD} > ~/trunk/src/scripts/.default_board`). This |
| 567 | makes it so that you don't need to specify a `--board` argument to |
| 568 | subsequent commands. These instructions do not use the `--default` flag so |
| 569 | that you can explicitly see what commands are board-specific. |
Evan Benn | 8fe69b1 | 2019-11-05 04:45:59 | [diff] [blame] | 570 | * If you want to clobber your old board files and start fresh, |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 571 | try passing the `--force` flag, which deletes the old `/build/${BOARD}` |
| 572 | directory for you. Like `cros_sdk`, most people only re-run `setup_board` |
| 573 | when told to (they don't re-run it even after a `repo sync`). |
| 574 | * You can delete the board sysroot at any time with: `sudo rm -rf |
| 575 | /build/${BOARD}` |
| 576 | |
| 577 | ### Set the chronos user password |
| 578 | |
| 579 | On a Chromium OS computer, you can get command line access (and root access |
| 580 | through the `sudo` command) by logging in with the shared user account |
| 581 | `"chronos"`. You should set a password for the `chronos` user by entering the |
| 582 | command below from inside the `~/trunk/src/scripts` directory: |
| 583 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 584 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 585 | (inside) ./set_shared_user_password.sh |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 586 | ``` |
| 587 | |
| 588 | You will be prompted for a password, which will be stored in encrypted form in |
| 589 | `/etc/shared_user_passwd.txt`. |
| 590 | |
| 591 | **SIDE NOTES:** |
| 592 | |
| 593 | * The encrypted password is stored inside chroot. That means that if you |
| 594 | recreate your chroot, you have to run this command again. |
| 595 | * If you don't set a shared user password, the password for the chronos |
| 596 | account may end up being any number of things depending on some complicated |
| 597 | (and constantly evolving) formula that includes whether you build a |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 598 | developer image, whether you boot into [Developer Mode], and the current |
| 599 | state of the scripts. The password might be empty, or a well-known string |
| 600 | (such as `"test0000"` on test images), or it might be impossible to login |
| 601 | with chronos. It is strongly recommended that you simply set a shared user |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 602 | password. TODO: put a link to some place with more info about this. |
| 603 | |
| 604 | ### Build the packages for your board |
| 605 | |
| 606 | To build all the packages for your board, run the following command from inside |
| 607 | the `~/trunk/src/scripts` directory: |
| 608 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 609 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 610 | (inside) ./build_packages --board=${BOARD} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 611 | ``` |
| 612 | |
| 613 | This step is the rough equivalent of `make all` in a standard Makefile |
| 614 | system. This command handles incremental builds; you should run it whenever you |
| 615 | change something and need to rebuild it (or after you run `repo sync`). |
| 616 | |
| 617 | Normally, the build_packages command builds the stable version of a package |
| 618 | (i.e. from committed git sources), unless you are working on a package (with |
| 619 | `cros_workon`). If you are working on a package, build_packages will build using |
| 620 | your local sources. See below for information about `cros_workon`. |
| 621 | |
| 622 | **SIDE NOTES:** |
| 623 | |
Evan Benn | 8fe69b1 | 2019-11-05 04:45:59 | [diff] [blame] | 624 | * Like `setup_board`, `build_packages` also calls `update_chroot`, which will |
| 625 | update the toolchain if `repo sync` has been run and the toolchain is |
| 626 | out of date. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 627 | * Even though there are some flags that can optimize your build (like |
| 628 | `--nowithdev`, --nowithautotest, etc), you **should not** use these flags |
| 629 | (even if you don't plan on building a developer / test image). There are |
| 630 | some [issues with virtual packages] that can cause some hard-to-debug |
| 631 | differences if you use one of these flags. |
| 632 | * The `--nowithdebug` flag is an exception to the previous point. By default, |
| 633 | packages other than Chrome will be compiled in debug mode; that is, with |
| 634 | `NDEBUG` undefined and with debugging constructs like `DCHECK`, `DLOG`, and |
| 635 | the red "Debug image" message present. If you supply `--nowithdebug`, then |
| 636 | `NDEBUG` will be defined and the debugging constructs will be removed. |
| 637 | |
| 638 | * The first time you run the `build_packages` command, it will take a long |
| 639 | time (around 90 minutes on a four core machine), as it must build every |
| 640 | package, and also download about 1.7GB of source packages and 1.3GB of |
| 641 | binary packages. [See here][What does build_packages actually do?] for more |
| 642 | information about what the build_packages command actually does. In short, |
| 643 | it tries to download existing binary packages to avoid building anything |
| 644 | (and puts them in `/build/${BOARD}/packages` for subsequent builds). Failing |
| 645 | that, it downloads source packages, puts them in |
| 646 | `/var/lib/portage/distfiles-target`, and builds them. |
| 647 | |
| 648 | ### Build a disk image for your board |
| 649 | |
| 650 | Once the `build_packages` step is finished, you can build a Chromium OS-base |
| 651 | developer image by running the command below from inside the |
| 652 | `~/trunk/src/scripts` directory: |
| 653 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 654 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 655 | (inside) ./build_image --board=${BOARD} --noenable_rootfs_verification test |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 656 | ``` |
| 657 | |
Oleg Davydov | 21f1b17 | 2019-01-03 16:56:07 | [diff] [blame] | 658 | The args for `build_image` specify what type of build you want. |
| 659 | A test image (in the example above) has additional test-specific packages and |
| 660 | also accepts incoming ssh connections. |
| 661 | It is more convenient to use test images, but developers could |
| 662 | also build developer images. A developer image provides a Chromium OS-based |
| 663 | image with additional developer packages. |
| 664 | To build it use `dev` instead of `test`. |
| 665 | If building a test image, the password set using |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 666 | `set_shared_user_password.sh` will be ignored and `"test0000"` will be the |
| 667 | password instead. The `--noenable_rootfs_verification` turns off verified boot |
| 668 | allowing you to freely modify the root file system. The system is less secure |
| 669 | using this flag, however, for rapid development you may want to set this |
| 670 | flag. If you would like a more secure, locked-down version of Chromium OS, then |
| 671 | simply remove the `--noenable_rootfs_verification` flag. Finally if you want |
| 672 | just the pristine Chromium OS-based image (closest to Chrome OS but not quite |
Oleg Davydov | 21f1b17 | 2019-01-03 16:56:07 | [diff] [blame] | 673 | the same), pass in `base` rather than `test` or `dev`. Use `build_image --help` |
| 674 | for more information. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 675 | |
| 676 | The image produced by build_image will be located in |
| 677 | `~/trunk/src/build/images/${BOARD}/versionNum/` (where `versionNum` will |
| 678 | actually be a version number). The most recent image produced for a given board |
| 679 | will be symlinked to `~/trunk/src/build/images/${BOARD}/latest`. |
| 680 | |
| 681 | **IMPORTANT NOTE:** It's up to you to delete old builds that you don't |
| 682 | need. Every time you run `build_image`, the command creates files that take up |
Gwendal Grignou | d1575b7 | 2020-02-18 02:38:53 | [diff] [blame] | 683 | to **8GB of space(!)**. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 684 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 685 | ### Look at your disk image (optional) |
| 686 | |
| 687 | The preferred way to mount the image you just built to look at its contents is: |
| 688 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 689 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 690 | (inside) ./mount_gpt_image.sh --board=${BOARD} --safe --most_recent |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 691 | ``` |
| 692 | |
| 693 | If you built a test image, also make sure to add `-i chromiumos_test_image.bin` |
| 694 | to this command. |
| 695 | |
| 696 | The `--safe` option ensures you do not make accidental changes to the Root FS. |
| 697 | |
| 698 | Again, don't forget to unmount the root filesystem when you're done: |
| 699 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 700 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 701 | (inside) ./mount_gpt_image.sh --board=${BOARD} -u |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 702 | ``` |
| 703 | |
| 704 | Optionally, you can unpack the partition as separate files and mount them |
| 705 | directly: |
| 706 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 707 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 708 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 709 | cd ~/trunk/src/build/images/${BOARD}/latest |
| 710 | ./unpack_partitions.sh chromiumos_image.bin |
| 711 | mkdir -p rootfs |
| 712 | sudo mount -o loop,ro part_3 rootfs |
| 713 | ``` |
| 714 | |
| 715 | This will do a loopback mount of the rootfs from your image to the location |
| 716 | `~/trunk/src/build/images/${BOARD}/latest/rootfs` in your chroot. |
| 717 | |
| 718 | If you built with `"--noenable_rootfs_verification"` you can omit the "ro" |
| 719 | option to mount it read write. |
| 720 | |
| 721 | If you built an x86 Chromium OS image, you can probably even try chrooting into |
| 722 | the image: |
| 723 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 724 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 725 | (inside) sudo chroot ~/trunk/src/build/images/${BOARD}/latest/rootfs |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 726 | ``` |
| 727 | |
| 728 | This is a little hacky (the Chromium OS rootfs isn't really designed to be a |
| 729 | chroot for your host machine), but it seems to work pretty well. Don't forget to |
| 730 | `exit` this chroot when you're done. |
| 731 | |
| 732 | When you're done, unmount the root filesystem: |
| 733 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 734 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 735 | (inside) sudo umount ~/trunk/src/build/images/${BOARD}/latest/rootfs |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 736 | ``` |
| 737 | |
| 738 | ## Installing Chromium OS on your Device |
| 739 | |
| 740 | ### Put your image on a USB disk |
| 741 | |
| 742 | The easiest way to get your image running on your target computer is to put the |
| 743 | image on a USB flash disk (sometimes called a USB key), and boot the target |
Fletcher Woodruff | 5eb8b60 | 2018-09-18 17:50:20 | [diff] [blame] | 744 | computer from the flash disk. |
| 745 | |
| 746 | The first step is to disable auto-mounting of USB devices on your build computer |
Justin TerAvest | 809370c | 2019-12-26 18:14:28 | [diff] [blame] | 747 | as it may corrupt the disk image while it's being written. On systems that use |
| 748 | GNOME or Cinnamon, run the following: |
| 749 | ```bash |
| 750 | gsettings set org.gnome.desktop.media-handling automount false |
| 751 | gsettings set org.gnome.desktop.media-handling automount-open false |
| 752 | gsettings set org.cinnamon.desktop.media-handling automount false |
| 753 | gsettings set org.cinnamon.desktop.media-handling automount-open false |
| 754 | ``` |
| 755 | |
Gwendal Grignou | d1575b7 | 2020-02-18 02:38:53 | [diff] [blame] | 756 | Next, insert a USB flash disk (8GB or bigger) into your build computer. **This |
Justin TerAvest | 809370c | 2019-12-26 18:14:28 | [diff] [blame] | 757 | disk will be completely erased, so make sure it doesn't have anything important |
| 758 | on it**. Wait ~10 seconds for the USB disk to register, then type the following |
| 759 | command: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 760 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 761 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 762 | (inside) cros flash usb:// ${BOARD}/latest |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 763 | ``` |
| 764 | |
Fletcher Woodruff | 5eb8b60 | 2018-09-18 17:50:20 | [diff] [blame] | 765 | For more details on using this tool, see the [Cros Flash page]. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 766 | |
| 767 | When the `cros flash` command finishes, you can simply unplug your USB key and |
| 768 | it's ready to boot from. |
| 769 | |
| 770 | **IMPORTANT NOTE:** To emphasize again, `cros flash` completely replaces the |
| 771 | contents of your USB disk. Make sure there is nothing important on your USB disk |
| 772 | before you run this command. |
| 773 | |
| 774 | **SIDE NOTES:** |
| 775 | |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 776 | * If you want to create a test image (used for integration testing), see the |
| 777 | [Running Tests] section. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 778 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 779 | ### Enter Developer Mode |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 780 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 781 | See the [Developer Mode] documentation. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 782 | |
| 783 | ### Boot from your USB disk |
| 784 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 785 | After enabling [Developer Mode], you should set your system to boot from USB. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 786 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 787 | Let the device boot, login and open a shell (or switch to terminal 2 via |
| 788 | Ctrl+Alt+F2). |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 789 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 790 | Run the following command: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 791 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 792 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 793 | (device) sudo crossystem |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 794 | ``` |
| 795 | |
| 796 | You should see `"dev_boot_usb"` equal to 0. Set it to 1 to enable USB boot: |
| 797 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 798 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 799 | (device) sudo crossystem dev_boot_usb=1 |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 800 | ``` |
| 801 | |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 802 | Now reboot. On the white screen (indicating [Developer Mode] is enabled), |
| 803 | plug-in the USB disk and press `Ctrl+U` ([Debug Button Shortcuts]). |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 804 | |
| 805 | ### Installing your Chromium OS image to your hard disk |
| 806 | |
| 807 | Once you've booted from your USB key and gotten to the command prompt, you can |
| 808 | install your Chromium OS image to the hard disk on your computer with this |
| 809 | command: |
| 810 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 811 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 812 | (device) /usr/sbin/chromeos-install |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 813 | ``` |
| 814 | |
| 815 | **IMPORTANT NOTE:** Installing Chromium OS onto your hard disk will **WIPE YOUR |
| 816 | HARD DISK CLEAN**. |
| 817 | |
| 818 | ### Getting to a command prompt on Chromium OS |
| 819 | |
| 820 | Since you set the shared user password (with `set_shared_user_password.sh`) when |
| 821 | you built your image, you have the ability to login as the chronos user: |
| 822 | |
| 823 | 1. After your computer has booted to the Chromium OS login screen, press `[ |
| 824 | Ctrl ] [ Alt ] [ F2 ]` to get a text-based login prompt. ( `[ F2 ]` may |
| 825 | appear as `[ → ]` on your Notebook keyboard.) |
| 826 | 2. Login with the chronos user and enter the password you set earlier. |
| 827 | |
| 828 | Because you built an image with developer tools, you also have an alternate way |
| 829 | to get a terminal prompt. The alternate shell is a little nicer (in the very |
| 830 | least, it keeps your screen from dimming on you), even if it is a little harder |
| 831 | to get to. To use this alternate shell: |
| 832 | |
| 833 | 1. Go through the standard Chromium OS login screen (you'll need to setup a |
| 834 | network, etc.) and get to the web browser. It's OK to login as guest. |
| 835 | 2. Press `[ Ctrl ] [ Alt ] [ T ]` to get the [crosh] shell. |
| 836 | 3. Use the `shell` command to get the shell prompt. NOTE: you **don't** need to |
| 837 | enter the `chronos` password here, though you will still need the password |
| 838 | if you want to use the `sudo` command. |
| 839 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 840 | ### Building an image to run in a virtual machine |
| 841 | |
| 842 | Many times it is easier to simply run Chromium OS in a virtual machine like |
| 843 | kvm. You can adapt the previously built Chromium OS image so that it is usable |
| 844 | by `kvm` (which uses qemu images) by entering this command from the |
| 845 | `~/trunk/src/scripts` directory: |
| 846 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 847 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 848 | (inside) ./image_to_vm.sh --board=${BOARD} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 849 | ``` |
| 850 | |
| 851 | This command creates the file |
| 852 | `~/trunk/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin`. |
| 853 | |
| 854 | **SIDE NOTES:** |
| 855 | |
| 856 | * WARNING: After [crbug/710629], 'betty' is the only board regularly run |
| 857 | through pre-CQ and CQ VMTest and so is the most likely to work at |
| 858 | ToT. 'betty' is based on 'amd64-generic', though, so 'amd64-generic' is |
| 859 | likely to also work. |
| 860 | * Only KVM/QEMU VM's are actively supported at the moment. |
Jeff Carpenter | b3d4b35 | 2019-03-06 23:30:56 | [diff] [blame] | 861 | * If you built a `test` image, you also need to add the `--test` flag. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 862 | * You can specify source/destination paths with the `--from` and `--to` |
| 863 | parameters. |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 864 | * If you're interested in creating a test image (used for integration |
| 865 | testing), see the [Running Tests] section. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 866 | |
| 867 | ## Making changes to packages whose source code is checked into Chromium OS git repositories |
| 868 | |
| 869 | Now that you can build and run Chromium OS, you're ready to start making changes |
| 870 | to the code. |
| 871 | |
| 872 | **NOTE:** If you skipped to this section without building your own system image, |
Brian Norris | 406b15b | 2019-04-24 16:50:53 | [diff] [blame] | 873 | you may run into hard-to-fix dependency problems if you build your own versions |
| 874 | of system packages and try to deploy them to a system image that was built by a |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 875 | builder. If you run into trouble, try going through the full [Building Chromium |
| 876 | OS] process first and installing your own system image. |
| 877 | |
| 878 | ### Keep the tree green |
| 879 | |
| 880 | Before you start, take a moment to understand Chromium's source management |
| 881 | strategy of "keeping the tree green". For the Chromium OS project, **keeping the |
| 882 | tree green** means: |
| 883 | |
| 884 | 1. Any new commits should not destabilize the build: |
| 885 | * Images built from the tree should always have basic functionality |
| 886 | working. |
| 887 | * There may be minor functionality not working, and it may be the case, |
| 888 | for example, that you will need to use Terminal to fix or work around |
| 889 | some of the problems. |
| 890 | 2. If you must introduce unstable changes to the tree (which should happen |
| 891 | infrequently), you should use parameterization to hide new, unstable |
| 892 | functionality behind a flag that's turned off by default. The Chromium OS |
| 893 | team leaders may need to develop mechanisms for parameterizing different |
| 894 | parts of the system (such as the init script). |
| 895 | 3. Internal "dev channel" releases will be produced directly from the tree, |
| 896 | with a quick branch to check-point the release version. Any fixes required |
| 897 | for a release will be pulled from the tree, avoiding merges back to tree. |
| 898 | |
| 899 | This strategy has many benefits, including avoiding separate build trains for |
| 900 | parallel development (and the cost of supporting such development), as well as |
| 901 | avoiding large, costly merges from forked branches. |
| 902 | |
| 903 | **SIDE NOTE**: "Keep the tree green" means something a bit different for |
| 904 | Chromium OS than for Chromium, which is much further along in its life cycle. |
| 905 | |
| 906 | The steps in this section describe how to make changes to a Chromium OS package |
| 907 | whose source is checked into the Chromium OS source control |
| 908 | system. Specifically, this is a package where: |
| 909 | |
| 910 | * The `**ebuild**` for the package lives in the |
| 911 | `src/third_party/chromiumos-overlay` or `src/overlays/overlay-${BOARD}` |
| 912 | directories. |
| 913 | * There is an ebuild for the package that ends with `9999.ebuild`. |
| 914 | * The ebuild inherits from the `cros-workon` class. |
| 915 | * The ebuild has a `KEYWORDS` in the ebuild containing this architecture name |
| 916 | (like "`x86`"). |
| 917 | |
| 918 | You can see a list of all such packages by running the following command from |
| 919 | inside the `~/trunk/src/scripts` directory: |
| 920 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 921 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 922 | (inside) cros_workon --board=${BOARD} --all list |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 923 | ``` |
| 924 | |
| 925 | ### Run cros_workon start |
| 926 | |
| 927 | The first thing you need to do is to mark the package as active. Use the command |
| 928 | below, replacing `${PACKAGE_NAME}` with your package name (e.g., `chromeos-wm`): |
| 929 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 930 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 931 | (inside) cros_workon --board=${BOARD} start ${PACKAGE_NAME} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 932 | ``` |
| 933 | |
| 934 | This command: |
| 935 | |
| 936 | * Indicates that you'd like to build the `9999` version of the `ebuild` |
| 937 | instead of the stable, committed version. |
| 938 | * Indicates that you'd like to build from source every time. |
| 939 | * If you specified that you wanted the `minilayout` when you did your `repo |
| 940 | init`, this command adds a clause to your `.repo/local_manifest.xml` to tell |
| 941 | `repo` to sync down the source code for this package next time you do a |
| 942 | `repo sync`. |
| 943 | |
| 944 | ### Run repo sync |
| 945 | |
| 946 | After running `cros_workon`, sync down the sources. This is critical if you're |
| 947 | using the `minilayout`, but is probably a good idea in any case to make sure |
| 948 | that you're working with the latest code (it'll help avoid merge conflicts |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 949 | later). Run the command below anywhere under your `~/chromiumos` directory: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 950 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 951 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 952 | (in/out) repo sync |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 953 | ``` |
| 954 | |
| 955 | ### Find out which ebuilds map to which directories |
| 956 | |
| 957 | The `cros_workon` tool can help you find out what ebuilds map to each |
| 958 | directory. You can view a full list of ebuilds and directories using the |
| 959 | following command: |
| 960 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 961 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 962 | (inside) cros_workon --board=${BOARD} --all info |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 963 | ``` |
| 964 | |
| 965 | If you want to find out which ebuilds use source code from a specific directory, |
| 966 | you can use grep to find them. For example: |
| 967 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 968 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 969 | (inside) cros_workon --board=${BOARD} --all info | grep platform/ec |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 970 | ``` |
| 971 | |
| 972 | This returns the following output: |
| 973 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 974 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 975 | chromeos-base/ec-utils chromiumos/platform/ec src/platform/ec |
| 976 | ``` |
| 977 | |
| 978 | This tells you the following information: |
| 979 | |
| 980 | 1. The name of the ebuild is `chromeos-base/ec-utils` |
| 981 | 2. The path to the git repository on the server is `chromiumos/platform/ec` |
| 982 | 3. The path to the source code on your system is `src/platform/ec` |
| 983 | |
| 984 | You can similarly find what source code is associated with a given ebuild by |
| 985 | grepping for the ebuild name in the list. |
| 986 | |
| 987 | To find out where the ebuild lives: |
| 988 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 989 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 990 | (inside) equery-${BOARD} which ${PACKAGE_NAME} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 991 | ``` |
| 992 | |
| 993 | As an example, for `PACKAGE_NAME=ec-utils`, the above command might display: |
| 994 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 995 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 996 | /home/.../trunk/src/third_party/chromiumos-overlay/chromeos-base/ec-utils/ec-utils-9999.ebuild |
| 997 | ``` |
| 998 | |
| 999 | **SIDE NOTE:** If you run the same command **without** running `cros_workon` |
| 1000 | first, you can see the difference: |
| 1001 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1002 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1003 | /home/.../trunk/src/third_party/chromiumos-overlay/chromeos-base/ec-utils/ec-utils-0.0.1-r134.ebuild |
| 1004 | ``` |
| 1005 | |
| 1006 | ### Create a branch for your changes |
| 1007 | |
| 1008 | Since Chromium OS uses `repo`/`git`, you should always create a local branch |
| 1009 | whenever you make changes. |
| 1010 | |
| 1011 | First, find the source directory for the project you just used `cros_workon` |
| 1012 | on. This isn't directly related to the project name you used with |
| 1013 | `cros_workon`. (This isn't very helpful - someone with more experience, actually |
| 1014 | tell us how to find it reliably? --Meredydd) |
| 1015 | |
| 1016 | cd into that directory, in particular the `"files/"` directory in which the |
| 1017 | actual source resides. In the command below, replace `${BRANCH_NAME}` with a |
| 1018 | name that is meaningful to you and that describes your changes (nobody else will |
| 1019 | see this name): |
| 1020 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1021 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1022 | (in/out) repo start ${BRANCH_NAME} . |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1023 | ``` |
| 1024 | |
| 1025 | The branch that this creates will be based on the remote branch (which one? |
| 1026 | --Meredydd). If you've made any other local changes, they will not be present in |
| 1027 | this branch. |
| 1028 | |
| 1029 | ### Make your changes |
| 1030 | |
| 1031 | You should be able to make your changes to the source code now. To incrementally |
Jesse Schettler | 93ca29f | 2018-11-26 22:48:30 | [diff] [blame] | 1032 | compile your changes, use either `cros_workon_make` or `emerge-${BOARD}`. To use |
| 1033 | `cros_workon_make`, run |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1034 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1035 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1036 | (inside) cros_workon_make --board=${BOARD} ${PACKAGE_NAME} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1037 | ``` |
| 1038 | |
| 1039 | This will build your package inside your source directory. Change a single file, |
| 1040 | and it will rebuild only that file and re-link. If your package contains test |
| 1041 | binaries, using |
| 1042 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1043 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1044 | (inside) cros_workon_make --board=${BOARD} ${PACKAGE_NAME} --test |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1045 | ``` |
| 1046 | |
| 1047 | will build and run those binaries as well. Call `cros_workon_make --help` to see |
| 1048 | other options that are supported. |
| 1049 | |
| 1050 | You probably want to get your changes onto your device now. You need to install |
| 1051 | the changes you made by using |
| 1052 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1053 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1054 | (inside) cros_workon_make --board=${BOARD} ${PACKAGE_NAME} --install |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1055 | ``` |
| 1056 | |
Jesse Schettler | 93ca29f | 2018-11-26 22:48:30 | [diff] [blame] | 1057 | You can then rebuild an image with `build_image` and reimage your device. |
| 1058 | |
| 1059 | Alternatively, you can build your package using `emerge-${BOARD}` and quickly |
| 1060 | install it to the device by using [cros deploy]. |
| 1061 | |
| 1062 | For example, if you want to build `ec-utils` to test on your device, use |
| 1063 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1064 | ```bash |
Jesse Schettler | 93ca29f | 2018-11-26 22:48:30 | [diff] [blame] | 1065 | (inside) emerge-${BOARD} ec-utils |
| 1066 | ``` |
| 1067 | |
| 1068 | To install the package to the device, use |
| 1069 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1070 | ```bash |
Jesse Schettler | 93ca29f | 2018-11-26 22:48:30 | [diff] [blame] | 1071 | (inside) cros deploy ${IP} ec-utils |
| 1072 | ``` |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1073 | |
| 1074 | ### Set your editor |
| 1075 | |
| 1076 | Many of the commands below (in particular `git`) open up an editor. You probably |
| 1077 | want to run one of the three commands below depending on your favorite editor. |
| 1078 | |
| 1079 | If you're not a *nix expert, `nano` is a reasonable editor: |
| 1080 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1081 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1082 | export EDITOR='nano' |
| 1083 | ``` |
| 1084 | If you love `vi`: |
| 1085 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1086 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1087 | export EDITOR='vi' |
| 1088 | ``` |
| 1089 | |
| 1090 | If you love `emacs` (and don't want an X window to open up every time you do |
| 1091 | something): |
| 1092 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1093 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1094 | export EDITOR='emacs -nw' |
| 1095 | ``` |
| 1096 | |
| 1097 | You should probably add one of those lines to your `.bashrc` (or similar file) |
| 1098 | too. |
| 1099 | |
| 1100 | ### Submit changes locally |
| 1101 | |
| 1102 | When your changes look good, commit them to your local branch using `git`. Full |
| 1103 | documentation of how to use git is beyond the scope of this guide, but you might |
| 1104 | be able to commit your changes by running something like the command below from |
| 1105 | the project directory: |
| 1106 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1107 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1108 | (in/out) git commit -a |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1109 | ``` |
| 1110 | |
| 1111 | The git commit command brings up a text editor. You should describe your |
| 1112 | changes, save, and exit the editor. Note that the description you provide is |
| 1113 | only for your own use. When you upload your changes for code review, the repo |
| 1114 | upload command grabs all of your previous descriptions, and gives you a chance |
| 1115 | to edit them. |
| 1116 | |
| 1117 | ### Upload your changes and get a code review |
| 1118 | |
Mike Frysinger | cb52c09 | 2018-09-25 03:51:07 | [diff] [blame] | 1119 | Check out our [Gerrit Workflow] guide for details on our review process. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1120 | |
| 1121 | ### Clean up after you're done with your changes |
| 1122 | |
| 1123 | After you're done with your changes, you're ready to clean up. The most |
| 1124 | important thing to do is to tell `cros_workon` that you're done by running the |
| 1125 | following command: |
| 1126 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1127 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1128 | (inside) cros_workon --board=${BOARD} stop ${PACKAGE_NAME} |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1129 | ``` |
| 1130 | |
| 1131 | This command tells `cros_workon` to stop forcing the `-9999.ebuild` and to stop |
| 1132 | forcing a build from source every time. |
| 1133 | |
Mike Frysinger | cb52c09 | 2018-09-25 03:51:07 | [diff] [blame] | 1134 | If you're using the `minilayout`, doing a `cros_workon` stop **will not** remove |
| 1135 | your source code. The code will continue to stay on your hard disk and get |
| 1136 | synced down. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1137 | |
| 1138 | ## Making changes to non-cros_workon-able packages |
| 1139 | |
Andrew | 62b7d4c | 2019-11-08 17:26:54 | [diff] [blame] | 1140 | If you want to make changes to something other than packages which source is |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1141 | checked into the Chromium OS source control system, you can follow the |
| 1142 | instructions in the previous section, but skip the `cros_workon` step. Note |
| 1143 | specifically that you still need to run `repo start` to [Create a branch for |
| 1144 | your changes]. |
| 1145 | |
| 1146 | The types of changes that fall into this category include: |
| 1147 | |
| 1148 | * changes to build scripts (pretty much anything in `src/scripts`) |
| 1149 | * changes to `ebuild` files themselves (like the ones in |
| 1150 | `src/third_party/chromiumos-overlay`) |
| 1151 | * To change these files, you need to "manually uprev" the package. For |
| 1152 | example, if we're making a modification to for the Pixel overlay (link), |
| 1153 | then |
| 1154 | * `cd src/overlays/overlay-link/chromeos-base/chromeos-bsp-link` |
| 1155 | * `mv chromeos-bsp-link-0.0.2-r29.ebuild chromeos-bsp-link-0.0.2-r30.ebuild` |
| 1156 | * `chromeos-bsp-link-0.0.2-r29.ebuild` is a symlink that points to |
| 1157 | `chromeos-bsp-link-0.0.2.ebuild`. To uprev the package, simply increment the |
| 1158 | revision (r29) number. |
Andrew | 62b7d4c | 2019-11-08 17:26:54 | [diff] [blame] | 1159 | * Note: Upreving should not be done when there is an ebuild for the |
| 1160 | package that ends with `9999.ebuild`. Changes to the ebuild should |
| 1161 | usually be done in the `9999.ebuild` file. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1162 | * adding small patches to existing packages whose source code is NOT checked |
| 1163 | into Chromium OS git repositories |
| 1164 | * changes to `eclass` files (like the ones in |
| 1165 | `src/third_party/chromiumos-overlay/eclass`) |
| 1166 | * changes to the buildbot infrastructure (in `crostools`) |
Abe Levkoy | 9722648 | 2018-10-02 16:15:16 | [diff] [blame] | 1167 | * changes to Chromium OS project documentation (in `docs`) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1168 | * TODO: anything else? |
| 1169 | |
| 1170 | ### Adding small patches to existing packages |
| 1171 | |
| 1172 | When you need to add small patches to existing packages whose source code is not |
| 1173 | checked into a Chromium OS git repository (e.g. it comes from portage, and is |
| 1174 | not a `cros_workon`-able package), you need to do the following: |
| 1175 | |
| 1176 | First, find the package ebuild file under `third_party/chromiumos-overlay`. |
| 1177 | |
Robert Brandt | e355617 | 2020-04-13 16:44:29 | [diff] [blame] | 1178 | Then, [create a patch file](portage/how_to_patch_an_ebuild.md) from the exact |
| 1179 | version of the package that is used by the current ebuild. If other patches |
| 1180 | are already in the ebuild, you'll want to add your patch LAST, and build the |
| 1181 | patch off of the source that has already had the existing patches applied |
| 1182 | (either do it by hand, or set `FEATURES=noclean` and build your patch off of |
| 1183 | the temp source). Note that patch order is significant, since the ebuild |
| 1184 | expects each patch line number to be accurate after the previous patch is |
| 1185 | applied. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1186 | |
| 1187 | Place your patch in the "files" subdir of the directory that contains the ebuild |
| 1188 | file |
| 1189 | (e.g. `third_party/chromiumos-overlay/dev-libs/mypackage/files/mypackage-1.0.0-my-little-patch.patch`). |
| 1190 | |
| 1191 | Then, in the `prepare()` section of the ebuild (create one if it doesn't exist), |
| 1192 | add an epatch line: |
| 1193 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1194 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1195 | epatch "${FILESDIR}"/${P}-my-little-patch.patch |
| 1196 | ``` |
| 1197 | |
| 1198 | Lastly, you'll need to bump the revision number in the name of the ebuild file |
| 1199 | (or symlink) so the build system picks up the change. The current wisdom is that |
| 1200 | the ebuild file should be symlinked instead of being renamed. For example, if |
| 1201 | the original ebuild file is `"mypackage-1.0.0.ebuild"`, you should create a |
| 1202 | `"mypackage-1.0.0-r1.ebuild"` symbolic link that points at the original ebuild |
| 1203 | file. If that symlink already exists, create the next higher "rN" symlink. |
| 1204 | |
| 1205 | ### Making changes to the way that the chroot is constructed |
| 1206 | |
| 1207 | TODO: This section is currently a placeholder, waiting for someone to fill it |
| 1208 | in. However, a few notes: |
| 1209 | |
| 1210 | * Many of the commands that take a `--board=${BOARD}` parameter also take a |
| 1211 | `--host` parameter, which makes the commands affect the host (i.e. the |
| 1212 | chroot) rather than the board. |
| 1213 | * Most notably, `cros_workon --host` says that you want to build a package |
| 1214 | used in the chroot from source. |
| 1215 | |
| 1216 | ### Building an individual package |
| 1217 | |
| 1218 | TODO: Document this better, and add the new `cros_workon_make`. |
| 1219 | |
| 1220 | **SIDE NOTE:** To build an individual portage package, for a particular board, |
| 1221 | use `emerge-${BOARD}`. |
| 1222 | |
| 1223 | For example, if you want to build dash to test on your device: |
| 1224 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1225 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1226 | (inside) emerge-${BOARD} dash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1227 | ``` |
| 1228 | |
| 1229 | To install the package to the device, see [cros deploy]. |
| 1230 | |
David Stevens | 8e88c70 | 2019-10-21 06:38:19 | [diff] [blame] | 1231 | **SIDE NOTE:** |
| 1232 | |
| 1233 | * Typically, when building a package with `emerge-${BOARD}`, the dependencies have |
| 1234 | already been built. However, in some situations dependencies will need to be built |
| 1235 | as well. When that happens, `-jN` can be passed to `emerge-${BOARD}` to build |
| 1236 | different packages in parallel. |
| 1237 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1238 | ### Making changes to the Chromium web browser on Chromium OS |
| 1239 | |
| 1240 | If you just want to make modifications to the Chromium web browser and quickly |
| 1241 | deploy your changes to an already-built Chromium OS image, see [Making changes |
| 1242 | to the Chromium web browser on Chromium OS]. |
| 1243 | |
| 1244 | To use your local checkout of the Chromium source code when building a Chromium |
| 1245 | OS image, set the `--chrome_root` flag appropriately when entering the chroot, |
| 1246 | e.g. |
| 1247 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1248 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1249 | (outside) cros_sdk --chrome_root=~/chrome |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1250 | ``` |
| 1251 | |
| 1252 | Within the chroot, you'll also need to either start working on the |
Jeroen Dhollander | 0eca967 | 2020-04-17 17:00:29 | [diff] [blame] | 1253 | `chromeos-chrome` and `chrome-icu` packages: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1254 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1255 | ```bash |
Jeroen Dhollander | 0eca967 | 2020-04-17 17:00:29 | [diff] [blame] | 1256 | (inside) cros_workon --board=${BOARD} start chromeos-chrome chrome-icu |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1257 | ``` |
| 1258 | |
| 1259 | or set the `CHROME_ORIGIN` environment variable appropriately: |
| 1260 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1261 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1262 | (inside) export CHROME_ORIGIN=LOCAL_SOURCE |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1263 | ``` |
| 1264 | |
| 1265 | See |
| 1266 | `src/third_party/chromiumos-overlay/chromeos-base/chromeos-chrome/chromeos-chrome-9999.ebuild` |
| 1267 | for additional possible values for the `CHROME_ORIGIN` variable. |
| 1268 | |
| 1269 | If you have an internal checkout of the Google Chrome source and want to build |
| 1270 | the browser with official branding, export `USE=chrome_internal`. |
| 1271 | |
| 1272 | ## Using Clang to get better compiler diagnostics |
| 1273 | |
| 1274 | ### Description |
| 1275 | |
| 1276 | The ChromeOS toolchain provides a feature to get Clang syntax-only compiler |
| 1277 | diagnostics without having to do a separate build with the Clang compiler. To |
| 1278 | enable this feature, add `-clang` to the `C[XX]FLAGS` used by the package for |
| 1279 | its build. |
| 1280 | |
| 1281 | Addition of the `-clang` option to the build is interpreted by the compiler |
| 1282 | driver wrapper script, which then invokes Clang with -fsyntax-only option, and |
| 1283 | after a successful Clang run, invokes the gcc compiler. Any errors generated by |
| 1284 | Clang will stop compilation just like a regular build does. In addition to Clang |
| 1285 | warnings, you will also see warning from gcc, in some cases for the same source |
| 1286 | construct. |
| 1287 | |
| 1288 | The presence of a few specific gcc options, for example, `-print-*` or `-E` |
| 1289 | will disable a clang run, even if `-clang` is specified. This is to allow |
| 1290 | package configure scripts to run correctly even in the presence of the |
| 1291 | `-clang` option. |
| 1292 | |
| 1293 | ### Wrapper Options |
| 1294 | |
| 1295 | The wrapper script also interprets a few other options. All options specific to |
| 1296 | the wrapper only are tabulated below: |
| 1297 | |
| 1298 | * `-clang`: Invoke Clang front-end with `-fsyntax-only` and all other |
| 1299 | options specified on the command line. On successful completion of Clang |
| 1300 | compile, continue the build with gcc or `g++`. The presence of |
| 1301 | `-print-*`, `-dump*`, `@*`, `-E`, `-` or `-M` will disable |
| 1302 | clang invocation. |
| 1303 | * `-Xclang-only=<option>`: This is a special option that can be used to pass |
| 1304 | `<option>` to Clang and not to `gcc` or `g++`. This can be used, for |
| 1305 | example, to turn off a specific Clang warning. Example: |
| 1306 | `-Xclang-only=-Wno-c++11-extension`s will add `-Wno-c++11-extensions` to the |
| 1307 | Clang invocation. |
| 1308 | * `-print-cmdline`: In addition to doing the builds, print the exact |
| 1309 | command-line used for both Clang and gcc. |
| 1310 | |
| 1311 | ### Testing |
| 1312 | |
| 1313 | You can test your package with Clang before adding `-clang` to your ebuild or |
| 1314 | Makefiles using the `CFLAGS` or `CXXFLAGS` variable. While using this, you need |
| 1315 | to be careful not to overwrite existing `CFLAGS` or `CXXFLAGS`. Here's an |
| 1316 | example: |
| 1317 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1318 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1319 | (inside) |
| 1320 | $ CFLAGS="$(portageq-$board envvar CFLAGS) -clang" \ |
| 1321 | CXXFLAGS="$(portageq-$board envvar CXXFLAG) -clang" \ |
| 1322 | emerge-$board chromeos-chrome |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1323 | ``` |
| 1324 | |
| 1325 | After your package builds cleanly with Clang, you can add `-clang` to your |
| 1326 | ebuild. |
| 1327 | |
Trent Begin | 028fb54 | 2018-10-10 20:40:40 | [diff] [blame] | 1328 | ## Local Debugging |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1329 | |
| 1330 | ### Debugging both x86 and non-x86 binaries on your workstation. |
| 1331 | |
| 1332 | If you build your projects incrementally, write unit tests and use them to drive |
| 1333 | your development, you may want to debug your code without shipping it over to a |
| 1334 | running device or VM. |
| 1335 | |
| 1336 | `gdb-${BOARD}` sets up gdb in your board sysroot and ensures that gdb is using |
| 1337 | the proper libraries, debug files, etc. for debugging, allowing you to run your |
| 1338 | target-compiled binaries. |
| 1339 | |
| 1340 | It should already be installed in your chroot. If you do not have the script, |
| 1341 | update your repository to get the latest changes, then re-build your packages: |
| 1342 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1343 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1344 | (in/out) repo sync |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1345 | |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1346 | (inside) ./build_packages --board=... |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1347 | ``` |
| 1348 | |
| 1349 | This should install `gdb-${BOARD}` in the `/usr/local/bin` directory inside the |
| 1350 | chroot. These board-specific gdb wrapper scripts correctly handle _both local |
| 1351 | and remote debugging_ (see next section for more information on remote |
| 1352 | debugging). When used for local debugging, these scripts will run inside a |
| 1353 | special chroot-inside-your-chroot, rooted in the board's sysroot. For example if |
| 1354 | you are using `gdb-lumpy`, it will run inside a chroot based entirely in your |
| 1355 | `/build/lumpy` sysroot. _The libraries that it will load and use are the |
| 1356 | libraries in the sysroot,_ i.e. the target libraries for the board; the gdb |
| 1357 | binary it will use is the gdb binary in that tree. While debugging with |
| 1358 | `gdb-lumpy` (for local debugging), you will not be able to see/access any files |
| 1359 | outside of the `/build/lumpy` tree. While for the most part this is very good, |
| 1360 | as it ensures the correct debugging environment, it does mean that if you want |
| 1361 | to use this script to debug a lumpy binary, such as a unit test, that you built |
| 1362 | outside of the `/build/lumpy` tree, you will need to copy the binary to the |
| 1363 | `/build/lumpy` tree first. Also, if you want the debugger to be able to see the |
| 1364 | source files when debugging, you will need to make sure they exist inside the |
| 1365 | `/build/lumpy` tree as well (see example below). |
| 1366 | |
| 1367 | **IMPORTANT NOTE 1**: Local and remote debugging functionality are combined in |
| 1368 | this single script. Some of the options shown below only work for remote |
| 1369 | debugging. |
| 1370 | |
| 1371 | **IMPORTANT NOTE 2**: When doing local debugging of x86 binaries, they will try |
| 1372 | to execute on your desktop machine (using the appropriate libraries and gdb |
| 1373 | binaries). It is possible that for some x86 boards, the binaries may use |
| 1374 | instructions not understood by your hardware (particularly some vector |
| 1375 | instructions), in which case you will need to do remote debugging with the |
| 1376 | actual hardware instead. |
| 1377 | |
| 1378 | **IMPORTANT NOTE 3**: You can use this script with \*some\* debugging |
| 1379 | functionality for local debugging of non-x86 binaries. The script loads qemu and |
| 1380 | runs the non-x86 binaries in qemu. However qemu has some unfortunate |
| 1381 | limitations. For example you can "set" breakpoints in the binary (to see what |
| 1382 | addresses correspond to locations in the source), examine the source or assembly |
| 1383 | code, and execute the program. But qemu does not actually hit the breakpoints, |
| 1384 | so you cannot suspend execution in the middle when running under qemu. For full |
| 1385 | debugging functionality with non-x86 binaries, you must debug them remotely |
| 1386 | running on the correct hardware (see next section on remote debugging). You can |
| 1387 | see this in the example below, where gdb-daisy does not actually stop at the |
| 1388 | breakpoint it appears to set, although it does correctly execute the program. |
| 1389 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1390 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1391 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1392 | (cr) $ gdb-daisy -h |
| 1393 | |
| 1394 | usage: cros_gdb [-h] |
| 1395 | [--log-level {fatal,critical,error,warning,notice,info,debug}] |
| 1396 | [--log_format LOG_FORMAT] [--debug] [--nocolor] |
| 1397 | [--board BOARD] [-g GDB_ARGS] [--remote REMOTE] [--pid PID] |
| 1398 | [--remote_pid PID] [--no-ping] [--attach ATTACH_NAME] [--cgdb] |
| 1399 | [binary-to-be-debugged] [args-for-binary-being-debugged] |
| 1400 | |
| 1401 | Wrapper for running gdb. |
| 1402 | |
| 1403 | This handles the fun details like running against the right sysroot, via |
| 1404 | qemu, bind mounts, etc... |
| 1405 | |
| 1406 | positional arguments: |
| 1407 | inf_args Arguments for gdb to pass to the program being |
| 1408 | debugged. These are positional and must come at the |
| 1409 | end of the command line. This will not work if |
| 1410 | attaching to an already running program. |
| 1411 | ... |
| 1412 | |
| 1413 | (cr) $ gdb-daisy /bin/grep shebang /bin/ls |
Mike Frysinger | 92694c0 | 2019-12-17 22:12:40 | [diff] [blame] | 1414 | 15:51:06: INFO: run: file /build/daisy/bin/grep |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1415 | Reading symbols from /bin/grep...Reading symbols from /usr/lib/debug/bin/grep.debug...done. |
| 1416 | done. |
| 1417 | (daisy-gdb) b main |
| 1418 | Breakpoint 1 at 0x2814: file grep.c, line 2111. |
| 1419 | (daisy-gdb) disass main |
| 1420 | Dump of assembler code for function main: |
| 1421 | 0x00002814 <+0>: ldr.w r2, [pc, #3408] ; 0x3568 <main+3412> |
| 1422 | 0x00002818 <+4>: str.w r4, [sp, #-36]! |
| 1423 | 0x0000281c <+8>: movs r4, #0 |
| 1424 | 0x0000281e <+10>: strd r5, r6, [sp, #4] |
| 1425 | 0x00002822 <+14>: ldr.w r3, [pc, #3400] ; 0x356c <main+3416> |
| 1426 | 0x00002826 <+18>: movs r5, #2 |
| 1427 | 0x00002828 <+20>: strd r7, r8, [sp, #12] |
| 1428 | ... |
| 1429 | (daisy-gdb) run |
| 1430 | Starting program: /bin/grep shebang /bin/ls |
| 1431 | qemu: Unsupported syscall: 26 |
| 1432 | #!/usr/bin/coreutils --coreutils-prog-shebang=ls |
| 1433 | qemu: Unsupported syscall: 26 |
| 1434 | During startup program exited normally. |
| 1435 | (daisy-gdb) quit |
| 1436 | ``` |
| 1437 | |
| 1438 | Note in the example above that, like "regular" gdb when given `--args`, you can |
| 1439 | pass the arguments for the program being debugged to the gdb wrapper script just |
| 1440 | by adding them to the command line after the name of the program being debugged |
| 1441 | (except that `--args` isn't needed). |
| 1442 | |
| 1443 | The commands below show how to copy your incrementally-compiled unit test binary |
| 1444 | and source file(s) to the appropriate sysroot and then start gdb with that |
| 1445 | binary (using the correct libraries, etc). |
| 1446 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1447 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1448 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1449 | (cr) $ cd /build/lumpy/tmp/portage |
| 1450 | (cr) $ mkdir shill-test |
| 1451 | (cr) $ cd shill-test |
| 1452 | (cr) $ cp <path-to-binary>/shill_unittest . |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1453 | (cr) $ cp <path-to-src>/shill_unittest.cc . |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1454 | (cr) $ gdb-lumpy |
| 1455 | (gdb-lumpy) directory /tmp/portage/shill-test # Tell gdb to add /tmp/portage/shill-test to the paths it searches for source files |
| 1456 | (gdb-lumpy) file ./shill_unittest |
| 1457 | ``` |
| 1458 | |
| 1459 | If gdb is still looking for the source file in the wrong directory path, you can |
| 1460 | use `set substitute-path <from> <to>` inside gdb to help it find the right path |
| 1461 | (inside your sysroot) for searching for source files. |
| 1462 | |
Eliot Courtney | af7edf3 | 2020-06-16 05:49:50 | [diff] [blame] | 1463 | ### Printing stack traces at runtime. |
| 1464 | |
| 1465 | See [./stack_traces.md] for how to print stack traces at runtime. |
| 1466 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1467 | ## Remote Debugging |
| 1468 | |
| 1469 | ### Setting up remote debugging by hand. |
| 1470 | |
| 1471 | If you want to manually run through all the steps necessary to set up your |
| 1472 | system for remote debugging and start the debugger, see [Remote Debugging in |
| 1473 | Chromium OS]. |
| 1474 | |
| 1475 | ### Automated remote debugging using gdb-${BOARD} script (gdb-lumpy, gdb-daisy, gdb-parrot, etc). |
| 1476 | |
| 1477 | `gdb-${BOARD}` is a script that automates many of the steps necessary for |
| 1478 | setting up remote debugging with gdb. It should already be installed in your |
| 1479 | chroot. If you do not have the script, update your repository to get the latest |
| 1480 | changes, then re-build your packages: |
| 1481 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1482 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1483 | (in/out) repo sync |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1484 | |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1485 | (inside) ./build_packages --board=... |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1486 | ``` |
| 1487 | |
| 1488 | This should install `gdb_remote` in the `/usr/bin` directory inside the |
| 1489 | chroot. The `gdb-${BOARD}` script takes several options. The most important ones |
| 1490 | are mentioned below. |
| 1491 | |
| 1492 | `--gdb_args` (`-g`) are arguments to be passed to gdb itself (rather than to the |
| 1493 | program gdb is debugging). If multiple arguments are passed, each argument |
| 1494 | requires a separate -g flag. |
| 1495 | |
| 1496 | E.g `gdb-lumpy --remote=123.45.67.765 -g "-core=/tmp/core" -g "-directory=/tmp/source"` |
| 1497 | |
| 1498 | `--remote` is the ip_address or name for your chromebook, if you are doing |
| 1499 | remote debugging. If you omit this argument, the assumption is you are doing |
| 1500 | local debugging in the sysroot on your desktop (see section above). if you are |
| 1501 | debugging in the VM, then you need to specify either `:vm:` or `localhost:9222`. |
| 1502 | |
| 1503 | `--pid` is the pid of a running process on the remote device to which you want |
| 1504 | gdb/gdbserver to attach. |
| 1505 | |
| 1506 | `--attach` is the name of the running process on the remote device to which you |
| 1507 | want gdb/gdbserver to attach. If you want to attach to the Chrome browser |
| 1508 | itself, there are three special names you can use: `browser` will attach to the |
| 1509 | main browser process; `gpu-process` will attach to the GPU process; and |
| 1510 | `renderer` will attach to the renderer process if there is only one. If there is |
| 1511 | more than one renderer process `--attach=renderer` will return a list of the |
| 1512 | renderer pids and stop. |
| 1513 | |
| 1514 | To have gdb/gdbserver start and attach to a new (not already running) binary, |
| 1515 | give the name of the binary, followed by any arguments for the binary, at the |
| 1516 | end of the command line: |
| 1517 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1518 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1519 | (inside) $ gdb-daisy --remote=123.45.67.809 /bin/grep "test" /tmp/myfile |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1520 | ``` |
| 1521 | |
| 1522 | When doing remote debugging you \*must\* use the `--pid` or the `--attach` |
| 1523 | option, or specify the name of a new binary to start. You cannot start a remote |
| 1524 | debugging session without having specified the program to debug in one of these |
| 1525 | three ways. |
| 1526 | |
| 1527 | When you invoke `gdb-${BOARD} --remote=...`, it will connect to the notebook or |
| 1528 | VM (automatically setting up port-forwarding on the VM), make sure the port is |
| 1529 | entered into the iptables, and start up gdbserver, using the correct port and |
| 1530 | binary, either attaching to the binary (if a remote pid or name was specified) |
| 1531 | or starting up the binary. It will also start the appropriate version of gdb |
| 1532 | (for whichever type of board you are debugging) on your desktop and connect the |
| 1533 | gdb on your desktop to the gdbserver on the remote device. |
| 1534 | |
| 1535 | ### Edit/Debug cycle |
| 1536 | |
| 1537 | If you want to edit code and debug it on the DUT you can follow this procedure |
| 1538 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1539 | ```bash |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1540 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1541 | $ CFLAGS="-ggdb" FEATURES="noclean" emerge-${BOARD} -v sys-apps/mosys |
| 1542 | $ cros deploy --board=${BOARD} ${IP} sys-apps/mosys |
| 1543 | $ gdb-${BOARD} --cgdb --remote "${IP}" \ |
Raul E Rangel | 4b6fa60 | 2018-05-30 15:13:07 | [diff] [blame] | 1544 | -g "--eval-command=directory /build/${BOARD}/tmp/portage/sys-apps/mosys-9999/work/" \ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1545 | /usr/sbin/mosys -V |
| 1546 | ``` |
| 1547 | |
| 1548 | This will build your package with debug symbols (assuming your package respects |
| 1549 | `CFLAGS`). We need to use the `noclean` feature so that we have access to the |
| 1550 | original sourcecode that was used to build the package. Some packages will |
| 1551 | generate build artifacts and have different directory structures then the |
| 1552 | tar/git repo. This ensures all the paths line up correctly and the source code |
| 1553 | can be located. Ideally we would use the `installsources` feature, but we don't |
| 1554 | have support for the debugedit package (yet!). Portage by default will strip the |
| 1555 | symbols and install the debug symbols in `/usr/lib/debug/`. `gdb-${BOARD}` will |
| 1556 | handle setting up the correct debug symbol path. cros deploy will then update |
| 1557 | the rootfs on the DUT. We pass the work directory into `gdb-${BOARD}` so that |
| 1558 | [cgdb] can display the sourcecode inline. |
| 1559 | |
| 1560 | Quick primer on cgdb: |
| 1561 | |
| 1562 | * ESC: moves to the source window. |
| 1563 | * i: moves from source window to gdb window. |
| 1564 | |
| 1565 | ### Examples of debugging using the gdb-${BOARD} script. |
| 1566 | |
| 1567 | Below are three examples of using the board-specific gdb wrapper scripts to |
| 1568 | start up debugging sessions. The first two examples show connecting to a remote |
| 1569 | chromebook. The first one automatically finds the browser's running GPU process, |
| 1570 | attaches gdbserver to the running process, starts gdb on the desktop, and |
| 1571 | connects the local gdb to gdbserver. It also shows the user running the `bt` |
| 1572 | (backtrace) command after gdb comes up. The second example shows the user |
| 1573 | specifying the pid of a process on the chromebook. Again the script attaches |
| 1574 | gdbserver to the process, starts gdb on the desktop, and connects the two. The |
| 1575 | third example shows the user connecting to the main browser process in ChromeOS |
| 1576 | running in a VM on the user's desktop. For debugging the VM, you can use either |
| 1577 | `--remote=:vm:` or `--remote=localhost:9222` (`:vm:` gets translated into |
| 1578 | `localhost:9222`). |
| 1579 | |
| 1580 | Example 1: |
| 1581 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1582 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1583 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1584 | $ gdb-lumpy --remote=123.45.67.809 --attach=gpu-process |
| 1585 | |
Mike Frysinger | 92694c0 | 2019-12-17 22:12:40 | [diff] [blame] | 1586 | 14:50:07: INFO: run: ping -c 1 -w 20 123.45.67.809 |
| 1587 | 14:50:09: INFO: run: file /build/lumpy/opt/google/chrome/chrome |
| 1588 | 14:50:10: INFO: run: x86_64-cros-linux-gnu-gdb --quiet '--eval-command=set sysroot /build/lumpy' '--eval-command=set solib-absolute-prefix /build/lumpy' '--eval-command=set solib-search-path /build/lumpy' '--eval-command=set debug-file-directory /build/lumpy/usr/lib/debug' '--eval-command=set prompt (lumpy-gdb) ' '--eval-command=file /build/lumpy/opt/google/chrome/chrome' '--eval-command=target remote localhost:38080' |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1589 | Reading symbols from /build/lumpy/opt/google/chrome/chrome...Reading symbols from/build/lumpy/usr/lib/debug/opt/google/chrome/chrome.debug...done. |
| 1590 | (lumpy-gdb) bt |
| 1591 | #0 0x00007f301fad56ad in poll () at ../sysdeps/unix/syscall-template.S:81 |
| 1592 | #1 0x00007f3020d5787c in g_main_context_poll (priority=2147483647, n_fds=3, fds=0xdce10719840, timeout=-1, context=0xdce1070ddc0) at gmain.c:3584 |
| 1593 | #2 g_main_context_iterate (context=context@entry=0xdce1070ddc0,block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3285 |
| 1594 | #3 0x00007f3020d5798c in g_main_context_iteration (context=0xdce1070ddc0may_block=1) at gmain.c:3351 |
| 1595 | #4 0x00007f30226a4c1a in base::MessagePumpGlib::Run (this=0xdce10718580, delegate=<optimized out>) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/base/message_loop/message_pump_glib.cc:309 |
| 1596 | #5 0x00007f30226666ef in base::RunLoop::Run (this=this@entry=0x7fff72271af0) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/base/run_loop.cc:55 |
| 1597 | #6 0x00007f302264e165 in base::MessageLoop::Run (this=this@entry=0x7fff72271db0) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/base/message_loop/message_loop.cc:307 |
| 1598 | #7 0x00007f30266bc847 in content::GpuMain (parameters=...) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/content/gpu/gpu_main.cc:365 |
| 1599 | #8 0x00007f30225cedee in content::RunNamedProcessTypeMain (process_type=..., main_function_params=..., delegate=0x7fff72272380 at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/content/app/content_main_runner.cc:385 |
| 1600 | #9 0x00007f30225cef3a in content::ContentMainRunnerImpl::Run (this=0xdce106fef50) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/content/app/content_main_runner.cc:763 |
| 1601 | #10 0x00007f30225cd551 in content::ContentMain (params=...) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/content/app/content_main.cc:19 |
| 1602 | #11 0x00007f3021fef02a in ChromeMain (argc=21, argv=0x7fff722724b8) at ../../../../../chromeos-cache/distfiles/target/chrome-src-internal/src/chrome/app/chrome_main.cc:66 |
| 1603 | #12 0x00007f301fa0bf40 in __libc_start_main (main=0x7f3021fee760 <main(int, char const**)>, argc=21, argv=0x7fff722724b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,stack_end=0x7fff722724a8) at libc-start.c:292 |
| 1604 | #13 0x00007f3021feee95 in _start () |
| 1605 | (lumpy-gdb) |
| 1606 | ``` |
| 1607 | |
| 1608 | Example 2: |
| 1609 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1610 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1611 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1612 | $ gdb-daisy --pid=626 --remote=123.45.98.765 |
Mike Frysinger | 92694c0 | 2019-12-17 22:12:40 | [diff] [blame] | 1613 | 14:50:07: INFO: run: ping -c 1 -w 20 123.45.98.765 |
| 1614 | 14:50:09: INFO: run: file /build/daisy/usr/sbin/cryptohomed |
| 1615 | 14:50:10: INFO: run: armv7a-cros-linux-gnueabi-gdb --quiet '--eval-command=set sysroot /build/daisy' '--eval-command=set solib-absolute-prefix /build/daisy' '--eval-command=set solib-search-path /build/daisy' '--eval-command=set debug-file-directory /build/daisy/usr/lib/debug' '--eval-command=set prompt (daisy-gdb) ' '--eval-command=file /build/daisy/usr/sbin/cryptohomed' '--eval-command=target remote localhost:38080' |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1616 | Reading symbols from /build/daisy/usr/sbin/cryptohomed...Reading symbols from/build/daisy/usr/lib/debug/usr/bin/cryptohomed.debug...done. |
| 1617 | (daisy-gdb) |
| 1618 | ``` |
| 1619 | |
| 1620 | Example 3: |
| 1621 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1622 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1623 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1624 | $ gdb-lumpy --remote=:vm: --attach=browser |
Mike Frysinger | 92694c0 | 2019-12-17 22:12:40 | [diff] [blame] | 1625 | 15:18:28: INFO: run: ping -c 1 -w 20 localhost |
| 1626 | 15:18:31: INFO: run: file /build/lumpy/opt/google/chrome/chrome |
| 1627 | 15:18:33: INFO: run: x86_64-cros-linux-gnu-gdb --quiet '--eval-command=setsysroot /build/lumpy' '--eval-command=set solib-absolute-prefix /build/lumpy' '--eval-command=set solib-search-path /build/lumpy' '--eval-command=set debug-file-directory /build/lumpy/usr/lib/debug' '--eval-command=set prompt (lumpy-gdb) ' '--eval-command=file /build/lumpy/opt/google/chrome/chrome' '--eval-command=target remote localhost:48062' |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1628 | Reading symbols from /build/lumpy/opt/google/chrome/chrome...Reading symbols from /build/lumpy/usr/lib/debug/opt/google/chrome/chrome.debug...done. |
| 1629 | done. |
| 1630 | Remote debugging using localhost:48062 |
| 1631 | ... |
| 1632 | (lumpy-gdb) |
| 1633 | ``` |
| 1634 | |
| 1635 | If you find problems with the board-specific gdb scripts, please file a bug |
| 1636 | ([crbug.com/new]) and add 'build-toolchain' as one of the labels in the |
| 1637 | bug. |
| 1638 | |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 1639 | ## Building Chrome for Chromium OS |
| 1640 | |
| 1641 | See [Simple Chrome Workflow]. |
| 1642 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1643 | ## Troubleshooting |
| 1644 | |
| 1645 | ### I lost my developer tools on the stateful partition, can I get them back? |
| 1646 | |
| 1647 | This happens sometimes because the security system likes to wipe out the |
| 1648 | stateful partition and a lot of developer tools are in /usr/local/bin. But all |
| 1649 | is not lost because there is a tool for updating the stateful partition from an |
| 1650 | image created by the auto-update part of the dev_server. Sadly, it is normally |
| 1651 | found in /usr/local so will have been lost too and you need to copy it over |
| 1652 | manually. This works for me: |
| 1653 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1654 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1655 | $ cd /tmp |
| 1656 | $ scp me@myworkstation:/path/to/chromiumos/chroot/build/x86-whatever/usr/bin/stateful_update . |
| 1657 | $ sudo sh stateful_update |
| 1658 | $ sudo reboot |
| 1659 | ``` |
| 1660 | |
| 1661 | Note you can clobber the stateful partition (remove user accounts etc and force |
| 1662 | OOBE) as part of this process by using a flag: |
| 1663 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1664 | ```bash |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1665 | $ cd /tmp |
| 1666 | $ scp me@myworkstation:/path/to/chromiumos/chroot/build/x86-whatever/usr/bin/stateful_update . |
| 1667 | $ sudo sh stateful_update --stateful_change=clean |
| 1668 | $ sudo reboot |
| 1669 | ``` |
| 1670 | |
Tom Hughes | 4c99d07 | 2019-11-08 18:31:01 | [diff] [blame] | 1671 | ### Disabling Enterprise Enrollment |
| 1672 | |
| 1673 | Some devices may be configured with a policy that only allows logging in with |
| 1674 | enterprise credentials, which will prevent you from logging in with a |
| 1675 | non-enterprise Google account (e.g., `[email protected]`). To disable the enterprise |
| 1676 | enrollment setting: |
| 1677 | |
| 1678 | * Enable [Developer Mode]. |
| 1679 | * Disable the enterprise enrollment check: |
| 1680 | |
| 1681 | ```bash |
Miriam Polzer | 353b8d0 | 2020-11-09 08:24:16 | [diff] [blame] | 1682 | (dut) $ vpd -i RW_VPD -check_enrollment=0 |
Tom Hughes | 4c99d07 | 2019-11-08 18:31:01 | [diff] [blame] | 1683 | (dut) $ dump_vpd_log --force |
| 1684 | (dut) $ crossystem clear_tpm_owner_request=1 |
| 1685 | (dut) $ reboot |
| 1686 | ``` |
| 1687 | |
| 1688 | ***note |
| 1689 | **NOTE:** The enterprise policy can also prevent transitioning to |
| 1690 | [Developer Mode], in which case you won't be able to perform the above commands. |
| 1691 | *** |
| 1692 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1693 | ## Running Tests |
| 1694 | |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 1695 | Chromium OS integration (or "functional") tests are written using the [Tast] or |
| 1696 | [Autotest] frameworks. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1697 | |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 1698 | ### Tast |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1699 | |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 1700 | [Tast] is a Go-based integration testing framework with a focus on speed, |
| 1701 | ease-of-use, and maintainability. Existing Autotest-based tests that run on the |
| 1702 | Chrome OS Commit Queue are being ported to Tast and decommissioned as of 2018 |
| 1703 | Q4. Please strongly consider using Tast when writing new integration tests (but |
| 1704 | be aware that not all functionality provided by Autotest is available in Tast; |
| 1705 | for example, tests that use multiple devices simultaneously when running are not |
| 1706 | currently supported). |
| 1707 | |
| 1708 | Here are some starting points for learning more about Tast: |
| 1709 | |
| 1710 | * [Tast Quickstart] |
| 1711 | * [Tast: Running Tests] |
| 1712 | * [Tast: Writing Tests] |
| 1713 | * [Tast Overview] |
| 1714 | |
| 1715 | Please contact the public [tast-users mailing list] if you have questions. |
| 1716 | |
| 1717 | ### Autotest |
| 1718 | |
| 1719 | [Autotest] is a Python-based integration testing framework; the codebase is also |
| 1720 | responsible for managing the [Chrome OS lab] that is used for hardware testing. |
| 1721 | Chromium-OS-specific Autotest information is available in the [Autotest User |
| 1722 | Documentation]. |
| 1723 | |
| 1724 | Additional Autotest documentation: |
| 1725 | |
| 1726 | * [Creating a new Autotest test] |
| 1727 | * [Running Autotest Smoke Suite On a VM Image] |
| 1728 | * [Seeing which Autotest tests are implemented by an ebuild] |
| 1729 | |
| 1730 | ### Creating a normal image that has been modified for test |
| 1731 | |
| 1732 | See [Creating an image that has been modified for test] for information about |
| 1733 | modifying a normal system image so that integration tests can be run on it. |
| 1734 | |
| 1735 | ### Creating a VM image that has been modified for test |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1736 | |
Pranav Batra | 0ccdf1e | 2020-09-18 06:27:29 | [diff] [blame] | 1737 | If you wish to produce a VM image instead, make sure to include the --test flag |
| 1738 | when running build_image and run `./image_to_vm.sh` with the --test_image flag: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1739 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1740 | ```bash |
Mike Wiitala | ff7b1ce | 2019-07-24 22:22:49 | [diff] [blame] | 1741 | (inside) ./image_to_vm.sh --board=${BOARD} --test_image |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1742 | ``` |
| 1743 | |
| 1744 | Note: this difference between `cros flash` and `./image_to_vm.sh` arises because |
| 1745 | `./image_to_vm.sh` does not yet support the `--image_name` flag and by default |
| 1746 | looks for `chromiumos_image.bin`. We expect this to change in the future. |
| 1747 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1748 | ### Creating a recovery image that has been modified for test |
| 1749 | |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 1750 | After building a test image using `./build_image test` as described above, you |
| 1751 | may wish to encapsulate it within a recovery image: |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1752 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1753 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1754 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1755 | ./mod_image_for_recovery.sh \ |
| 1756 | --board=${BOARD} \ |
| 1757 | --nominimize_image \ |
| 1758 | --image ~/trunk/src/build/images/${BOARD}/latest/chromiumos_test_image.bin \ |
| 1759 | --to ~/trunk/src/build/images/${BOARD}/latest/recovery_test_image.bin |
| 1760 | ``` |
| 1761 | |
| 1762 | If desired, you may specify a custom kernel with `--kernel_image |
| 1763 | ${RECOVERY_KERNEL}`. |
| 1764 | |
| 1765 | You can write this recovery image out to the USB device like so: |
| 1766 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1767 | ```bash |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1768 | (inside) |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1769 | cros flash usb:// ~/trunk/src/build/images/${BOARD}/latest/recovery_test_image.bin |
| 1770 | ``` |
| 1771 | |
| 1772 | Note that there are some **downsides** to this approach which you should keep in |
| 1773 | mind. |
| 1774 | |
| 1775 | * Your USB image will be a recovery mode/test image, but the ordinary image in |
| 1776 | your directory will be a non-test image. |
| 1777 | * If you use devserver, this will serve the non-test image not the test-image. |
| 1778 | * This means a machine installed with a test-enabled USB image will update to |
| 1779 | a non-test-enabled one. |
Thiemo Nagel | 39096e6 | 2019-06-18 12:20:51 | [diff] [blame] | 1780 | * As the `*-generic` boards set `USE=tpm`, recovery images built for |
| 1781 | `*-generic` don't work on devices with H1 chips (which requires `USE=tpm2`). |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1782 | |
| 1783 | ## Additional information |
| 1784 | |
Kirtika Ruchandani | 6ce690a | 2019-02-26 01:12:02 | [diff] [blame] | 1785 | ### Updating the chroot |
| 1786 | |
Evan Benn | 8fe69b1 | 2019-11-05 04:45:59 | [diff] [blame] | 1787 | You should run `update_chroot` after `repo sync`. |
| 1788 | `repo sync` only updates the source code, `update_chroot` is required to apply |
| 1789 | those changes to the chroot. |
| 1790 | `update_chroot` can be run manually, alternatively it is run as part of |
| 1791 | `setup_board` and `build_packages`. |
Kirtika Ruchandani | 6ce690a | 2019-02-26 01:12:02 | [diff] [blame] | 1792 | |
Tom Hughes | e6f0511 | 2019-08-06 15:35:38 | [diff] [blame] | 1793 | ```bash |
Evan Benn | 8fe69b1 | 2019-11-05 04:45:59 | [diff] [blame] | 1794 | (inside) ./update_chroot |
Kirtika Ruchandani | 6ce690a | 2019-02-26 01:12:02 | [diff] [blame] | 1795 | ``` |
| 1796 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1797 | ### Toolchain Compilers |
| 1798 | |
| 1799 | At any given time in the chroot, to see what cross-compiler version is the |
| 1800 | current default one, do: |
| 1801 | |
| 1802 | * For ARM: `armv7a-cros-linux-gnueabi-gcc -v` |
| 1803 | * For x86: `i686-pc-linux-gnu-gcc -v` |
| 1804 | * For amd64: `x86_64-cros-linux-gnu-gcc -v` |
| 1805 | |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 1806 | ### Sync to Green |
| 1807 | |
| 1808 | Googlers/internal users may work from either the stable ref or from tip-of-tree |
| 1809 | (ToT) like external contributors; both are fully supported. |
| 1810 | |
| 1811 | It's always the case that `repo sync` could sync to a broken tree in ChromeOS. |
| 1812 | There's been many bug reports of this happening to folks over the years. There |
| 1813 | are two structural sources of this: chumped CL's and mutually incompatible CL's |
| 1814 | landing at the same time. |
| 1815 | |
| 1816 | If you have previously run `repo init` without the `-b stable`, you can convert an |
Avery Musbach | e29deda | 2020-09-11 16:58:31 | [diff] [blame] | 1817 | existing checkout to stable: |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 1818 | |
Conor McNamara | cab29c0 | 2019-12-06 23:18:55 | [diff] [blame] | 1819 | ```shell |
| 1820 | (in/out) |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 1821 | repo init -b stable |
| 1822 | repo sync |
| 1823 | ``` |
| 1824 | |
| 1825 | This stable ref is updated anytime that postsubmit-orchestrator passes all build |
| 1826 | and unit test stages (it ignores hardware tests so that the stables updates are |
| 1827 | more frequent). It should vary from 5-10 hours old, so long as ToT is not broken |
| 1828 | (which is rare). |
| 1829 | |
Avery Musbach | e29deda | 2020-09-11 16:58:31 | [diff] [blame] | 1830 | You can continue to use master (switch back with `repo init -b master`), if you |
| 1831 | prefer. You would want to do this if you want to see a change that just landed |
| 1832 | on ToT and don't want to wait for the stable ref to be updated to include the |
| 1833 | change you are interested in building off of. On the downside, master may be |
| 1834 | broken and may not have all binaries available, including Chrome (which |
| 1835 | typically takes 45 minutes to build). |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 1836 | |
| 1837 | We guarantee that binary prebuilt packages are available for everything at the |
| 1838 | stable ref including Chrome. Conversely, we don't guarantee Chrome binary |
Mike Frysinger | 2db7b85 | 2020-09-10 08:37:44 | [diff] [blame] | 1839 | prebuilts are available at ToT (they will be available there about 85% of |
Jason D. Clinton | e5435d7 | 2019-10-15 01:57:50 | [diff] [blame] | 1840 | the time). When building from stable, this should result in <10 min |
| 1841 | `build_packages && build_image` times in most cases. |
| 1842 | |
| 1843 | In summary: |
| 1844 | |
| 1845 | * Stable pros: binaries always available; never broken |
| 1846 | * Stable cons: 5-10 hours old |
| 1847 | * Master pros: always has ToT changes |
| 1848 | * Master cons: more frequently broken, may need to build packages in the |
| 1849 | depgraph including Chrome which could add ~1 hours to build times |
| 1850 | |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1851 | ### Attribution requirements |
| 1852 | |
| 1853 | When you produce a Chromium OS image, you need to fulfill various attribution |
| 1854 | requirements of third party licenses. Currently, the images generated by a build |
| 1855 | don't do this for you automatically. You must modify [about_os_credits.html]. |
| 1856 | |
| 1857 | ### Documentation on this site |
| 1858 | |
| 1859 | You now understand the basics of building, running, modifying, and testing |
| 1860 | Chromium OS, but you've still got a lot to learn. Here are links to a few other |
| 1861 | pages on the chromium.org site that you are likely to find helpful (somewhat |
| 1862 | ordered by relevance): |
| 1863 | |
| 1864 | * The [Tips And Tricks] page has a lot of useful |
| 1865 | information to help you optimize your workflow. |
| 1866 | * If you haven't read the page about the [devserver] already, read it now. |
| 1867 | * Learn about the Chromium OS [directory structure]. |
| 1868 | * [The Chromium OS developer FAQ] |
| 1869 | * [Chromium OS Portage Build FAQ] is useful for portage-specific questions. |
| 1870 | * If you have questions about the `--noenable_rootfs_verification` option, you |
| 1871 | might find answers on this [thread on chromium-os-dev][rootfs-thread]. |
| 1872 | * [Running Smoke Suite on a VM Image] has good information about how to get up |
| 1873 | and running with autotest tests and VMs. |
| 1874 | * [Debugging Tips] contains information about how to debug the Chromium |
| 1875 | browser on your Chromium OS device. |
| 1876 | * [Working on a Branch] has tips for working on branches. |
| 1877 | * [Git server-side information] talks about adding new git repositories. |
| 1878 | * The [Portage Package Upgrade Process] documents how our Portage |
| 1879 | packages can be upgraded when they fall out of date with respect to |
| 1880 | upstream. |
| 1881 | * The [Chromium OS Sandboxing] page describes the mechanisms and tools used to |
| 1882 | sandbox (or otherwise restrict the privileges of) Chromium OS system |
| 1883 | services. |
| 1884 | * The [Go in Chromium OS] page provides information on using [Go] in Chromium |
| 1885 | OS, including recommendations for project organization, importing and |
| 1886 | managing third party packages, and writing ebuilds. |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1887 | * The [SELinux](security/selinux.md) page provides information on SELinux in Chrome |
David Pursehouse | b3b7da1 | 2019-06-17 12:23:39 | [diff] [blame] | 1888 | OS, including overview, writing policies, and troubleshooting. |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1889 | |
| 1890 | ### External documentation |
| 1891 | |
| 1892 | Below are a few links to external sites that you might also find helpful |
| 1893 | (somewhat ordered by relevance): |
| 1894 | |
| 1895 | * **Definitely** look at the [Chromium OS dev group] to see what people are |
| 1896 | talking about. |
Matthew Duggan | 472da13 | 2020-08-18 01:05:32 | [diff] [blame] | 1897 | * Check out the [Chromium bug tracker] to report bugs, look for known |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1898 | issues, or look for things to fix. |
| 1899 | * Get an idea of what's actively happening by looking at the [Chromium Gerrit] |
| 1900 | site. (Note that this is no longer the same site that Chromium uses) |
| 1901 | * Browse the source code on the [Chromium OS gitweb]. |
| 1902 | * Check the current status of the builds by looking at the |
| 1903 | [Chromium OS build waterfall]. |
| 1904 | * Check out the [#chromium-os channel] on freenode.net (this is the IRC |
| 1905 | channel that Chromium OS developers like to hang out on). |
| 1906 | * If you're learning git, check out [Git for Computer Scientists], |
| 1907 | [Git Magic], or the [Git Manual]. |
| 1908 | * Gentoo has several useful documentation resources |
| 1909 | * [Gentoo Development Guide] is a useful resource for Portage, which is |
| 1910 | the underlying packaging system we use. |
| 1911 | * [Gentoo Embedded Handbook] |
| 1912 | * [Gentoo Cross Development Guide] |
| 1913 | * [Gentoo Wiki on Cross-Compiling] |
| 1914 | * [Gentoo Package Manager Specification] |
| 1915 | * The [repo user docs] might help you if you're curious about repo. |
| 1916 | * The [repo-discuss group] is a good place to talk about repo. |
| 1917 | |
| 1918 | |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1919 | [quick-start guide]: https://dev.chromium.org/chromium-os/quick-start-guide |
Satoru Takabayashi | f307509 | 2018-05-25 05:12:22 | [diff] [blame] | 1920 | [README.md]: README.md |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1921 | [Prerequisites]: #Prerequisites |
| 1922 | [Getting the source code]: #Getting-the-source-code |
| 1923 | [Building Chromium OS]: #Building-Chromium-OS |
| 1924 | [Installing Chromium OS on your Device]: #Installing-Chromium-OS-on-your-Device |
| 1925 | [Making changes to packages whose source code is checked into Chromium OS git repositories]: #Making-changes-to-packages-whose-source-code-is-checked-into-Chromium-OS-git-repositories |
Ben Pastene | ff8c9e9 | 2020-03-19 00:21:30 | [diff] [blame] | 1926 | [Making changes to non-cros_workon-able packages]: #Making-changes-to-non_cros_workon_able-packages |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1927 | [Using Clang to get better compiler diagnostics]: #Using-Clang-to-get-better-compiler-diagnostics |
| 1928 | [Local Debugging]: #Local-Debugging |
| 1929 | [Remote Debugging]: #Remote-Debugging |
| 1930 | [Troubleshooting]: #Troubleshooting |
| 1931 | [Running Tests]: #Running-Tests |
| 1932 | [Additional information]: #Additional-information |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1933 | [Attribution requirements]: #Attribution-requirements |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1934 | [Ubuntu]: https://www.ubuntu.com/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1935 | [RAM-thread]: https://groups.google.com/a/chromium.org/d/topic/chromium-os-dev/ZcbP-33Smiw/discussion |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1936 | [install depot_tools]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up |
Brian Norris | e7fb701 | 2019-11-07 22:37:54 | [diff] [blame] | 1937 | [Sync to Green]: #Sync-to-Green |
Allen Webb | 22bbd9b | 2020-07-16 12:06:32 | [diff] [blame] | 1938 | [Making sudo a little more permissive]: tips-and-tricks.md#How-to-make-sudo-a-little-more-permissive |
Nick Peterson | b5cbc6a | 2018-10-24 17:24:48 | [diff] [blame] | 1939 | [Decide where your source will live]: #Decide-where-your-source-will-live |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1940 | [gerrit-guide]: https://www.chromium.org/chromium-os/developer-guide/gerrit-guide |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1941 | [repo]: https://code.google.com/p/git-repo/ |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1942 | [git]: https://git-scm.com/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1943 | [goto/chromeos-building]: http://goto/chromeos-building |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1944 | [API Keys]: https://www.chromium.org/developers/how-tos/api-keys |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1945 | [working on a branch page]: work_on_branch.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1946 | [chroot]: https://en.wikipedia.org/wiki/Chroot |
Andrew McRae | 4f3e97c | 2019-05-30 06:07:35 | [diff] [blame] | 1947 | [gsutil]: gsutil.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1948 | [crosbug/10048]: https://crbug.com/192478 |
Allen Webb | 22bbd9b | 2020-07-16 12:06:32 | [diff] [blame] | 1949 | [Tips And Tricks]: tips-and-tricks.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1950 | [something harder]: https://www.google.com/search?q=the+fourth+dimension |
| 1951 | [issues with virtual packages]: https://crbug.com/187712 |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1952 | [What does build_packages actually do?]: portage/ebuild_faq.md#what-does-build-packages-do |
Andrew McRae | 4f3e97c | 2019-05-30 06:07:35 | [diff] [blame] | 1953 | [Cros Flash page]: cros_flash.md |
Taoyu Li | 642425c | 2019-07-08 08:59:42 | [diff] [blame] | 1954 | [Debug Button Shortcuts]: debug_buttons.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1955 | [Chrome OS Devices]: https://dev.chromium.org/chromium-os/developer-information-for-chrome-os-devices |
| 1956 | [Developer Hardware]: https://dev.chromium.org/chromium-os/getting-dev-hardware/dev-hardware-list |
| 1957 | [crosh]: https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/crosh/ |
| 1958 | [crbug/710629]: https://crbug.com/710629 |
Harry Cutts | fe8ca1c | 2020-09-16 12:48:22 | [diff] [blame] | 1959 | [cros deploy]: cros_deploy.md |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1960 | [Create a branch for your changes]: #Create-a-branch-for-your-changes |
Jack Rosenthal | 15b9091 | 2019-06-05 16:29:25 | [diff] [blame] | 1961 | [Making changes to the Chromium web browser on Chromium OS]: simple_chrome_workflow.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1962 | [Remote Debugging in Chromium OS]: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/remote-debugging |
Jorge Lucangeli Obes | 469a2b7 | 2019-10-14 13:05:59 | [diff] [blame] | 1963 | [cgdb]: https://cgdb.github.io/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1964 | [crbug.com/new]: https://crbug.com/new |
Steven Bennetts | 7f08b00 | 2018-06-29 23:28:44 | [diff] [blame] | 1965 | [Simple Chrome Workflow]: simple_chrome_workflow.md |
Daniel Erat | 756631d | 2018-12-13 02:27:15 | [diff] [blame] | 1966 | [Tast]: https://chromium.googlesource.com/chromiumos/platform/tast/ |
| 1967 | [Autotest]: https://autotest.github.io/ |
| 1968 | [Tast Quickstart]: https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/quickstart.md |
| 1969 | [Tast: Running Tests]: https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/running_tests.md |
| 1970 | [Tast: Writing Tests]: https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/writing_tests.md |
| 1971 | [Tast Overview]: https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/overview.md |
| 1972 | [tast-users mailing list]: https://groups.google.com/a/chromium.org/forum/#!forum/tast-users |
| 1973 | [Chrome OS lab]: http://sites/chromeos/for-team-members/lab/lab-faq |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1974 | [Autotest User Documentation]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/HEAD/docs/user-doc.md |
| 1975 | [Creating a new Autotest test]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/HEAD/docs/user-doc.md#Writing-and-developing-tests |
| 1976 | [Running Autotest Smoke Suite On a VM Image]: https://dev.chromium.org/chromium-os/testing/running-smoke-suite-on-a-vm-image |
| 1977 | [Seeing which Autotest tests are implemented by an ebuild]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/HEAD/docs/user-doc.md#Q4_I-have-an-ebuild_what-tests-does-it-build |
| 1978 | [Creating an image that has been modified for test]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/HEAD/docs/user-doc.md#W4_Create-and-run-a-test_enabled-image-on-your-device |
| 1979 | [about_os_credits.html]: https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/resources/chromeos/about_os_credits.html |
| 1980 | [devserver]: https://chromium.googlesource.com/chromiumos/chromite/+/HEAD/docs/devserver.md |
| 1981 | [directory structure]: source_layout.md |
| 1982 | [The Chromium OS developer FAQ]: https://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/developer-faq |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1983 | [Chromium OS Portage Build FAQ]: portage/ebuild_faq.md |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1984 | [rootfs-thread]: https://groups.google.com/a/chromium.org/group/chromium-os-dev/browse_thread/thread/967e783e27dd3a9d/0fa20a1547de2c77?lnk=gst |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1985 | [Running Smoke Suite on a VM Image]: https://dev.chromium.org/chromium-os/testing/running-smoke-suite-on-a-vm-image |
| 1986 | [Debugging Tips]: https://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1987 | [Working on a Branch]: work_on_branch.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1988 | [Git server-side information]: https://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/git-server-side-information |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 1989 | [Portage Package Upgrade Process]: portage/package_upgrade_process.md |
| 1990 | [Chromium OS Sandboxing]: sandboxing.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1991 | [Go in Chromium OS]: https://dev.chromium.org/chromium-os/developer-guide/go-in-chromium-os |
| 1992 | [Go]: https://golang.org |
| 1993 | [Chromium OS dev group]: https://groups.google.com/a/chromium.org/group/chromium-os-dev |
| 1994 | [Chromium bug tracker]: https://crbug.com/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 1995 | [Chromium Gerrit]: https://chromium-review.googlesource.com/ |
| 1996 | [Chromium OS gitweb]: https://chromium.googlesource.com/ |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 1997 | [Chromium OS build waterfall]: https://ci.chromium.org/p/chromeos |
| 1998 | [#chromium-os channel]: https://webchat.freenode.net/?channels=chromium-os |
Mike Frysinger | cb52c09 | 2018-09-25 03:51:07 | [diff] [blame] | 1999 | [Gerrit Workflow]: contributing.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 2000 | [Git for Computer Scientists]: https://eagain.net/articles/git-for-computer-scientists/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 2001 | [Git Magic]: http://www-cs-students.stanford.edu/~blynn/gitmagic/ |
| 2002 | [Git Manual]: http://schacon.github.com/git/user-manual.html |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 2003 | [Gentoo Development Guide]: https://devmanual.gentoo.org/ |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 2004 | [Gentoo Embedded Handbook]: https://wiki.gentoo.org/wiki/Embedded_Handbook |
Evan Benn | 6a6383b | 2019-10-31 23:01:07 | [diff] [blame] | 2005 | [Gentoo Cross Development Guide]: https://wiki.gentoo.org/wiki/Embedded_Handbook |
| 2006 | [Gentoo Wiki on Cross-Compiling]: https://wiki.gentoo.org/wiki/Crossdev |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 2007 | [Gentoo Package Manager Specification]: https://ci.chromium.org/p/chromeos |
Satoru Takabayashi | 803fd1b | 2018-05-25 02:29:32 | [diff] [blame] | 2008 | [repo user docs]: https://source.android.com/source/using-repo |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 2009 | [repo-discuss group]: https://groups.google.com/group/repo-discuss |
Tom Hughes | 9ae6c93 | 2019-08-14 17:00:49 | [diff] [blame] | 2010 | [Developer Mode]: ./developer_mode.md |
Mike Frysinger | 9fc0fc0 | 2020-09-05 05:18:57 | [diff] [blame] | 2011 | [./stack_traces.md]: stack_traces.md |