summary refs log tree commit diff
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@outlook.com>2020-06-10 11:44:52 -0700
committerAlyssa Ross <hi@alyssa.is>2020-06-13 08:54:01 +0000
commit13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0 (patch)
tree18abc300d1bac1e743b596e1eaee0ad1656b4aec
parentfb12866ffe94dda9879d8879dee3043df2d60e7a (diff)
downloaddoc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar.gz
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar.bz2
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar.lz
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar.xz
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.tar.zst
doc-13e7dab5145c84aa7dd1fa65aaa6c33e2a793bc0.zip
Document spectrum-vm
spectrum-vm is a handy way to start a crosvm instance for testing crosvm
itself, the kernel, or the rootfs. This commit adds some fledgling
documentation on its functionality and usage.

Reviewed-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r--developer-manual.adoc52
1 files changed, 52 insertions, 0 deletions
diff --git a/developer-manual.adoc b/developer-manual.adoc
index b7eb2cb..0f4b30f 100644
--- a/developer-manual.adoc
+++ b/developer-manual.adoc
@@ -106,6 +106,58 @@ the https://spectrum-os.org/doc/crosvm/crosvm/[crosvm documentation]
 for the version currently used by Spectrum is hosted on the Spectrum
 website.
 
+==== spectrum-vm
+
+`spectrum-vm` is a shell script that allows for testing various Spectrum
+VM components, including crosvm, the kernel, and the root filesystem
+("rootfs" for short).  The simplest way to use this tool is by running
+`nix-shell -I nixpkgs=/path/to/nixpkgs-spectrum -p
+spectrumPackages.spectrum-vm --run spectrum-vm` in a terminal, which
+will start up an instance of crosvm from Nixpkgs running Wayfire in a
+new window.
+
+****
+Be advised that Wayfire's default keymap is set to Dvorak
+https://spectrum-os.org/git/nixpkgs/tree/pkgs/os-specific/linux/spectrum/rootfs/default.nix[inside
+of the rootfs] -- to change this to your preferred keymap, just set the
+`xkb_layout` option (or remove it altogether for a default of QWERTY).
+****
+
+Once you are ready to end your crosvm session, switch back to where you
+ran `spectrum-vm` and type `reboot` (not `poweroff`).  This window is not
+limited to just stopping the VM, however; it is a functional serial
+console where you can run commands like `env` and `cat /etc/passwd`.
+
+****
+Although it is currently not possible to execute commands as root inside
+the graphical environment, one can instead use the serial console to run
+privileged commands.
+****
+
+===== Examples
+
+As mentioned above, `spectrum-vm` also supports options that allow you
+to specify custom components or run arbitrary commands before exiting:
+
+----
+nix-shell -I nixpkgs=/path/to/nixpkgs-spectrum -p spectrumPackages.spectrum-vm
+
+# display the currently supported options for spectrum-vm
+nix-shell$ spectrum-vm --help
+
+# run a command that will print out the VM's PATH to the serial terminal and exit
+nix-shell$ spectrum-vm -c 'echo $PATH'
+
+# use the specified crosvm and disable sandboxing
+nix-shell$ spectrum-vm -C target/debug/crosvm -- --disable-sandbox
+
+# use the specified kernel image
+nix-shell$ spectrum-vm -k result/bzImage
+
+# use the specified squashfs as the root filesystem image
+nix-shell$ spectrum-vm -f squashfs
+----
+
 ==== Hacking on crosvm
 
 There are a few ways to get a crosvm development environment.  You can