Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

How to build chromium on ChromeOS

mingmingtasd edited this page Mar 24, 2021 · 9 revisions

Requirements

System requirements for build device

  • A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly recommended.
  • At least 100GB of free disk space.
  • You must have Git and Python v2 installed already.

Most development is done on Ubuntu (currently 14.04, Trusty Tahr). There are some instructions for other distros below, but they are mostly unsupported.

ChromeOS device (Model Eve)

Step-by-step guide

1. Install depot_tools

  • Clone the depot_tools repository:
    $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

  • Add depot_tools to the end of your PATH (you will probably want to put this in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools to /path/to/depot_tools:
    $ export PATH="$PATH:/path/to/depot_tools"

  • When cloning depot_tools to your home directory do not use ~ on PATH, otherwise gclient runhooks will fail to run. Rather, you should use either $HOME or the absolute path:
    $ export PATH="$PATH:${HOME}/depot_tools"

2. Get the code

  • Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):
    $ mkdir chromium && cd chromium

  • Clone the chromium-src repository:
    $ git clone https://github.com/otcshare/chromium-src.git

  • Create .gclient file and edit the file to contain the following arguments:
    $ vim .gclient
    solutions = [
    {
    "url": "http://github.com/otcshare/chromium-src.git@webml",
    "managed": False,
    "name": "src",
    "deps_file": ".DEPS.git",
    "custom_deps": {},
    },
    ]
    target_os = ["chromeos"]

3. Config the proxy (proxy needed only)

  • Make sure the proxy settings is correct in terminal:
    $ export http_proxy=http://proxy_addr:proxy_port
    $ export https_proxy=https://proxy_addr:proxy_port

  • Create .boto file and edit the file to contain the following arguments:
    $ vim .boto
    [boto]
    proxy=http://proxy_addr
    proxy_port=proxy_port

  • Add .boto config to system enviroment:
    $ export NO_AUTH_BOTO_CONFIG="/path/to/.boto"

4. Install additional build dependencies

Once you have checked out the code, and assuming you're using Ubuntu, run build/install-build-deps.sh
$ mv chromium-src ./src && cd src && ./build/install-build-deps.sh

You may need to adjust the build dependencies for other distros. There are some notes at the end of this document, but we make no guarantees for their accuracy.

5. Update your checkout and run the hooks

To update an existing checkout, you can run:
gclient sync

6. Enter the Simple Chrome environment

/path/to/webnn $ cros chrome-sdk --board=amd64-generic --nogoma

7. Configure Google API key

  • Apply for Google API key

  • Run gn command:
    /path/to/webnn/src $ gn args out_amd64-generic/Release/

  • Configure Google API key in args.gn file:
    google_api_key = "<google_api_key>"
    google_default_client_id = "<client_id>"
    google_default_client_secret = "<client_secret>"

8. Build Chromium

Build Chromium (the “chrome” target) with Ninja using command:
(sdk) /path/to/webnn/src $ ninja -C out_amd64-generic/Release/ chrome

9. Deploy Chromium to target ChromeOS device

  • Flashed ChromeOS test Eve image on target ChromeOS device following this guide

  • Deploy chrome binaries:
    (sdk) /path/to/webnn/src $ deploy_chrome --board=amd64-generic --build-dir=out_amd64-generic/Release --to=<ChromeOS_device_ip> --mount --noremove-rootfs-verification

  • Copy these following libraries under out_amd64-generic/Release folder from build device
    libinference_engine.so # Use for Inference Engine backend
    libiomp5.so # Use for MKLDNN and DNNL backend
    libMKLDNNPlugin.so # Use for MKLDNN backend
    libdnnl.so # Use for DNNL backend
    to /opt/google/chrome folder of target ChromeOS device

  • Create /etc/chrome_dev.conf file on target ChromeOS device, add following contents:
    --no-sandbox
    --use-inference-engine

10. Run Chromium

Click Chromium App to run it