This is an old revision of the document!


Qemu is a very fast generic and open source processor emulator by Fabrice Bellard. It runs Windows 2000, XP and GNU/Linux (RedHat, Debian) etc. In this page we describe various know-hows for FreeBSD 6.0. How to install Though Qemu is quite fast, we need KQEmu accelalator otherwise it is much slower. Next, IDE Bus-master DMA support is also important. Comple QEMU with

# cd /usr/ports/emulator/qemu # make -DWITH_KQEMU # kldloaded aio

kldload aio is mandatory! Since KQemu is installed as kenrle module, please add following line to /boot/loader.conf so that kernel module will be loaded at boot time. Also, if you need a menu:

# make || make configure

.

kqemu_load=“YES”

Note: it is impossible to continue to use existing Windows 2000/XP disk images, since driver has been changed by activating IDE Bus-master DMA support. Networking on FreeBSD 7 (contributed by Marten Vijn) Default, network is configured inside of the emulator; not visible from outside. if you use fxp0, then

# ifconfig tap create # ifconfig bridge create # ifconfig bridge0 addm tap0 addm fxp0 up

. Also, /etc/qemu-ifup script is needed. Networking Default, network is configured inside of the emulator; not visible from outside. This is not absolutely confotable! There are pros and cons: you must be the root and your qemu virtual machine is visible from outside. Assume you know your network interface name. In my case this is fxp0. you can check this by:

% dmesg | grep Ethernet

First, as root,

# kldload bridge.ko # sysctl net.link.ether.bridge_cfg=fxp0,tap0 net.link.ether.bridge_cfg: → fxp0,tap0 # sysctl net.link.ether.bridge.enable=1 net.link.ether.bridge.enable: 0 → 1

create /etc/qemu-ifup script as

#!/bin/sh ifconfig ${1} 0.0.0.0

and make this script runnable.

# chmod 755 /etc/qemu-ifup

To do this at every boot time, write /etc/sysctl.conf

net.link.ether.bridge_cfg=fxp0,tap0 net.link.ether.bridge.enable=1

and in /boot/loader.conf

bridge_load=“YES”

Invoke qemu by:

# qemu -net nic -net tap

this was originally taken from freebsd vde helpp Qemu as VNC server Display writing is very slow in QEMU, so run qemu as vnc server is very useful.

% qemu -hda /work/qemu/win2000ja/win2000.img -localtime -m 384 -vnc :1 -usbdevice tablet

Run vncviewer like (you can install via ports/net/tightvnc)

% vncviewer :1

You should wait for while until Windows starts up. Full Screen mode (slow) QEmu uses SDL to output the screen. Modern video card supports VESA 2.0, so you can use SDL with VESA 2.0. While using SDL you need additional settings. First, reconfigure kernel with this configuration.

include GENERIC

ident MAHO

device atapicam options VESA

save as /usr/src/sys/i386/conf/MAHO or something like that. Then,

# cd /sys/i386/compile/MAHO # made cleandepend ; make depend ; make ; make install

you need additional setting:

# setenv SDL_VIDEODRIVER vgl

and you can run with full-screen in the console. Again, you must be the root. As far as I tested,

# kldload vesa

DOESN'T WORK (FOR ME). Unfortunately this is very slow, slower than X11 mode… Summary (My setting and command line) As summary, I present my setting for qemu 0.8.0.

qemu -localtime -hda /work/qemu/win2000ja/win2000.img -m 256 -net nic -net tap

/boot/loader.conf

kqemu_load=“YES” bridge_load=“YES” snd_driver_load=“YES” snd_pcm_load=“YES”

/etc/sysctl.conf

net.link.ether.bridge_cfg=fxp0,tap0 net.link.ether.bridge.enable=1

/etc/qemu-ifup (chmod 755 /etc/qemu-ifup)

#!/bin/sh ifconfig ${1} 0.0.0.0

Re configure kernel with this configuration file

include GENERIC

ident MAHO

device atapicam options VESA

and additional enviromnent variable:

# setenv SDL_VIDEODRIVER vgl

I don't want to be the root

  • Network bridge
  • Full screen mode

Links

  • Qemu
  • QEMU for FreeBSD

Contributors

  • Vlad GURDIGA

Nakata Maho

  • qemu.1213229961.txt.gz
  • Last modified: 2008/06/12 00:19
  • by MahoNakata