|tagger||Andy Lutomirski <email@example.com>||Thu Oct 10 10:09:01 2019 -0700|
Version 0.1 -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbQX7jLaPw8YJPWa+A/hyr8v7iDcFAl2fZbEACgkQA/hyr8v7 iDf1hQ//b9fkuzLyq1plaSjxGdE0EaSZOi261FjBGHWLysgofMSOHlkYKVBzv35w rP1WZvuwS+E5sS978X2KhAmRnNHVKeKbuyrDVJtiwHrKQiYSqXWJmojHRYuVkvRL y59V+WWhsP6W7aNSPIOSmtPDjFRMCC3ePDsRag5OzBxomMZl9DCfdK8gahDPnOmZ 3snQ2VubOG4v3AKWXy8+enKKkuLD5cdMasn2FDMhaSlEQvRc/fe+y5TaA179y2nN UVaLi7S4W5ZyHArt/XZgIFRGQle7+aXCiFAcx8XX4mbFA/sUaqHCM+iCtUiDZak1 orE8ybBWDgg2MJZ8CRjqZ9MeHlb4SOZZ583IhIMQ+zquPuzmlEoqwSrgyrnNGr4L VxmrCKo0zZW4GdE323oF70PvoqtgmJAyQOoVCmCLaPlx1TjubxznmlsYtaWOqf0w bnrZHeD8LwU8qoT0GcTkVSzxJ3eHI94qYAbqXkTDXqdXwqFEi8xBMSwD0/TYCR73 t+6zjmzuEXruDka2gZafwOhgRTRyL+A8hEnbeG03b8juUOJil+0It4THEaYmmQqv PbATc5/2UIhlKynoOCr9D8CfQjeKRRj19SNMeB7gJenlbYhXvD7ScgYRkD+zUFdr v6mDmdKcOLmq61OqftF3xKUvBWlwJJ93u/c4XR8s5t0H08V7AXU= =4C7u -----END PGP SIGNATURE-----
|author||Andy Lutomirski <firstname.lastname@example.org>||Thu Oct 10 10:07:08 2019 -0700|
|committer||Andy Lutomirski <email@example.com>||Thu Oct 10 10:07:08 2019 -0700|
Version 0.1! Signed-off-by: Andy Lutomirski <firstname.lastname@example.org>
Virtme is a set of simple tools to run a virtualized Linux kernel that uses the host Linux distribution or a simple rootfs instead of a whole disk image.
Virtme is tiny, easy to use, and makes testing kernel changes quite simple.
Some day this might be useful as a sort of sandbox. Right now it's not really configurable enough for that.
You'll need a Linux kernel that has these options (built-in or as modules)
CONFIG_VIRTIO CONFIG_VIRTIO_PCI CONFIG_NET_9P CONFIG_NET_9P_VIRTIO CONFIG_9P_FS
For networking support, you also need CONFIG_VIRTIO_NET.
For script support, you need CONFIG_VIRTIO_CONSOLE.
For disk support, you need CONFIG_SCSI_VIRTIO.
That kernel needs to be sane. Your kernel is probably sane, but allmodconfig and allyesconfig generate insane kernels. Sanity includes:
CONFIG_CMDLINE_OVERRIDE=n CONFIG_BINFMT_SCRIPT=y CONFIG_TMPFS=y
You may also have better luck if you set:
CONFIG_EMBEDDED=n CONFIG_EXPERT=n CONFIG_MODULE_SIG_FORCE=n CONFIG_DEVTMPFS=y
An easy, somewhat-reliable way to generate a working config is via the virtme-configkernel. It needs to be run on a kernel source directory, like:
virtme-configkernel --arch=ARCH --defconfig
Your host system will need to satisfy some prerequisites:
busyboxbinary somewhere in your path.
Once you have such a kernel, run one of:
With --installed-kernel or --kdir, modules associated with the kernel will be available in the VM. With --kdir in particular, you will either need to follow the directions that virtme-run prints or specify --mods=auto to make this work. With --kimg, modules are not supported.
You can then do things like
cd /home/username and you will have readonly access to all your files.
Virtme gives you console input and output by default. Type ctrl-a x to exit. Type ctrl-a c to access the QEMU monitor.
For now, the virtme console is a serial console -- virtconsole seems to be unusably buggy. I don't know of any way to keep the tty state in sync between the host and guest, so resizing the host window after starting the guest may confuse guest libraries like readline.
If you want graphical output instead of console output, pass --graphics. Note that this is the opposite of QEMU's default behavior.
By default, virtme will use whatever architecture would be shown by
uname -m. You can override this with
--arch. Note that you may need to do some poorly documented fiddling for now to get non-native architectures working, and you will almost certainly need to set
--root to a root that matches the architecture.
In general, the easiest way to configure a working kernel is to run:
virtme-configkernel --arch=ARCH --defconfig
x86 (both x86_64 and i386) is fully supported, although some odd KVM configurations may cause problems.
ARM is supported using qemu‘s
vexpress-a15 machine. There is no built-in KVM support for ARM right now, although it might work by accident -- I don’t own a real KVM-capable ARM machine to test it on.
If you use any mode other than --kdir, you‘ll need to manually set QEMU’s -dtb option. I‘m not sure why -- I assumed that QEMU would provide its own device tree, but this doesn’t seem to be the case.
Aarch64 works out of the box if you have a new enough version of QEMU.
PPC64 appears to be reasonably functional.
riscv64 works out of the box, but you‘ll neet at least QEMU-4.1.0 to be able to run
vmlinux-style kernels. riscv32 is not supported because there are no existing userspace images for it. Support is provided via QEMU’s
virt machine with OpenSBI for firmware.
Other architectures may or may not work. Adding support is trivial, so ping me if you need another architecture. Unrecognized architectures use a set of maybe-acceptable defaults.
In the near term, the high-priority features are:
Please see DCO.txt