Commit graph

20 commits

Author SHA1 Message Date
Joe Hattori
ab3d88e71f docs: make sure user is added to the kvm group in running_crosvm/example_simple.md.
At present, the `tools/examples/example_simple` script fails with an
access error when the user is not added to the kvm group.

This commit makes sure the user is added to the kvm group when trying to
run crosvm in running_crosvm/example_simple.md.

Tested on my local environment and checked the script works regardless
of the user being in the kvm group.

BUG=b:294970555
TEST=./tools/presubmit
TEST=./tools/examples/example_simple works regardless of user being in
the kvm group
TEST=shellcheck

Change-Id: I19e42af048774f68c7e0a93afa89a7acd183ba82
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4763917
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
2023-08-09 10:37:25 +00:00
Elie Kheirallah
1a41931529 tools: examples: network - uncomment RSA and add info
Uncommented the line that injetcs the RSA key to allow for SSH
connections to the VM without initial login.
Add more information that if the file is missing, an initial login to
change passwords is required.

BUG=N/A
TEST=mdbook build

Change-Id: Ie0f94da693e04319b7b098df8bfe044ceeeeb8a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4698613
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-07-18 22:52:06 +00:00
Elie Kheirallah
f3c830ec97 book: add more details to network example
Some information seemed omitted from network, which requires some file
creation or modification to get the example working. Added the info.

BUG=N/A
TEST=mdbook build

Change-Id: I01069a3ac690b531e7902eab626ded498df7ebb1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4694602
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Auto-Submit: Elie Kheirallah <khei@google.com>
2023-07-18 16:43:29 +00:00
Elie Kheirallah
ff80c3f9c8 tools: example_simple: fix command for installing packages
Fixing small typo in command to install multiple packages. A comma is
required, and not a space.

BUG=N/A
TEST=mdbook build

Change-Id: I8a7032b3e767d1dc072cf593131f5cbddaf57ff8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4680286
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Elie Kheirallah <khei@google.com>
2023-07-12 20:06:51 +00:00
Elie Kheirallah
556bae3415 docs: document installing packages with virt-builder
Some examples in the book assume that packages are installed. One
example as such is `Vsock`, where there's an assumption that `ncat` is
installed.
Some examples provide a hint at how packages are installed, but it's not
explicitely formulated. And if you skip the examples page and go
directly to Vsock, you lack the information on how to install `ncat`.
Added more information in the Example Usage on how to install packages,
and added the virt-builder command in vsock.

BUG=N/A
TEST=mdbook build

Change-Id: Id5a07287458ce55538ccb8a9b387dfb4b512042f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4675702
Commit-Queue: Elie Kheirallah <khei@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-07-10 15:51:48 +00:00
Alexandre Courbot
4a22a24544 tools/examples: remove remaining instances of --tap-name
Convert this deprecated option to its new unified form.

BUG=None
TEST=prebuild

Change-Id: Idc0048a67e43f0542c617bb78476d6ec205c8a97
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4600497
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
2023-06-09 14:57:45 +00:00
yuanyaogoog
6a8c9dc22c docs: Add virtio-fs document in crosvm book
Crosvm book don't have a documentation for how to run and use the virtio-fs.

Add a fs chapter under device, and upload a runnable example.

BUG=b:235067443
TEST=mdbook build docs/book

Change-Id: I8ef1ceb9d4cfc5f9a2e8afa2416d1f3ba69691b4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4535500
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
2023-05-19 01:45:15 +00:00
yuanyaogoog
ed842f4918 tools: Enable sandbox in example scripts
Currently, example scripts disabled sandboxing feature. However,
sandboxing feature is a big part in crosvm security model.

This commit will create /var/empty directory in host, so that the
minijail can be created.

BUG=b:281951944
TEST=tools/examples/example_simple tools/examples/example_network
tools/example_desktop

Change-Id: I8cece99ee7df22f51b61eb1eeebde7b65a715e04
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4535442
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
2023-05-18 06:36:03 +00:00
yuanyaogoog
940132259b tools: Fix example script and doc in crosvm book
Currently, if a user follows the crosvm's running crosvm section, one
will encounter errors executing the sample codes in tools/examples. We
want the examples codes to run without extra manual operation. Also,
there is a wrong link in the documentation.

Add disable-sandbox option in example_simple, which prevents jail
creation error. Fix a document link in 3.1.Example Usage section to show
the correct source.

BUG=b:281951944
TEST=tools/examples/example_network tools/examples/example_simple

Change-Id: I6383112acdb7c9c5f22f39da872756ab278d1309
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4518099
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2023-05-15 01:42:58 +00:00
Maciek Swiech
f2c9d99b8f tools/examples: remove --disable-sandbox from example
most features (especially for a simple run) should work without
requiring the sandbox to be disabled so we can remove that option from
the example command to run crosvm.

BUG=none
TEST=run the example

Change-Id: I7455062b9745fe520dccf2b54d55ec78109ff9a3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4303079
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Maciek Swiech <drmasquatch@google.com>
2023-03-03 22:17:28 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00
Daniel Verkamp
8930ba079f crosvm: update book and doc links to crosvm.dev
Replaced using this script:

git grep -l 'https://google.github.io/crosvm' \
 | xargs -n1 sed -i \
 -e 's^https://google.github.io/crosvm/doc/^https://crosvm.dev/doc/^g' \
 -e 's^https://google.github.io/crosvm/^https://crosvm.dev/book/^g'

BUG=None
TEST=mdbook build doc/book

Change-Id: I8df4e0bcc1ca1e9044df29998572393c934e29cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795005
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-29 22:54:01 +00:00
Dennis Kempin
4fea399df9 Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.

Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.

BUG=b:239937122
TEST=CQ

Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-28 00:15:50 +00:00
Noah Gold
a0bf9563b2 tools: build example_simple w/ no crosvm features.
The example is currently building a crosvm with gpu support, which
doesn't link properly out of the box. Now, we build explicitly with all
features off, which is sufficient to run the example.

BUG=none
TEST=ran the example.

Change-Id: I1699741f9c094831827b090782be5f5d7492eefa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3756725
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-07-14 02:37:04 +00:00
Daniel Verkamp
9fde8f499a examples/baremetal: exit instead of hanging
Use an INT3 (0xCC) instruction to cause the example to exit after
printing the message. This is more convenient than having to manually
kill crosvm from another terminal.

BUG=None
TEST=Run baremetal and observe that it exits

Change-Id: I4baeecca41d156c82bb1e1b27d0f8c2ba93959f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691966
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-23 22:30:40 +00:00
Daniel Verkamp
bf7d3bd38f examples/baremetal: make paddr == vaddr
Fix loading of the example baremetal kernel with the fixed ELF kernel
loader:
- Remove the "RAM" address space so virtual and physical address match.
- Remove the 0x200-byte padding now that entry point address is used.

BUG=b:234155022
TEST=Run baremetal as in tools/examples/baremetal/README.md

Change-Id: I61394cdf4bf71f91736da5a636b0088ecfe78c84
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3691965
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-23 22:30:39 +00:00
Yuanchu Xie
4071d1ef5e examples: use rwdisk instead of rwroot
rwroot automatically adds root=/dev/vd[a-z], but the example image
actually uses /dev/vda5. This leads to confusion when two root= kernel
command line arguments are passed in and only one of them works.

Therefore we use rwdisk instead which doesn't add the kernel argument.

BUG=b:236198584
TEST=mdbook builds, examples build and run

Change-Id: I9bfc05445b1e2aef197a43ee647d7c784d50dad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708365
Commit-Queue: Yuanchu Xie <yuanchu@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-06-17 17:43:41 +00:00
Anton Romanov
a4cb63d7ce crosvm: add example rust baremetal app that can be booted with crosvm
BUG=none
TEST=`cargo run`

Change-Id: I97eb56eec0d08c67e62755ef21b5ac0cd3e9a461
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3638965
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-10 23:36:47 +00:00
Dennis Kempin
cde666cd54 Reorganize usage doc and add example usage
BUG=b:214104901
TEST=mdbook serve

Change-Id: I7039493212912cb698f74967abef228df278f4c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3399872
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-01-27 21:29:10 +00:00
Dennis Kempin
df640d068c Add functional crosvm examples for running on linux
Two examples are added. A simple one and one with network
configured.

The examples are written in a way they can be integrated
with the mdbook to form a tutorial. This will ensure the
tutorial code snippets stay up to date.

The documentation for networking is added after
https://crrev.com/c/3237468 is merged.

BUG=b:214104901
TEST=./tools/examples/example_simple

Change-Id: I33682878858d8a0324fbb6a87e33cd55b29811b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3388063
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-01-18 23:24:00 +00:00