Oleg Nesterov 30867c5501 kvmtool/run: do not overwrite /virt/init
To me kvm_setup_guest_init() behaviour looks "obviously wrong" and
unfriendly because it always overwrites /virt/init.

kvm_setup_guest_init() is also called when we are going to use this
tree as a rootfs, and without another patch ("kvmtool/run: append
cfg.kernel_cmdline at the end of real_cmdline") the user can't use
"lkvm run -p init=my_init_path". This simply means that you can not
use a customized init unless you patch kvmtool.

Change extract_file() to do nothing if the file already exists. This
should not affect do_setup() which calls kvm_setup_guest_init() only
if make_dir(guestfs_name) creates the new/empty dir.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-10-27 17:06:49 +00:00
2015-07-20 18:25:48 +01:00
2015-06-19 11:15:35 +01:00
2015-10-27 17:03:37 +00:00
2015-06-01 16:39:49 +01:00
2015-06-01 16:40:11 +01:00
2015-07-08 17:39:32 +01:00
2015-07-20 18:25:48 +01:00
2015-07-20 18:25:48 +01:00
2015-10-27 17:03:37 +00:00
2015-06-01 16:39:55 +01:00
2015-10-09 10:00:59 +01:00

Native Linux KVM tool
=====================

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:
-------------------------------------------------------
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.
--------------------------

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:

  git clone git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git

2. Compile the tool (for more elaborate instructions see INSTALL):

  cd kvmtool && make

3. Download a raw userspace image:

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

4. The guest kernel has to be built with the following configuration:

 - 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

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


5. And finally, launch the hypervisor:

  ./lkvm run --disk linux-0.2.img \
	    --kernel ../../arch/x86/boot/bzImage \
or

  sudo ./lkvm run --disk linux-0.2.img \
		 --kernel ../../arch/x86/boot/bzImage \
		 --network virtio

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!

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

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

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

http://lwn.net/Articles/658511/

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

Please send patches for kvmtool to kvm@vger.kernel.org , in the usual git patch
format. Include "kvmtool" in the mail subject.
S
Description
No description provided
Readme 2.1 MiB
Languages
C 96.6%
Makefile 2.6%
Assembly 0.5%
Shell 0.3%