xref: /kvmtool/README (revision 51645dd54de52fac9ef6f80cd872a86e38010e07)
192aff0b6SAsias HeNative Linux KVM tool
292aff0b6SAsias He=====================
3002f5604SAndre Przywara
4002f5604SAndre Przywarakvmtool is a lightweight tool for hosting KVM guests. As a pure virtualization
5002f5604SAndre Przywaratool it only supports guests using the same architecture, though it supports
6002f5604SAndre Przywararunning 32-bit guests on those 64-bit architectures that allow this.
7002f5604SAndre Przywara
8002f5604SAndre PrzywaraFrom the original announcement email:
9002f5604SAndre Przywara-------------------------------------------------------
1092aff0b6SAsias HeThe goal of this tool is to provide a clean, from-scratch, lightweight
1192aff0b6SAsias HeKVM host tool implementation that can boot Linux guest images (just a
1292aff0b6SAsias Hehobby, won't be big and professional like QEMU) with no BIOS
1392aff0b6SAsias Hedependencies and with only the minimal amount of legacy device
1492aff0b6SAsias Heemulation.
1592aff0b6SAsias He
1692aff0b6SAsias HeIt's great as a learning tool if you want to get your feet wet in
1792aff0b6SAsias Hevirtualization land: it's only 5 KLOC of clean C code that can already
1892aff0b6SAsias Heboot a guest Linux image.
1992aff0b6SAsias He
2092aff0b6SAsias HeRight now it can boot a Linux image and provide you output via a serial
2192aff0b6SAsias Heconsole, over the host terminal, i.e. you can use it to boot a guest
2292aff0b6SAsias HeLinux image in a terminal or over ssh and log into the guest without
2392aff0b6SAsias Hemuch guest or host side setup work needed.
24002f5604SAndre Przywara--------------------------
2592aff0b6SAsias He
26002f5604SAndre PrzywaraThis is the stand-alone version which does not live inside a Linux
27002f5604SAndre Przywarakernel tree.
28002f5604SAndre Przywara1. To check it out, clone the main git repository:
2992aff0b6SAsias He
30002f5604SAndre Przywara  git clone git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git
3192aff0b6SAsias He
32002f5604SAndre Przywara2. Compile the tool (for more elaborate instructions see INSTALL):
3392aff0b6SAsias He
34002f5604SAndre Przywara  cd kvmtool && make
3592aff0b6SAsias He
3692aff0b6SAsias He3. Download a raw userspace image:
3792aff0b6SAsias He
3892aff0b6SAsias He  wget http://wiki.qemu.org/download/linux-0.2.img.bz2 && bunzip2
3992aff0b6SAsias Helinux-0.2.img.bz2
4092aff0b6SAsias He
41b72cffcbSSasha Levin4. The guest kernel has to be built with the following configuration:
4217ffa372SAsias He
43b72cffcbSSasha Levin - For the default console output:
44b72cffcbSSasha Levin	CONFIG_SERIAL_8250=y
4517ffa372SAsias He	CONFIG_SERIAL_8250_CONSOLE=y
46b72cffcbSSasha Levin
47b72cffcbSSasha Levin - For running 32bit images on 64bit hosts:
48b72cffcbSSasha Levin	CONFIG_IA32_EMULATION=y
49b72cffcbSSasha Levin
50b72cffcbSSasha Levin - Proper FS options according to image FS (e.g. CONFIG_EXT2_FS, CONFIG_EXT4_FS).
51b72cffcbSSasha Levin
52b72cffcbSSasha Levin - For all virtio devices listed below:
53b72cffcbSSasha Levin	CONFIG_VIRTIO=y
54b72cffcbSSasha Levin	CONFIG_VIRTIO_RING=y
55b72cffcbSSasha Levin	CONFIG_VIRTIO_PCI=y
56b72cffcbSSasha Levin
57b72cffcbSSasha Levin - For virtio-blk devices (--disk, -d):
58b72cffcbSSasha Levin	CONFIG_VIRTIO_BLK=y
59b72cffcbSSasha Levin
60b72cffcbSSasha Levin - For virtio-net devices ([--network, -n] virtio):
61b72cffcbSSasha Levin	CONFIG_VIRTIO_NET=y
62b72cffcbSSasha Levin
63b72cffcbSSasha Levin - For virtio-9p devices (--virtio-9p):
64b72cffcbSSasha Levin	CONFIG_NET_9P=y
65b72cffcbSSasha Levin	CONFIG_NET_9P_VIRTIO=y
66b72cffcbSSasha Levin	CONFIG_9P_FS=y
67b72cffcbSSasha Levin
68b72cffcbSSasha Levin - For virtio-balloon device (--balloon):
69b72cffcbSSasha Levin	CONFIG_VIRTIO_BALLOON=y
70b72cffcbSSasha Levin
71b72cffcbSSasha Levin - For virtio-console device (--console virtio):
72b72cffcbSSasha Levin	CONFIG_VIRTIO_CONSOLE=y
73b72cffcbSSasha Levin
74b72cffcbSSasha Levin - For virtio-rng device (--rng):
7517ffa372SAsias He	CONFIG_HW_RANDOM_VIRTIO=y
7617ffa372SAsias He
77e5f41ac4SAsias He - For vesa device (--sdl or --vnc):
78e5f41ac4SAsias He	CONFIG_FB_VESA=y
79e5f41ac4SAsias He
8092aff0b6SAsias He
8192aff0b6SAsias He5. And finally, launch the hypervisor:
8292aff0b6SAsias He
839cedd64dSWanlong Gao  ./lkvm run --disk linux-0.2.img \
8417ffa372SAsias He	    --kernel ../../arch/x86/boot/bzImage \
8517ffa372SAsias Heor
8692aff0b6SAsias He
879cedd64dSWanlong Gao  sudo ./lkvm run --disk linux-0.2.img \
8817ffa372SAsias He		 --kernel ../../arch/x86/boot/bzImage \
8917ffa372SAsias He		 --network virtio
9017ffa372SAsias He
9117ffa372SAsias HeThe tool has been written by Pekka Enberg, Cyrill Gorcunov, Asias He,
9217ffa372SAsias HeSasha Levin and Prasad Joshi. Special thanks to Avi Kivity for his help
9317ffa372SAsias Heon KVM internals and Ingo Molnar for all-around support and encouragement!
9492aff0b6SAsias He
9592aff0b6SAsias HeSee the following thread for original discussion for motivation of this
9692aff0b6SAsias Heproject:
9792aff0b6SAsias He
9892aff0b6SAsias Hehttp://thread.gmane.org/gmane.linux.kernel/962051/focus=962620
99efcf8626SJosh Triplett
1003695adebSSven DowideitAnother detailed example can be found in the lwn.net article:
1013695adebSSven Dowideit
1023695adebSSven Dowideithttp://lwn.net/Articles/658511/
103efcf8626SJosh Triplett
104efcf8626SJosh TriplettContributing
105efcf8626SJosh Triplett------------
106efcf8626SJosh Triplett
107cfae4d64SAndrew JonesPlease send patches for kvmtool to kvm@vger.kernel.org, in the usual git
108cfae4d64SAndrew Jonespatch format, including "kvmtool" in the mail subject. "kvmtool" can be
109cfae4d64SAndrew Jonesadded automatically by issuing the command
110cfae4d64SAndrew Jones
111cfae4d64SAndrew Jones git config format.subjectprefix "PATCH kvmtool"
112cfae4d64SAndrew Jones
113cfae4d64SAndrew Jonesin the git repository.
114534cac24SWill Deacon
115534cac24SWill DeaconMaintainers
116534cac24SWill Deacon-----------
117534cac24SWill Deacon
118534cac24SWill Deaconkvmtool is maintained by Will Deacon <will@kernel.org> and Julien Thierry
119*51645dd5SJulien Thierry<julien.thierry.kdev@gmail.com>.
120