derat | 8171050 | 2017-02-22 17:57:55 | [diff] [blame] | 1 | # Chrome OS Build Instructions (Chromium OS on Linux) |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 2 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 3 | Chromium on Chromium OS uses Linux Chromium as a base, but adds a large number |
| 4 | of features to the code. For example, the login UI, window manager and system UI |
| 5 | are part of the Chromium code base and built into the chrome binary. |
stevenjb | 89ee24b | 2016-04-19 19:26:42 | [diff] [blame] | 6 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 7 | Fortunately, most Chromium changes that affect Chromium OS can be built and |
| 8 | tested on a Linux workstation. This build is called "linux-chromeos". In this |
| 9 | configuration most system services (like the power manager, bluetooth daemon, |
| 10 | etc.) are stubbed out. The entire system UI runs in a single X11 window on your |
| 11 | desktop. |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 12 | |
| 13 | First, follow the [normal Linux build |
Tom Anderson | 9f5be079 | 2019-12-19 20:54:32 | [diff] [blame] | 14 | instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions.md) |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 15 | as usual to get a Chromium checkout. |
| 16 | |
Ken Rockot | a21ef76 | 2018-05-02 04:02:37 | [diff] [blame] | 17 | ## Updating your gclient config |
| 18 | |
| 19 | Chromium OS builds of Chromium require some additional build dependencies which |
| 20 | can be synced by adding `'chromeos'` to the `target_os` list in your `.gclient` |
| 21 | configuration. This file is located one level up from your Chromium checkout's |
| 22 | `src`. |
| 23 | |
| 24 | If you don't already have a `target_os` line present, simply add this to the |
| 25 | end of the `.gclient` file: |
| 26 | |
| 27 | target_os = ['chromeos'] |
| 28 | |
| 29 | If you already have a `target_os` line present in your `.gclient file`, you can |
| 30 | simply append `'chromeos'` to the existing list there. For example: |
| 31 | |
| 32 | target_os = ['android', 'chromeos'] |
| 33 | |
| 34 | Once your `.gclient` file is updated, you will need to run `gclient sync` once |
| 35 | before proceeding with the rest of these instructions. |
| 36 | |
stevenjb | ec7b4e3c | 2016-04-18 22:52:02 | [diff] [blame] | 37 | ## Building and running Chromium with Chromium OS UI on your local machine |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 38 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 39 | Run the following in your chromium checkout: |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 40 | |
stevenjb | ec7b4e3c | 2016-04-18 22:52:02 | [diff] [blame] | 41 | $ gn gen out/Default --args='target_os="chromeos"' |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 42 | $ autoninja -C out/Default chrome |
Joel Hockey | 82e0062 | 2020-08-12 05:26:11 | [diff] [blame^] | 43 | $ out/Default/chrome --use-system-clipboard |
stevenjb | ec7b4e3c | 2016-04-18 22:52:02 | [diff] [blame] | 44 | |
Dirk Pranke | 8bd55f2 | 2018-10-24 21:22:10 | [diff] [blame] | 45 | (`autoninja` is a wrapper that automatically provides optimal values for the |
| 46 | arguments passed to `ninja`). |
| 47 | |
Matt Giuca | d8cebe4 | 2018-01-09 04:37:46 | [diff] [blame] | 48 | Some additional options you may wish to set by passing in `--args` to `gn gen` |
| 49 | or running `gn args out/Default`: |
stevenjb | 89ee24b | 2016-04-19 19:26:42 | [diff] [blame] | 50 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 51 | 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 Dufault | bfef58b | 2018-01-12 22:39:48 | [diff] [blame] | 56 | |
| 57 | # Set the following true to create a Chrome (instead of Chromium) build. |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 58 | # 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. |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 61 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 62 | NOTE: You may wish to replace 'Default' with something like 'Cros' if |
| 63 | you switch back and forth between Linux and Chromium OS builds, or 'Debug' |
| 64 | if you want to differentiate between Debug and Release builds (see below). |
| 65 | |
| 66 | See [GN Build Configuration](https://www.chromium.org/developers/gn-build-configuration) |
| 67 | for more information about configuring your build. |
| 68 | |
| 69 | You can also build and run test targets like `unit_tests`, `browser_tests`, etc. |
| 70 | |
Joel Hockey | 82e0062 | 2020-08-12 05:26:11 | [diff] [blame^] | 71 | ## Flags |
| 72 | |
| 73 | Some 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 Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 93 | ## Login notes |
| 94 | |
| 95 | By 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 H | 42fa251 | 2019-06-13 18:09:39 | [diff] [blame] | 101 | `--user-data-dir=/tmp/chrome [email protected] |
| 102 | [email protected]` |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 103 | * To run in guest mode instantly, add: |
| 104 | `--user-data-dir=/tmp/chrome --bwsi --incognito --login-user='$guest' |
| 105 | --login-profile=user` |
| 106 | |
| 107 | Signing in as a specific user is useful for debugging features like sync |
| 108 | that require a logged in user. |
| 109 | |
| 110 | ## Graphics notes |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 111 | |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 112 | The Chromium OS build requires a functioning GL so if you plan on |
| 113 | testing it through Chromium Remote Desktop you might face drawing |
| 114 | problems (e.g. Aura window not painting anything). Possible remedies: |
| 115 | |
Matt Giuca | d8cebe4 | 2018-01-09 04:37:46 | [diff] [blame] | 116 | * `--ui-enable-software-compositing --ui-disable-threaded-compositing` |
Alexis Hetu | 3384f06 | 2018-08-27 18:30:44 | [diff] [blame] | 117 | * `--use-gl=swiftshader`, but it's slow. |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 118 | |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 119 | To more closely match the UI used on devices, you can install fonts used |
| 120 | by Chrome OS, such as Roboto, on your Linux distro. |
| 121 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 122 | ## Compile Chromium for a Chromium OS device |
tfarina | 5b37337 | 2016-03-27 08:06:21 | [diff] [blame] | 123 | |
James Cook | 4dca079 | 2018-01-24 22:57:34 | [diff] [blame] | 124 | See [Building Chromium for a Chromium OS device](https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md) |
| 125 | for information about building and testing Chromium for Chromium OS. |