From cb14f61ce70b8559143b82a2e77fcf5bbab4064d Mon Sep 17 00:00:00 2001 From: Keiichi Watanabe Date: Sat, 30 Oct 2021 00:51:26 +0900 Subject: [PATCH] mdbook: Explain how to build a binary for beginner Add a section to explain how to build crosvm binary for beginners who may not have used cargo. Also, ran mdformat on the file. BUG=none TEST=check Change-Id: I902157cd471652b829d73bb27fc52e04db64d6d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3252186 Auto-Submit: Keiichi Watanabe Commit-Queue: Dennis Kempin Tested-by: kokoro Reviewed-by: Dennis Kempin --- docs/book/src/building_crosvm/linux.md | 28 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/book/src/building_crosvm/linux.md b/docs/book/src/building_crosvm/linux.md index e86cc57908..5d4c92497e 100644 --- a/docs/book/src/building_crosvm/linux.md +++ b/docs/book/src/building_crosvm/linux.md @@ -67,12 +67,21 @@ The container image is big and may take a while to download when first used. Once started, you can follow all instructions in this document within the container shell. +## Building a binary + +If you simply want to try crosvm, run `cargo build`. Then the binary is +generated at `./target/debug/crosvm`. Now you can move to +[Basic Usage](/running_crosvm/basic_usage.html). + +If you want to enable [additional features](/running_crosvm/features.html), use +the `--features` flag. (e.g. `cargo build --features=gdb`) + ## Development ### Iterative development -You can use cargo as usual for crosvm development to `cargo build` and -`cargo test` single crates that you are working on. +You can use cargo as usual for crosvm development to `cargo build` and `cargo +test` single crates that you are working on. If you are working on aarch64 specific code, you can use the `set_test_target` tool to instruct cargo to build for aarch64 and run tests on a VM: @@ -159,15 +168,14 @@ skip some slower checks, like building for other platforms. also stop minijail from killing processes that violate the seccomp rule, making the sandboxing much less aggressive. - 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 + 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. +- Devices can't be jailed if `/var/empty` doesn't exist. `sudo mkdir -p + /var/empty` to work around this for now. - You need read/write permissions for `/dev/kvm` to run tests or other crosvm - instances. Usually it's owned by the `kvm` group, so - `sudo usermod -a -G kvm $USER` and then log out and back in again to fix - this. + instances. Usually it's owned by the `kvm` group, so `sudo usermod -a -G kvm + $USER` and then log out and back in again to fix this. - Some other features (networking) require `CAP_NET_ADMIN` so those usually need to be run as root.