From d9082cff491433caa9f73dc412156b73b820ce88 Mon Sep 17 00:00:00 2001 From: Stephen Barber Date: Fri, 14 Feb 2020 13:38:03 -0800 Subject: [PATCH] README: add instructions for building on Linux + CrOS We have instructions for building with Docker, but it's now possible to build for normal Linux distros too. Also add a pointer to the main CrOS developer guide. BUG=none TEST=follow the instructions Change-Id: Ic7ce498268f8057fbe90a88166017f54108d0e16 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2057747 Reviewed-by: Dylan Reid Tested-by: kokoro Tested-by: Stephen Barber Commit-Queue: Stephen Barber --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 51c200ddb7..f2d72aaaea 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,61 @@ an exploit in the devices. The channel #crosvm on [freenode](https://webchat.freenode.net/#crosvm) is used for technical discussion related to crosvm development and integration. -## Building with Docker +## Getting started + +### Building for CrOS + +crosvm on Chromium OS is built with Portage, so it follows the same general +workflow as any `cros_workon` package. The full package name is +`chromeos-base/crosvm`. + +See the [Chromium OS developer guide] for more on how to build and deploy with +Portage. + +[Chromium OS developer guide]: https://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md + +### Building with Docker See the [README](docker/README.md) from the `docker` subdirectory to learn how to build crosvm in enviroments outside of the Chrome OS chroot. +### Building for Linux + +>**NOTE:** Building for Linux natively is new and not fully supported. + +First, [set up depot_tools] and use `repo` to sync down the crosvm source +tree. This is a subset of the entire Chromium OS manifest with just enough repos +to build crosvm. + +```sh +mkdir crosvm +cd crosvm +repo init -g crosvm -u https://chromium.googlesource.com/chromiumos/manifest.git --repo-url=https://chromium.googlesource.com/external/repo.git +repo sync +``` + +A basic crosvm build links against `libcap` and `libfdt`. On a Debian-based system, +you can install `libcap-dev` and `libfdt-dev`. + +Handy Debian one-liner for all build and runtime deps, particularly if you're +running Crostini: +```sh +sudo apt install build-essential libcap-dev libfdt-dev pkg-config python +``` + +Known issues: +* Seccomp policy files have hardcoded absolute paths. You can either fix up + the paths locally, or set up an awesome hacky symlink: `sudo mkdir + /usr/share/policy && sudo ln -s /path/to/crosvm/seccomp/x86_64 + /usr/share/policy/crosvm`. We'll eventually build the precompiled + policies [into the crosvm binary](http://crbug.com/1052126). +* Devices can't be jailed if `/var/empty` doesn't exist. `sudo mkdir -p + /var/empty` to work around this for now. + +And that's it! You should be able to `cargo build/run/test`. + +[set up depot_tools]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up + ## Usage To see the usage information for your version of crosvm, run `crosvm` or `crosvm