blob: f6afc45e7c6983ed76f7acedb4981cfc760514bc [file] [log] [blame] [view]
Satoru Takabayashi7cc76c92017-06-26 04:46:051# Building Chrome for Chrome OS (Simple Chrome)
Satoru Takabayashieef6f592017-06-23 04:16:362
3This workflow allows you to quickly build/deploy Chromium to any Chromium OS
4device without needing a Chromium OS checkout or chroot. It's useful for trying
5out your changes on a real device while you're doing Chromium development. If
6you want your Chromium changes to be included when building a full Chromium OS
7image, see the [instructions in the development guide].
8
9At its core is the `chrome-sdk` shell which sets up the shell environment, and
10fetches the necessary SDK components (CrOS toolchain, sysroot, etc.).
11
12[TOC]
13
14## Typography conventions
15
16| Label | Paths, files, and commands |
17|---------------|--------------------------------------------------------|
Satoru Takabayashi7cc76c92017-06-26 04:46:0518| (outside) | on your build machine, outside the chroot |
Satoru Takabayashieef6f592017-06-23 04:16:3619| (inside) | inside the `chrome-sdk` shell on your build machine (1)|
20| (device) | on your Chromium OS device |
James Cookba126f12017-08-21 19:59:0721| (chroot) | inside the `cros_sdk` crhoot |
Satoru Takabayashieef6f592017-06-23 04:16:3622
James Cookba126f12017-08-21 19:59:0723(1) Note: This is not the same thing as the `cros_sdk` chroot.
Satoru Takabayashieef6f592017-06-23 04:16:3624
James Cookba126f12017-08-21 19:59:0725## Getting started
Satoru Takabayashieef6f592017-06-23 04:16:3626
James Cookba126f12017-08-21 19:59:0727First make sure you have a:
Satoru Takabayashieef6f592017-06-23 04:16:3628
James Cookba126f12017-08-21 19:59:07291. [Local copy of the Chromium source code and depot_tools]
302. USB flash drive 4 GB or larger (for example, a Sandisk Extreme USB 3.0)
313. USB to Ethernet adapter
32
33Googlers: Chromestop has the hardware.
Satoru Takabayashieef6f592017-06-23 04:16:3634
35### Get Google API keys
36
37In order to sign in to your Chromebook you must have Google API keys:
38
39* External contributors, see http://www.chromium.org/developers/how-tos/api-keys
40 You'll need to put them in your `out_board/Release/args.gn file`, see below.
Satoru Takabayashi7cc76c92017-06-26 04:46:0541* Googlers, see http://go/building-chrome to get internal source. If you have
42 `src-internal` in your `.gclient` file the official API keys will be set up
Satoru Takabayashieef6f592017-06-23 04:16:3643 automatically.
44
James Cook3a2a0632018-01-18 06:21:5645## Set up gsutil
Satoru Takabayashieef6f592017-06-23 04:16:3646
James Cook3a2a0632018-01-18 06:21:5647Steps below may run slowly and fail with "Login Required" from gsutil. Use
48depot_tools/gsutil.py and run `gsutil config` (outside) to set the
49authentication token. (Googlers: Use your @google.com account.)
50
51**NOTE: When prompted for a project ID, enter 134157665460 as your project ID (this is the Chrome OS project ID).**
52
53## Fetch the Chrome OS toolchain and SDK for building Chrome
54
55Toolchains are customized for each Chromebook model (or "board"). Look up your
56[Chromium OS board name] by navigating to the URL `about:version` on the device.
57For example: `Platform 10176.47.0 (Official Build) beta-channel samus`
58has board `samus`.
Satoru Takabayashieef6f592017-06-23 04:16:3659
Steven Bennetts5a79a1c2017-11-27 20:05:4760Run this from within your Chromium checkout (not the Chromium OS chroot):
61
Satoru Takabayashieef6f592017-06-23 04:16:3662```
James Cook3a2a0632018-01-18 06:21:5663(outside) cd /path/to/chrome/src
64(outside) export BOARD=samus # or your board name
65(outside) cros chrome-sdk --board=$BOARD --gn-gen --log-level=info
Satoru Takabayashieef6f592017-06-23 04:16:3666```
Satoru Takabayashieef6f592017-06-23 04:16:3667
68`cros chrome-sdk` will fetch the latest Chrome OS SDK for building Chrome, and
Steven Bennetts5a79a1c2017-11-27 20:05:4769put you in a shell with a command prompt starting with `(sdk $BOARD $VERSION)`.
Satoru Takabayashieef6f592017-06-23 04:16:3670
71`cros chrome-sdk` will also automatically install and start the Goma server,
72with the active server port stored in the `$SDK_GOMA_PORT` (inside) environment
73variable.
74
Steven Bennetts5a79a1c2017-11-27 20:05:4775**Note:** There are no public builders yet for non-generic boards, so you will
76need to use a generic board (e.g. amd64-generic) or create your own local
77build. Star http://crbug.com/360342 for updates.
Satoru Takabayashieef6f592017-06-23 04:16:3678
Steven Bennetts5a79a1c2017-11-27 20:05:4779### cros chrome-sdk options:
Satoru Takabayashieef6f592017-06-23 04:16:3680
Steven Bennetts5a79a1c2017-11-27 20:05:4781* `--gn-gen` causes Simple Chrome to run 'gn gen' automatically (see below).
82* `--nogn-gen` Do not run 'gn gen' automatically (nogn-gen is currently the
83 default but that may change).
84* `--gn-extra-args = 'extra_arg = foo other_extra_arg = bar'` For setting
85 extra gn args, e.g. 'dcheck_always_on = true'.
86* `--internal` Sets up Simple Chrome to build and deploy the official *Chrome*
87 instead of *Chromium*.
88* `--log-level=info` Set the log level to 'info' or 'debug' (default is 'warn').
Satoru Takabayashieef6f592017-06-23 04:16:3689
Steven Bennetts5a79a1c2017-11-27 20:05:4790**Note:** See below if you want to use a custom Chrome OS build.
Satoru Takabayashieef6f592017-06-23 04:16:3691
Steven Bennetts5a79a1c2017-11-27 20:05:4792> **Important:** If the Chromium checkout is updated, the Chrome OS build
93> number may have changed (src/chromeos/CHROMEOS_LKGM) in which case it may
94> be necessary to exit and re-enter the Simple Chrome environment to
95> successfully build and deploy Chromium.
Satoru Takabayashieef6f592017-06-23 04:16:3696
Steven Bennetts5a79a1c2017-11-27 20:05:4797
98## Build Chrome
99
100### Configure a build directory (optional)
101
102If you run `cros chrome-sdk` with `--gn-gen`, this step is not necessary.
103
104To create a GN build directory, run the following inside the chrome-sdk shell:
Satoru Takabayashieef6f592017-06-23 04:16:36105
106```
107(inside) gn gen out_$SDK_BOARD/Release --args="$GN_ARGS"
108```
109
110This will generate `out_$SDK_BOARD/Release/args.gn`.
111
112* You must specify `--args`, otherwise your build will not work on the device.
Satoru Takabayashi7cc76c92017-06-26 04:46:05113* You only need to run `gn gen` once within the same `cros chrome-sdk` session.
Satoru Takabayashieef6f592017-06-23 04:16:36114* However, if you exit the session or sync/update chrome the `$GN_ARGS` might
115 change and you need to `gn gen` again.
Satoru Takabayashieef6f592017-06-23 04:16:36116
117You can edit the args with:
118
119```
120(inside) gn args out_$SDK_BOARD/Release
121```
122
123You can replace Release with Debug (or something else) for different
Satoru Takabayashi7cc76c92017-06-26 04:46:05124configurations. See **Debug build** section below.
Satoru Takabayashieef6f592017-06-23 04:16:36125
126[GN build configuration] discusses various GN build configurations. For more
Satoru Takabayashi7cc76c92017-06-26 04:46:05127info on GN, run `gn help` on the command line or read the [quick start guide].
Satoru Takabayashieef6f592017-06-23 04:16:36128
Steven Bennetts5a79a1c2017-11-27 20:05:47129### Build Chrome
130
Satoru Takabayashieef6f592017-06-23 04:16:36131To build Chrome, run:
132
133```
James Cook3a2a0632018-01-18 06:21:56134(inside) autoninja -C out_${SDK_BOARD}/Release chrome chrome_sandbox nacl_helper
Satoru Takabayashieef6f592017-06-23 04:16:36135```
136
James Cook3a2a0632018-01-18 06:21:56137This runs Goma with a large number of concurrent jobs. To watch the build
138progress, find the Goma port (`$ echo $SDK_GOMA_PORT`) and open
Satoru Takabayashieef6f592017-06-23 04:16:36139http://localhost:<port_number> in a browser.
140
141**IMPORTANT**: Do not attempt to build targets other than **chrome, chrome_sandbox,
142nacl_helper**, or (optionally) **chromiumos_preflight** in Simple Chrome, they will
143likely fail.
144
145Congratulations, you've now built Chromium for Chromium OS!
146
147Once you've built Chromium the first time, you can build incrementally just
148using ninja, e.g.:
149
150```
James Cook3a2a0632018-01-18 06:21:56151(inside) autoninja -C out_${SDK_BOARD}/Release chrome
Satoru Takabayashieef6f592017-06-23 04:16:36152```
153
154**Tip:** The default extensions will be installed by the test image you use below.
155
156## Set up the Chromium OS device
157
158Before you can deploy your build of Chromium to the device, it needs to have a
James Cook3a2a0632018-01-18 06:21:56159"test" OS image loaded on it. A test image has tools like rsync that are not part
160of the end-user image.
Satoru Takabayashieef6f592017-06-23 04:16:36161
162### Create a bootable USB stick
163
James Cook3a2a0632018-01-18 06:21:56164Use your browser to download a test image from the URL
Satoru Takabayashieef6f592017-06-23 04:16:36165`https://storage.cloud.google.com/chromeos-image-archive/$BOARD-release/<version>/chromiumos_test_image.tar.xz`
James Cook4c7510f2017-09-11 17:00:11166where `$BOARD` and `<version>` come from your SDK prompt. For example (`sdk link
James Cookba126f12017-08-21 19:59:07167R62-9800.0.0`) is the board `link` using version `R62-9800.0.0`).
Satoru Takabayashieef6f592017-06-23 04:16:36168
James Cookb181cf72017-08-04 19:41:53169Googlers: Prefer the above link for public boards. Images for non-public boards
170are available on go/goldeneye.
171
Satoru Takabayashieef6f592017-06-23 04:16:36172After you download the compressed tarball containing the test image (it should
173have "test" somewhere in the file name), extract the image by running:
174
175```
James Cook3a2a0632018-01-18 06:21:56176(outside) tar xf ~/Downloads/<image-you-downloaded>
Satoru Takabayashieef6f592017-06-23 04:16:36177```
178
Satoru Takabayashi7cc76c92017-06-26 04:46:05179Copy the image to your drive using `cros flash`:
Satoru Takabayashieef6f592017-06-23 04:16:36180
181```
182(inside) cros flash usb:// chromiumos_test_image.bin
183```
184
Satoru Takabayashi7cc76c92017-06-26 04:46:05185If `cros flash` does not work you can do it the old-fashioned way using `dd`.
James Cookba126f12017-08-21 19:59:07186See below.
Satoru Takabayashieef6f592017-06-23 04:16:36187
188### Put your Chrome OS device in dev mode
189
James Cook93506b02018-01-17 06:13:07190Most recent devices can use the [generic instructions]. To summarize:
Satoru Takabayashieef6f592017-06-23 04:16:36191
James Cook93506b02018-01-17 06:13:071921. With the device on, hit Esc + Refresh (F2 or F3) + power button
1932. Wait for the scary "recovery screen"
1943. Hit Ctrl-D to switch to developer mode (there's no prompt)
1954. Press enter to confirm
James Cook3a2a0632018-01-18 06:21:561965. Once it is done, hit Ctrl-D again to boot, then wait
Satoru Takabayashieef6f592017-06-23 04:16:36197
James Cook93506b02018-01-17 06:13:07198From this point on you'll always see the scary screen when you turn on
James Cook3a2a0632018-01-18 06:21:56199the device. Press Ctrl-D to boot.
James Cook93506b02018-01-17 06:13:07200
201Older devices may have [device-specific instructions].
202
James Cook3a2a0632018-01-18 06:21:56203Googlers: If the device asks you to "enterprise enroll" it, click the X
204in the top-right of the dialog to skip it. Trying to use your google.com
205credentials will result in an error.
206
James Cook93506b02018-01-17 06:13:07207### Enable booting from USB
208
James Cook3a2a0632018-01-18 06:21:56209By default Chromebooks will not boot off a USB stick for security reasons.
210You need to turn that on.
211
James Cook93506b02018-01-17 06:13:072121. Start the device
James Cook3a2a0632018-01-18 06:21:562132. Press Ctrl-Alt-F2 to get a terminal. (You can use Ctrl-Alt-F1 to switch
214back if you need to.)
2153. Login as `root` (no password yet, there will be one later)
2164. `enable_dev_usb_boot`
James Cook3d135382017-10-16 16:58:01217
Satoru Takabayashieef6f592017-06-23 04:16:36218### Install the test image onto your device
219
James Cook3a2a0632018-01-18 06:21:56220**NOTE:**
Satoru Takabayashieef6f592017-06-23 04:16:36221
222* Installing Chromium OS onto your hard disk will **WIPE YOUR HARD DISK CLEAN**.
223* *DO NOT* log into this test image with a username and password you care
Satoru Takabayashi7cc76c92017-06-26 04:46:05224 about. **The root password is public** ("test0000"), so anyone with SSH
225 access could compromise the device.
Satoru Takabayashieef6f592017-06-23 04:16:36226
James Cook3a2a0632018-01-18 06:21:562271. Plug the USB stick into the machine and reboot.
2282. At the dev-mode warning screen, press Ctrl-U to boot from the USB stick.
2293. Switch to terminal by pressing Ctrl-Alt-F2
2304. Login as user `chronos`, password `test0000`.
2315. `/usr/sbin/chromeos-install`
2326. Wait for it to copy the image
2337. `shutdown -h now`
234
235You can now unplug the USB stick.
236
James Cookba126f12017-08-21 19:59:07237### Connect device to Ethernet
238
James Cook3a2a0632018-01-18 06:21:56239Use your USB-to-Ethernet adapter to connect the device to a network.
James Cookba126f12017-08-21 19:59:07240
241Googlers: You can use a corp Ethernet jack, which will place you on a special
242restricted network.
Satoru Takabayashieef6f592017-06-23 04:16:36243
244## Deploying Chrome to the device
245
Satoru Takabayashi7cc76c92017-06-26 04:46:05246To deploy the build to a device, you will need direct SSH access to it from your
Satoru Takabayashieef6f592017-06-23 04:16:36247computer. The scripts below handle everything else.
248
249### Checking the IP address
250
2511. Click the status area in the lower-right corner
2522. Click the network icon
Satoru Takabayashi7cc76c92017-06-26 04:46:052533. Click the circled `i` symbol in the lower-right corner
Satoru Takabayashieef6f592017-06-23 04:16:362544. A small window pops up that shows the IP address
255
Satoru Takabayashi7cc76c92017-06-26 04:46:05256This also works both before and after login. Another option is to run `ifconfig`
257from `crosh` (Ctrl-Alt-t) after guest login.
Satoru Takabayashieef6f592017-06-23 04:16:36258
James Cook3a2a0632018-01-18 06:21:56259Try pinging that IP address from your Linux workstation.
260
Satoru Takabayashieef6f592017-06-23 04:16:36261### Using deploy_chrome
262
263Just type `deploy_chrome` from with your chrome-sdk shell. It will use rsync to
264incrementally deploy to the device.
265
266Specify the build output directory to deploy from using `--build-dir`, and the
267IP address of the target device (which must be ssh-able as user 'root') using
268`--to`, where `%CHROME_DIR%` is the path to your Chrome checkout:
269
270```
271(inside) cd %CHROME_DIR%/src
272(inside) deploy_chrome --build-dir=out_${SDK_BOARD}/Release --to=172.11.11.11
273```
274
275**Tip:** `deploy_chrome` lives under
276`$CHROME_DIR/src/third_party/chromite/bin`. You can run `deploy_chrome` outside
277of a `chrome-sdk` shell as well.
278
279**Tip:** Specify the `--target-dir` flag to deploy to a custom location on the
280target device.
281
282**NOTE for GN**: The gn build outputs .so files (for component builds) and some
283test files in a different location than the gyp build. In order for
284`deploy_chrome` to successfully locate these files, it needs to know that chrome
285was built using gn. Currently cros chrome-sdk looks for
286`GYP_CHROMIUM_NO_ACTION=1` as a hint to set `USE="gn"` which will cause
287deploy_chrome to look for files in the correct place. If you do not have
288`GYP_CHROMIUM_NO_ACTION=1` set or if you do but have build chrome with gyp, you
289can set `USE="gn"` or `USE=""` to indicate where deploy_chrome should look for
290output files.
291
James Cookba126f12017-08-21 19:59:07292## Updating the OS image
293
James Cookd1babeb2017-08-31 20:14:10294Every week you should update the Chrome OS image on the device so that
295Chrome and Chrome OS don't get out of sync. Follow the above instructions.
296(When http://crbug.com/761102 is fixed you'll be able to do this over the
297network with `cros flash`.)
James Cookba126f12017-08-21 19:59:07298
Satoru Takabayashieef6f592017-06-23 04:16:36299## Debugging
300
Satoru Takabayashi7cc76c92017-06-26 04:46:05301### Log files
Satoru Takabayashieef6f592017-06-23 04:16:36302
Satoru Takabayashi7cc76c92017-06-26 04:46:05303Chrome-related logs are written to several locations on the device:
Satoru Takabayashieef6f592017-06-23 04:16:36304
Satoru Takabayashi7cc76c92017-06-26 04:46:05305* `/var/log/ui/ui.LATEST` contains messages written to stderr by Chrome
306 before its log file has been initialized.
307* `/var/log/chrome/chrome` contains messages logged by Chrome before a
308 user has logged in.
309* `/home/chronos/user/log/chrome` contains messages logged by Chrome
310 after a user has logged in.
311* `/var/log/messages` contains messages logged by `session_manager`
312 (which is responsible for starting Chrome), in addition to kernel
313 messages when a Chrome process crashes.
314
315### Command-line flags and environment variables
Satoru Takabayashieef6f592017-06-23 04:16:36316
317If you want to tweak the command line of Chrome or its environment, you have to
318do this on the device itself.
319
Satoru Takabayashieef6f592017-06-23 04:16:36320Edit the `/etc/chrome_dev.conf` (device) file. Instructions on using it are in
321the file itself.
322
Satoru Takabayashieef6f592017-06-23 04:16:36323### Debug build
324
325For cros chrome-sdk GN configurations, Release is the default. A debug build of
326Chrome will include useful tools like DCHECK and debug logs like DVLOG. For a
327Debug configuration, specify
Maksim Ivanove066b392017-07-18 14:12:30328`--args="$GN_ARGS is_debug=true is_component_build=false"` (inside).
Satoru Takabayashieef6f592017-06-23 04:16:36329
330Alternately, you can just turn on DCHECKs for a release build. You can do this
331with `--args="$GN_ARGS dcheck_always_on=true"`.
332
333### Deploying debug build without stripping symbols
334
335You need to add `--nostrip` to `deploy_chrome` because otherwise it will strip
336symbols even from a debug build. The rootfs will probably not be big enough to
337hold all the binaries so you need to put it on the stateful partition and bind
Satoru Takabayashi7cc76c92017-06-26 04:46:05338mount over the real directory. Create the directory `/usr/local/chrome` on your
Satoru Takabayashieef6f592017-06-23 04:16:36339device and run:
340
341```
342(inside) deploy_chrome --build-dir=out_$BOARD/Debug \
343 --to=<ip-address> \
344 --target-dir=/usr/local/chrome \
345 --mount-dir=/opt/google/chrome \
346 --nostrip
347```
348
349Notes:
350
351* If you just want crash backtraces in the logs you can deploy a release build
352 with `--nostrip`. You don't need a debug build.
353* The remount from `/usr/local/chrome` to `/opt/google/chrome` is transient, so
354 you need to remount after reboot. Simplest way is to run the same command
355 after reboot (It will not redeploy binaries less there is a change)
356* You may hit `DCHECKs` during startup time, or when you login, which eventually
357 may reboot the device. Please check log files in `/var/log/chrome` or
358 `/home/chronos/user/log`.
Mike Frysinger65790062017-10-23 20:20:56359 * You may create `/run/disable_chrome_restart` to prevent restart
Satoru Takabayashieef6f592017-06-23 04:16:36360 loop and investigate.
361 * You can temporarily disable these `DCHECKs` to proceed, but please
362 file a bug for such `DCHECK` because it's most likely a bug.
363* You may not be able to create `/usr/local/chrome` until
364 [rootfs has been removed] on the device, and the device has been
365 [remounted as read-write]. The mounting will need to be applied on each
366 boot. If the startup needs to be tested a symbolic link will be needed instead
367 * ssh to device
368 * `mkdir /home/chrome`
369 * `rm -R /opt/google/chrome`
370 * `ln -s /home/chrome /opt/google/chrome`
371 * `deploy_chrome --build-dir=out_${SDK_BOARD}/Release --to=172.11.11.11`
372
373### Remote GDB
374
Satoru Takabayashi7cc76c92017-06-26 04:46:05375Core dumps are disabled by default. See [additional debugging tips] for how to
Satoru Takabayashieef6f592017-06-23 04:16:36376enable core files.
377
378On the target machine, open up a port for the gdb server to listen on, and
Satoru Takabayashi7cc76c92017-06-26 04:46:05379attach the gdb server to the top-level Chrome process.
Satoru Takabayashieef6f592017-06-23 04:16:36380
381```
382(device) sudo /sbin/iptables -A INPUT -p tcp --dport 1234 -j ACCEPT
383(device) sudo gdbserver --attach :1234 $(pgrep chrome -P $(pgrep session_manager))
384```
385
386On your host machine (inside the chrome-sdk shell), run gdb and start the Python
387interpreter:
388
389```
390(inside) cd %CHROME_DIR%/src
391(inside) gdb out_${SDK_BOARD}/Release/chrome
392Reading symbols from /usr/local/google2/chromium2/src/out_link/Release/chrome...
393(gdb) pi
394>>>
395```
396
397**Note: These instructions are for targeting an x86_64 device. For now, to target
398an ARM device, you need to run the cross-compiled gdb from within a chroot.**
399
400Then from within the Python interpreter, run these commands:
401
402```
403import os
404sysroot = os.environ['SYSROOT']
405gdb.execute('set sysroot %s' % sysroot)
406gdb.execute('set solib-absolute-prefix %s' % sysroot)
407gdb.execute('set debug-file-directory %s/usr/lib/debug' % sysroot)
408gdb.execute('set solib-search-path out_%s/Release/lib' % os.environ['SDK_BOARD']) # Or "Debug" for a debug build
409gdb.execute('target remote 12.34.56.78:1234')
410```
411
412If you wish, after you connect, you can Ctrl-D out of the Python shell.
413
414Extra debugging instructions are located at http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips.
415
416## Additional instructions
417
418### Updating the version of the Chrome OS SDK
419
420When you invoke `cros chrome-sdk`, the script fetches the version of the SDK
421that corresponds to your Chrome checkout. To update the SDK, sync your Chrome
422checkout and re-run `cros chrome-sdk`.
423
424**IMPORTANT NOTES:**
425
426* Every time that you update Chrome or the Chrome OS SDK, it is possible that
427 Chrome may start depending on new features from a new Chrome OS image. This
428 can cause unexpected problems, so it is important to update your image
429 regularly. Instructions for updating your Chrome OS image are above in
430 [Set Up the Chromium OS device].
431* Don't forget to re-configure your build directories (See
Satoru Takabayashi7cc76c92017-06-26 04:46:05432 **Configure a build directory** section above)
Satoru Takabayashieef6f592017-06-23 04:16:36433
434### Specifying the version of the Chrome OS SDK to use
435
436You can specify a version of Chrome OS to build against. This is handy for
437tracking down when a particular bug was introduced.
438
439```
440(outside) cros chrome-sdk --board=$BOARD --version=3680.0.0
441```
442
443Once you are finished testing the old version of the chrome-sdk, you can always start a new shell with the latest version again. Here's an example:
444
445```
446(outside) cros chrome-sdk --board=$BOARD
447```
448
449### Updating Chrome
450
451**Tip:** If you update Chrome inside the chrome-sdk, you may then be using an SDK
452that is out of date with the current Chrome.
453See **Updating the version of the Chrome OS SDK** section above.
454
455```
456(inside) git rebase-update
457(inside) gclient sync
458```
459
460### Updating Deployed Files
461
462Since the gyp files don't define which targets get installed, that information
463is maintained in the [chromite repo] as part of Chromium OS. That repo is also
464integrated into the Chromium source tree via the `DEPS` file.
465
466In order to add/remove a file from the installed list:
467
4681. Go into the chromite directory and modify `lib/chrome_util.py`
469 1. Look for the `_COPY_PATHS` list
470 2. Add your new file with optional=True
4712. Commit your change locally using git
4723. Upload your change to gerrit<br>
473 `git push origin master:refs/for/master`
4744. Get it reviewed by someone on the Chromium OS build team
475 (e-mail chromium-os-dev@ if you can't find anyone)
4765. Merge the change into Chromium OS via gerrit
4776. Update the DEPS file in Chromium to use the new chromite sha1
Satoru Takabayashi7cc76c92017-06-26 04:46:054787. Check in the Chromium change like normal
Satoru Takabayashieef6f592017-06-23 04:16:364798. Once everything has settled, then go back and remove the `optional=True`
480 from the file list<br>
481 Unless the file is actually optional, then keep it
482
James Cookba126f12017-08-21 19:59:07483### Using a custom Chromium OS build from your Chromium OS chroot (optional)
484
485If you are making changes to Chromium OS and have a Chromium OS build inside a
486chroot that you want to build against, run `cros chrome-sdk` with the `--chroot`
487option.
488
489```
490(outside) cros chrome-sdk --board=$BOARD --chroot=/path/to/chromiumos/chroot
491```
492
493### Flashing an image to USB using dd
494
495In the below command, the X in sdX is the path to your usb key, and you can use
496dmesg to figure out the right path (it'll show when you plug it in). Make sure
497that the USB stick is not mounted before running this. You might have to turn
498off automounting in your operating system.
499
500```
501(inside) sudo dd if=chromiumos_test_image.bin of=/dev/sdX bs=1G
502```
503
504Be careful - you don't want to have `dd` write over your root partition!
505
Satoru Takabayashieef6f592017-06-23 04:16:36506### Using cros flash with xbuddy to download images
507
508`cros flash` with `xbuddy` will automatically download an image and write it to
509USB for you. It's very convenient, but for now it requires a full Chrome OS
510checkout and must be run inside the Chrome OS chroot. ([issue 437877])
511
512```
Satoru Takabayashie0af9cb2017-06-23 05:26:08513(chroot) cros flash usb:// xbuddy://remote/$BOARD/<version>/test
Satoru Takabayashieef6f592017-06-23 04:16:36514```
515
516Replace `$BOARD` and `<version>` with the right values. Both can be seen in your
517SDK prompt (e.g. `(sdk lumpy R27-3789.0.0)` is the lumpy board using version
518R27-3789.0.0).
519
520See the [Cros Flash page] for more details.
521
522### Setting a custom prompt (optional)
523
524By default, cros chrome-sdk prepends something like '`(sdk link R52-8315.0.0)`'
Satoru Takabayashi7cc76c92017-06-26 04:46:05525to the prompt (with the version of the prebuilt system being used).
Satoru Takabayashieef6f592017-06-23 04:16:36526
527If you prefer to colorize the prompt, you can set `PS1` in
528`~/.chromite/chrome_sdk.bashrc`, e.g. to prepend a yellow '`(sdk link 8315.0.0)`'
529to the prompt:
530
531```
532PS1='\[\033[01;33m\](sdk ${SDK_BOARD} ${SDK_VERSION})\[\033[00m\] \w \[\033[01;36m\]$(__git_ps1 "(%s)")\[\033[00m\] \$ '
533```
534NOTE: Currently the release version (e.g. 52) is not available as an environment variable.
535
James Cookba126f12017-08-21 19:59:07536### GYP
537
538The legacy `GYP` build system is no longer supported. You don't need
539`gclient runhooks` any more.
540
Satoru Takabayashieef6f592017-06-23 04:16:36541[instructions in the development guide]: https://www.chromium.org/chromium-os/developer-guide#TOC-Making-changes-to-the-Chromium-web-
James Cookba126f12017-08-21 19:59:07542[Local copy of the Chromium source code and depot_tools]: https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md
Satoru Takabayashieef6f592017-06-23 04:16:36543[Chromium OS board name]: http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices
544[GN build configuration]: http://www.chromium.org/developers/gn-build-configuration
545[quick start guide]: https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/quick_start.md
James Cook3d135382017-10-16 16:58:01546[device-specific instructions]: https://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices
547[generic instructions]: https://www.chromium.org/a/chromium.org/dev/chromium-os/developer-information-for-chrome-os-devices/generic
Satoru Takabayashieef6f592017-06-23 04:16:36548[rootfs has been removed]: https://www.chromium.org/chromium-os/poking-around-your-chrome-os-device#TOC-Making-changes-to-the-filesystem
549[remounted as read-write]: http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips#TOC-Setting-up-the-device
550[additional debugging tips]: http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-tips#TOC-Enabling-core-dumps
551[Set Up the Chromium OS device]: http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/building-chromium-browser#TOC-Set-up-the-Chromium-OS-device
552[chromite repo]: https://chromium.googlesource.com/chromiumos/chromite/
553[issue 437877]: https://bugs.chromium.org/p/chromium/issues/detail?id=403086
554[Cros Flash page]: http://www.chromium.org/chromium-os/build/cros-flash