1# Running ChromeOS UI on Linux 2Note that this instructions may not work for you. They have been 3verified to work as of 2018/06/06 on standard Google engineering 4workstations as issued to engineerings on the Chrome team. Please 5submit patches describing the steps needed for other machines or distributions. 6 7## Nouveau 8If you have an NVidia card, you probably have the binary drivers installed. These install a blacklist for the nouveau kernel modules. Best is to remove the nvidia driver and switch to nouveau completely: 9 10``` 11$ sudo apt-get remove --purge "nvidia*" 12$ sudo apt-get install xserver-xorg-input-evdev xserver-xorg-input-mouse xserver-xorg-input-kbd xserver-xorg-input-libinput xserver-xorg-video-nouveau 13$ sudo dpkg-reconfigure xserver-xorg 14$ # If you are using a Google development machine: 15$ sudo goobuntu-config set custom_video_driver custom 16``` 17 18Default version of nouveau xorg driver is too old for the NV117 chipset in Z840 machines. Install a newer version: 19 20``` 21$ cd /tmp 22$ wget http://http.us.debian.org/debian/pool/main/x/xserver-xorg-video-nouveau/xserver-xorg-video-nouveau_1.0.15-2_amd64.deb 23$ sudo apt-get install ./xserver-xorg-video-nouveau_1.0.15-2_amd64.deb 24``` 25 26At this point you *must reboot.* If you run into issues to load video at boot then disable `load_video` and `gfx_mode` in `/boot/grub/grub.cfg`. 27 28## Building Chrome 29Checkout chromium as per your usual workflow. See [Get the Code: 30Checkout, Build, & Run 31Chromium](https://www.chromium.org/developers/how-tos/get-the-code). 32Googlers should checkout chromium source code as described here: 33[Building Chromium on a corporate Linux 34workstation](https://companydoc.corp.google.com/company/teams/chrome/build_instructions.md?cl=head) 35 36We want to build on linux on top of Ozone with the DRM 37(Direct Render Manager) platform which is backed by GBM 38(Generic Buffer Management). The following instructions builds 39chromium targets along with minigbm that lives in the chromium 40tree `src/third_party/minigbm`. Currently, there is no builder for 41this configuration so while this worked (mostly) when this document 42was written, some experimentation may be necessary. 43 44Set the gn args for your output dir target `out/Nouveau` with: 45 46``` 47$ gn args out/Nouveau 48Add the following arguments: 49dcheck_always_on = true 50use_ozone = true 51target_os = "chromeos" 52ozone_platform_drm = true 53ozone_platform = "drm" 54use_system_minigbm = false 55target_sysroot = "//build/linux/debian_jessie_amd64-sysroot" 56is_debug = false 57use_goma = true 58use_xkbcommon = true 59#use_evdev_gestures = true 60#use_system_libevdev = false 61#use_system_gestures = false 62 63# Non-Googlers should set the next two flags to false 64is_chrome_branded = true 65is_official_build = true 66use_pulseaudio = false 67``` 68 69Build official release build of chrome: 70 71``` 72$ ninja -j768 -l24 -C out/Nouveau chrome chrome_sandbox nacl_helper 73$ # Give user access to dri, input and audio device nodes: 74$ sudo sh -c "echo 'KERNEL==\"event*\", NAME=\"input/%k\", MODE=\"660\", GROUP=\"plugdev\"' > /etc/udev/rules.d/90-input.rules" 75$ sudo sh -c "echo 'KERNEL==\"card[0-9]*\", NAME=\"dri/%k\", GROUP=\"video\"' > /etc/udev/rules.d/90-dri.rules" 76$ sudo udevadm control --reload 77$ sudo udevadm trigger --action=add 78$ sudo usermod -a -G plugdev $USER 79$ sudo usermod -a -G video $USER 80$ sudo usermod -a -G audio $USER 81$ newgrp video 82$ newgrp plugdev 83$ newgrp audio 84$ # Stop pulseaudio if running: 85$ pactl exit 86``` 87 88Run chrome: (Set `CHROMIUM_SRC` to the directory containing your Chrome checkout.) 89 90``` 91$ sudo chvt 8; EGL_PLATFORM=surfaceless $CHROMIUM_SRC/out/Nouveau/chrome --ozone-platform=drm --force-system-compositor-mode --login-profile=user --user-data-dir=$HOME/.config/google-chrome-gbm --use-gl=egl --enable-wayland-server --login-manager --ash-constrain-pointer-to-root --default-tile-width=512 --default-tile-height=512 --system-developer-mode --crosh-command=/bin/bash 92``` 93 94Login to Chrome settings should synchronize. 95 96Install Secure Shell if not already installed from [the web store](https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo?hl=en) 97 98