blob: 6874a1e13f33aa8f519113e7f95f7c82d39b14bf [file] [log] [blame] [view]
derat81710502017-02-22 17:57:551# Chrome OS Build Instructions (Chromium OS on Linux)
tfarina5b373372016-03-27 08:06:212
James Cook4dca0792018-01-24 22:57:343Chromium on Chromium OS uses Linux Chromium as a base, but adds a large number
4of features to the code. For example, the login UI, window manager and system UI
5are part of the Chromium code base and built into the chrome binary.
stevenjb89ee24b2016-04-19 19:26:426
James Cook4dca0792018-01-24 22:57:347Fortunately, most Chromium changes that affect Chromium OS can be built and
8tested on a Linux workstation. This build is called "linux-chromeos". In this
9configuration most system services (like the power manager, bluetooth daemon,
10etc.) are stubbed out. The entire system UI runs in a single X11 window on your
11desktop.
tfarina5b373372016-03-27 08:06:2112
13First, follow the [normal Linux build
Tom Anderson9f5be0792019-12-19 20:54:3214instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions.md)
tfarina5b373372016-03-27 08:06:2115as usual to get a Chromium checkout.
16
Ken Rockota21ef762018-05-02 04:02:3717## Updating your gclient config
18
19Chromium OS builds of Chromium require some additional build dependencies which
20can be synced by adding `'chromeos'` to the `target_os` list in your `.gclient`
21configuration. This file is located one level up from your Chromium checkout's
22`src`.
23
24If you don't already have a `target_os` line present, simply add this to the
25end of the `.gclient` file:
26
27 target_os = ['chromeos']
28
29If you already have a `target_os` line present in your `.gclient file`, you can
30simply append `'chromeos'` to the existing list there. For example:
31
32 target_os = ['android', 'chromeos']
33
34Once your `.gclient` file is updated, you will need to run `gclient sync` once
35before proceeding with the rest of these instructions.
36
stevenjbec7b4e3c2016-04-18 22:52:0237## Building and running Chromium with Chromium OS UI on your local machine
tfarina5b373372016-03-27 08:06:2138
James Cook4dca0792018-01-24 22:57:3439Run the following in your chromium checkout:
tfarina5b373372016-03-27 08:06:2140
stevenjbec7b4e3c2016-04-18 22:52:0241 $ gn gen out/Default --args='target_os="chromeos"'
James Cook4dca0792018-01-24 22:57:3442 $ autoninja -C out/Default chrome
Joel Hockey82e00622020-08-12 05:26:1143 $ out/Default/chrome --use-system-clipboard
stevenjbec7b4e3c2016-04-18 22:52:0244
Dirk Pranke8bd55f22018-10-24 21:22:1045(`autoninja` is a wrapper that automatically provides optimal values for the
46arguments passed to `ninja`).
47
Matt Giucad8cebe42018-01-09 04:37:4648Some additional options you may wish to set by passing in `--args` to `gn gen`
49or running `gn args out/Default`:
stevenjb89ee24b2016-04-19 19:26:4250
James Cook4dca0792018-01-24 22:57:3451 use_goma = true # Googlers: Use build farm, compiles faster.
52 is_component_build = true # Links faster.
53 is_debug = false # Release build, runs faster.
54 dcheck_always_on = true # Enables DCHECK despite release build.
55 enable_nacl = false # Skips native client build, compiles faster.
Jacob Dufaultbfef58b2018-01-12 22:39:4856
57 # Set the following true to create a Chrome (instead of Chromium) build.
James Cook4dca0792018-01-24 22:57:3458 # This requires a src-internal checkout.
59 is_chrome_branded = false # Adds internal features and branded art assets.
60 is_official_build = false # Turns on many optimizations, slower build.
tfarina5b373372016-03-27 08:06:2161
James Cook4dca0792018-01-24 22:57:3462NOTE: You may wish to replace 'Default' with something like 'Cros' if
63you switch back and forth between Linux and Chromium OS builds, or 'Debug'
64if you want to differentiate between Debug and Release builds (see below).
65
66See [GN Build Configuration](https://www.chromium.org/developers/gn-build-configuration)
67for more information about configuring your build.
68
69You can also build and run test targets like `unit_tests`, `browser_tests`, etc.
70
Joel Hockey82e00622020-08-12 05:26:1171## Flags
72
73Some useful flags:
74
75* `--ash-debug-shortcuts`: Enable shortcuts such as Ctl+Alt+Shift+T to toggle
76 tablet mode.
77* `--ash-host-window-bounds="0+0-800x600,800+0-800x600"`: Specify one or more
78 virtual screens, by display position and size.
79* `--enable-features=Feature1,OtherFeature2`: Enable specified features.
80 Features are often listed in chrome://flags, or in source files such as
81 [chrome_features.cc](https://source.chromium.org/chromium/chromium/src/+/master:chrome/common/chrome_features.cc)
82 or [chromeos_features.cc](https://source.chromium.org/chromium/chromium/src/+/master:chromeos/constants/chromeos_features.cc).
83 Note that changing values in chrome://flags does not work for
84 linux-chromeos, and this flag must be used.
85* `--enable-ui-devtools[=9223]`: Allow debugging of the system UI through
86 devtools either within linux-chromeos at chrome://inspect, or from a remote
87 browser at
88 devtools://devtools/bundled/devtools_app.html?uiDevTools=true&ws=127.0.0.1:9223/0
89* `--remote-debugging-port=9222`: Allow debugging through devtools at
90 http://localhost:9222
91* `--use-system-clipboard`: Integrate clipboard with the host X11 system.
92
James Cook4dca0792018-01-24 22:57:3493## Login notes
94
95By default this build signs in with a stub user. To specify a real user:
96
97* For first run, add the following options to chrome's command line:
98 `--user-data-dir=/tmp/chrome --login-manager`
99* Go through the out-of-the-box UX and sign in with a real Gmail account.
100* For subsequent runs, add:
Toby H42fa2512019-06-13 18:09:39101 `--user-data-dir=/tmp/chrome [email protected]
102 [email protected]`
James Cook4dca0792018-01-24 22:57:34103* To run in guest mode instantly, add:
104 `--user-data-dir=/tmp/chrome --bwsi --incognito --login-user='$guest'
105 --login-profile=user`
106
107Signing in as a specific user is useful for debugging features like sync
108that require a logged in user.
109
110## Graphics notes
tfarina5b373372016-03-27 08:06:21111
tfarina5b373372016-03-27 08:06:21112The Chromium OS build requires a functioning GL so if you plan on
113testing it through Chromium Remote Desktop you might face drawing
114problems (e.g. Aura window not painting anything). Possible remedies:
115
Matt Giucad8cebe42018-01-09 04:37:46116* `--ui-enable-software-compositing --ui-disable-threaded-compositing`
Alexis Hetu3384f062018-08-27 18:30:44117* `--use-gl=swiftshader`, but it's slow.
tfarina5b373372016-03-27 08:06:21118
tfarina5b373372016-03-27 08:06:21119To more closely match the UI used on devices, you can install fonts used
120by Chrome OS, such as Roboto, on your Linux distro.
121
James Cook4dca0792018-01-24 22:57:34122## Compile Chromium for a Chromium OS device
tfarina5b373372016-03-27 08:06:21123
James Cook4dca0792018-01-24 22:57:34124See [Building Chromium for a Chromium OS device](https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md)
125for information about building and testing Chromium for Chromium OS.