Qemu is an open source emulator. This howto will guide you on how to install Qemu on your FreeBSD and run guest os on it. This installation was done on FreeBSD 6.0 stable.
The Qemu can be install using port.
#make WITH_KQEMU=yes install clean
Notice: if you need qemu’s -smb option (smb-export local dir to guest)
then you also need samba, you can have this port install it by defining
WITH_SAMBA.
===> Vulnerability check disabled, database not found
===> Extracting for qemu-0.7.2s.20051030
=> MD5 Checksum OK for qemu-snapshot-2005-10-30_23.tar.bz2.
=> No SHA256 checksum recorded for qemu-snapshot-2005-10-30_23.tar.bz2.
===> qemu-0.7.2s.20051030 depends on file: /usr/local/bin/perl5.8.6 - found
Notice that I use WITH_KQEMU=yes to enable Qemu accelaration module so that Qemu can run faster. To see what other option that can be use/enable please look in the Makefile in the current folder. After finish installation proceed to install the KQemu port.
#make install clean
===> Vulnerability check disabled, database not found
===> Extracting for kqemu-kmod-0.7.2_1
=> MD5 Checksum OK for kqemu/kqemu-0.7.2.tar.gz.
=> No SHA256 checksum recorded for kqemu/kqemu-0.7.2.tar.gz.
===> Patching for kqemu-kmod-0.7.2_1
===> Applying FreeBSD patches for kqemu-kmod-0.7.2_1
===> Configuring for kqemu-kmod-0.7.2_1
===> Building for kqemu-kmod-0.7.2_1
Warning: Object directory not changed from original /usr/ports/emulators/kqemu-kmod/work/kqemu
@ -> /usr/src/sys
machine -> /usr/src/sys/i386/include
cc -O2 -pipe -funroll-loops -march=pentiumpro -fno-strict-aliasing -D_KERNEL -DKLD_MODULE -nostdinc -I- -I. -I@ -I@/contrib/altq -I@/../include -I/usr/include -finline-limit=8000 -fno-common -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -std=c99 -c kqemu-freebsd.c
End of Qemu installation part. Now we go to configuration part.
I plan to install Windows XP as the guest os as my daily work require me to use some application that cant be run on FreeBSD (and linux
). As my USB cdrom cant be detected I need to find a way on howto install Windows XP on Qemu. I decided to make an ISO for the Windows XP. This process was done on the other computer. After that I copy the ISO into my computer.
To boot up Qemu with the Windows XP ISO use the following command

When it boot setup the Windows as usual. After finish shutdown the windows and start with the following command

This command boot up the windows with networking enable and using localtime standard. Networking can be setup in many ways. In my setup the guest will be using the host networking. You dont need to setup any networking in windows. You can straight away access to the internet if your host is connected to the internet.
To check wether Qemu accelerator run or not type Ctrl+Alt+2 in the Qemu windows. Then type info kqemu in the command prompt. If it show kqemu is enable thats mean your kqemu is running. If not load kqemu module using the following command

Or you can put this line in the rc.conf
To change back to your Windows XP type Ctrl+Alt+1.
One thing I notice that the windows will crash when it was idle for certain minute. Maybe got bug or I should disable the screensaver or the suspend function. Qemu use quite high number of cpu resources.


