QEMU on FreeBSD
Using QEMU processor emulator on FreeBSD
Installing QEMU
Is straightforward, although to take advantage of virtualisation features it is recommended to build the kqemu accellerator module.
cd /usr/ports/emulators/qemu
make WITH_KQEMU=1 install clean
Loading up the kqemu kernel module
kldload kqemu
You may want to do this automatically at boot time by adding the following line to your /boot/loader.conf
kqemu_load="YES"
If during make you chose to use DMA for IDE, you will also need to load the aio kernel module
kldload aio
Using QEMU for the first time
QEMU is really easy to use. We will install Centos Linux in this example.
Disk image
This will be the disk image that will be used as the hard disk for the virtual installation.
qemu-img centos.img 8G
This will create an 8GB disk image for your installation called centos.img This is straightforward, but you can use the -h option to see other options.
Making sure SDL is working
QEMU uses SDL for video output, you may need to specific the video option for SDL in your shell environment:
SDL_VIDEODRIVER=x11
Booting QEMU and installation
qemu -cdrom CentOS-4.2-i386-bin1of4.iso -hda centos.img
-boot d
This will boot from cdrom loaded with CentOS disk 1 iso, and use our recently created disk image as the first IDE hard disk.
If all goes well you will get the CentOS boot screen

QEMU console
The QEMU console is very useful for a few basic tasks. It is accessed by pressing ctrl-alt-2.
- Changing Disks
When you are installing certain distributions like Centos you will need to change disks. When the time comes, you switch to the QEMU console and type
eject cdrom
change cdrom CentOS-4.2-i386-bin2of4.iso
- Sending key combination commands
Another common use is when you want to switch to the console from graphical display in your virtual session. For example to access VTY1 you would switch to the console and type:
sendkey ctrl-alt-f1
You can switch back to the virtual session by pressing ctrl-alt-1
Sources:
- QEMU Homepage
- "Changing Disks" - http://www.h7.dion.ne.jp/~qemu-win/HowToFloppyCdrom-en.html



