3 The goal of this tool is to provide a clean, from-scratch, lightweight
4 KVM host tool implementation that can boot Linux guest images (just a
5 hobby, won't be big and professional like QEMU) with no BIOS
6 dependencies and with only the minimal amount of legacy device
9 It's great as a learning tool if you want to get your feet wet in
10 virtualization land: it's only 5 KLOC of clean C code that can already
11 boot a guest Linux image.
13 Right now it can boot a Linux image and provide you output via a serial
14 console, over the host terminal, i.e. you can use it to boot a guest
15 Linux image in a terminal or over ssh and log into the guest without
16 much guest or host side setup work needed.
18 1. To try out the tool, clone the git repository:
20 git clone git://github.com/penberg/linux-kvm.git
22 or alternatively, if you already have a kernel source tree:
24 git remote add kvm-tool git://github.com/penberg/linux-kvm.git
26 git checkout -b kvm-tool/master kvm-tool
32 3. Download a raw userspace image:
34 wget http://wiki.qemu.org/download/linux-0.2.img.bz2 && bunzip2
37 4. The guest kernel has to be built with the following configuration:
39 - For the default console output:
41 CONFIG_SERIAL_8250_CONSOLE=y
43 - For running 32bit images on 64bit hosts:
44 CONFIG_IA32_EMULATION=y
46 - Proper FS options according to image FS (e.g. CONFIG_EXT2_FS, CONFIG_EXT4_FS).
48 - For all virtio devices listed below:
53 - For virtio-blk devices (--disk, -d):
56 - For virtio-net devices ([--network, -n] virtio):
59 - For virtio-9p devices (--virtio-9p):
61 CONFIG_NET_9P_VIRTIO=y
64 - For virtio-balloon device (--balloon):
65 CONFIG_VIRTIO_BALLOON=y
67 - For virtio-console device (--console virtio):
68 CONFIG_VIRTIO_CONSOLE=y
70 - For virtio-rng device (--rng):
71 CONFIG_HW_RANDOM_VIRTIO=y
74 5. And finally, launch the hypervisor:
76 ./kvm run --disk linux-0.2.img \
77 --kernel ../../arch/x86/boot/bzImage \
80 sudo ./kvm run --disk linux-0.2.img \
81 --kernel ../../arch/x86/boot/bzImage \
84 The tool has been written by Pekka Enberg, Cyrill Gorcunov, Asias He,
85 Sasha Levin and Prasad Joshi. Special thanks to Avi Kivity for his help
86 on KVM internals and Ingo Molnar for all-around support and encouragement!
88 See the following thread for original discussion for motivation of this
91 http://thread.gmane.org/gmane.linux.kernel/962051/focus=962620
95 For deb based systems:
97 sudo apt-get install build-essential
99 sudo apt-get install build-essential libc6-dev-i386
101 For rpm based systems:
103 yum install glibc-devel
105 yum install glibc-devel glibc-devel.i386
107 On 64-bit Arch Linux make sure the multilib repository is enabled in your
108 /etc/pacman.conf and run
109 pacman -Sy lib32-glibc