README 3.44 KB
Newer Older
Asias He's avatar
Asias He committed
1 2
Native Linux KVM tool
=====================
3 4 5 6 7 8 9

kvmtool is a lightweight tool for hosting KVM guests. As a pure virtualization
tool it only supports guests using the same architecture, though it supports
running 32-bit guests on those 64-bit architectures that allow this.

From the original announcement email:
-------------------------------------------------------
Asias He's avatar
Asias He committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23
The goal of this tool is to provide a clean, from-scratch, lightweight
KVM host tool implementation that can boot Linux guest images (just a
hobby, won't be big and professional like QEMU) with no BIOS
dependencies and with only the minimal amount of legacy device
emulation.

It's great as a learning tool if you want to get your feet wet in
virtualization land: it's only 5 KLOC of clean C code that can already
boot a guest Linux image.

Right now it can boot a Linux image and provide you output via a serial
console, over the host terminal, i.e. you can use it to boot a guest
Linux image in a terminal or over ssh and log into the guest without
much guest or host side setup work needed.
24
--------------------------
Asias He's avatar
Asias He committed
25

26 27 28
This is the stand-alone version which does not live inside a Linux
kernel tree.
1. To check it out, clone the main git repository:
Asias He's avatar
Asias He committed
29

30
  git clone git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git
Asias He's avatar
Asias He committed
31

32
2. Compile the tool (for more elaborate instructions see INSTALL):
Asias He's avatar
Asias He committed
33

34
  cd kvmtool && make
Asias He's avatar
Asias He committed
35 36 37 38 39 40

3. Download a raw userspace image:

  wget http://wiki.qemu.org/download/linux-0.2.img.bz2 && bunzip2
linux-0.2.img.bz2

Sasha Levin's avatar
Sasha Levin committed
41
4. The guest kernel has to be built with the following configuration:
Asias He's avatar
Asias He committed
42

Sasha Levin's avatar
Sasha Levin committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
 - For the default console output:
	CONFIG_SERIAL_8250=y
	CONFIG_SERIAL_8250_CONSOLE=y

 - For running 32bit images on 64bit hosts:
	CONFIG_IA32_EMULATION=y

 - Proper FS options according to image FS (e.g. CONFIG_EXT2_FS, CONFIG_EXT4_FS).

 - For all virtio devices listed below:
	CONFIG_VIRTIO=y
	CONFIG_VIRTIO_RING=y
	CONFIG_VIRTIO_PCI=y

 - For virtio-blk devices (--disk, -d):
	CONFIG_VIRTIO_BLK=y

 - For virtio-net devices ([--network, -n] virtio):
	CONFIG_VIRTIO_NET=y

 - For virtio-9p devices (--virtio-9p):
	CONFIG_NET_9P=y
	CONFIG_NET_9P_VIRTIO=y
	CONFIG_9P_FS=y

 - For virtio-balloon device (--balloon):
	CONFIG_VIRTIO_BALLOON=y

 - For virtio-console device (--console virtio):
	CONFIG_VIRTIO_CONSOLE=y

 - For virtio-rng device (--rng):
	CONFIG_HW_RANDOM_VIRTIO=y
Asias He's avatar
Asias He committed
76

77 78 79
 - For vesa device (--sdl or --vnc):
	CONFIG_FB_VESA=y

Asias He's avatar
Asias He committed
80 81 82

5. And finally, launch the hypervisor:

83
  ./lkvm run --disk linux-0.2.img \
Asias He's avatar
Asias He committed
84 85 86
	    --kernel ../../arch/x86/boot/bzImage \
or

87
  sudo ./lkvm run --disk linux-0.2.img \
Asias He's avatar
Asias He committed
88 89
		 --kernel ../../arch/x86/boot/bzImage \
		 --network virtio
Asias He's avatar
Asias He committed
90

Asias He's avatar
Asias He committed
91 92 93
The tool has been written by Pekka Enberg, Cyrill Gorcunov, Asias He,
Sasha Levin and Prasad Joshi. Special thanks to Avi Kivity for his help
on KVM internals and Ingo Molnar for all-around support and encouragement!
Asias He's avatar
Asias He committed
94 95 96 97 98

See the following thread for original discussion for motivation of this
project:

http://thread.gmane.org/gmane.linux.kernel/962051/focus=962620
99

100 101 102
Another detailed example can be found in the lwn.net article:

http://lwn.net/Articles/658511/
103 104 105 106

Contributing
------------

107 108 109 110 111 112 113
Please send patches for kvmtool to kvm@vger.kernel.org, in the usual git
patch format, including "kvmtool" in the mail subject. "kvmtool" can be
added automatically by issuing the command

 git config format.subjectprefix "PATCH kvmtool"

in the git repository.
Will Deacon's avatar
Will Deacon committed
114 115 116 117 118

Maintainers
-----------

kvmtool is maintained by Will Deacon <will@kernel.org> and Julien Thierry
119
<julien.thierry.kdev@gmail.com>.