Personal tools
     DOCUMENTATION

rBuilder Online:Test Images with QEMU

From rPath Wiki

Jump to: navigation, search

Contents

QEMU is free software that provides a hypervisor for full PC virtualization. All the hardware of a real system is emulated in the software. It is useful for creating operating environments which which to test when physical hardware is scarce. QEMU runs about 30% slower than the host operating system, but this is typically fast enough to get real work done on most modern hardware.

QEMU has a kernel module that allows x86 instructions to be run at near native speeds when hosted on x86. This module is not open-source and rPath is not allowed to redistribute it. However, virtualized.rpath.org contains a recipe that will allow you to download it and compile it using cvc emerge.

What you will need

  • QEMU software
  • KQEMU (optional)
  • Install ISO(s)
  • Lots of free disk space (1-7 GB depending on the system)

Install QEMU

Use the following Conary command to install QEMU:

# conary update qemu=virtualized.rpath.org@rpl:devel

Install Optional KQEMU

If you wish, you can install the kernel module for QEMU (kqemu) to improve performance with Conary's emerge command:

# conary emerge kqemu=virtualized.rpath.org@rpl:devel

Note: If you are running an SMP kernel, you will need to use the kqemu.smp flag to build kqemu:

# conary emerge kqemu=virtualized.rpath.org@rpl:devel[kqemu.smp]

Run a Raw Hard Disk Image from rBuilder

qemu -hda myrawhd.img -boot c

Run a Live Image

Running a Live CD/DVD image requires no HDD image creation. Instead, point QEMU to the ISO for the image:

qemu -cdrom livecd.iso -boot d

Press Ctrl-Alt-1 to get back to the running system. To switch to different TTY consoles, type sendkey ctrl-alt-F2 (using the desired console) in the QEMU console.

HDD Image Creation

qemu-img create foo.img 5G

The string foo.img is the name of your /dev/hda virtual disk, and 5G is the desired size. QEMU can accept Gigabytes (G), Megabytes (M), or Kilobytes (default unless an M or G is present) as the size argument. This creates a sparse file of the size specified. The image will only use as much space as is needed by the installed system, so the value can be larger than the free space on your physical disk, but that scenario is not recommended. Note that the size must be a whole number.

ISO Installation

qemu -hda foo.img -cdrom installation1.iso -boot d

To switch between CD-ROMs of a multi-CD install, press Ctl-Alt-2 within the QEMU emulator to switch to the QEMU console. Then, type change cdrom <isoN>. Use info block to verify what device file is currently loaded.

Run the installed system

qemu -hda foo.img

Press Ctrl-Alt-1 to get back to the running system. To switch to different TTY consoles, type sendkey ctrl-alt-F2 (using the desired console) in the QEMU console.