patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH doc v2] Document spectrum-vm
@ 2020-06-10 18:44 Cole Helbling
  2020-06-13  9:17 ` Alyssa Ross
  0 siblings, 1 reply; 2+ messages in thread
From: Cole Helbling @ 2020-06-10 18:44 UTC (permalink / raw)
  To: devel; +Cc: Cole Helbling

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.
---
Takes into account review suggestions and tweaks a bit of wording here
and there.

Specifically, I clarified that rootfs means the root filesystem, added
an aside that the serial console can be used to run privileged commands,
dropped the full `spectrum-vm --help` text, and moved and reformatted
the usage examples.

 developer-manual.adoc | 53 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/developer-manual.adoc b/developer-manual.adoc
index b7eb2cb..a98330f 100644
--- a/developer-manual.adoc
+++ b/developer-manual.adoc
@@ -106,6 +106,59 @@ 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 even 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
-- 
2.26.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH doc v2] Document spectrum-vm
  2020-06-10 18:44 [PATCH doc v2] Document spectrum-vm Cole Helbling
@ 2020-06-13  9:17 ` Alyssa Ross
  0 siblings, 0 replies; 2+ messages in thread
From: Alyssa Ross @ 2020-06-13  9:17 UTC (permalink / raw)
  To: Cole Helbling; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

> 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.
> ---
> Takes into account review suggestions and tweaks a bit of wording here
> and there.
>
> Specifically, I clarified that rootfs means the root filesystem, added
> an aside that the serial console can be used to run privileged commands,
> dropped the full `spectrum-vm --help` text, and moved and reformatted
> the usage examples.

Pushed, with a couple of minor tweaks.  I put two spaces between each
sentence for consistency with the rest of the file, and...

> +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 even run commands like `env` and `cat
> +/etc/passwd`.

I removed this "even"    ^^^^

To ssh://atuin/home/spectrum/git/doc.git
 + fb12866...13e7dab master -> master

Thanks so much!  I'll take this off todo.html.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-13  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 18:44 [PATCH doc v2] Document spectrum-vm Cole Helbling
2020-06-13  9:17 ` Alyssa Ross

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).