[MINIX LOGO]

Minix on Qemu Step-by-step

modified: 05 Jul 2004


Javen Thyme, 19 Jun 2004

First download the Bochs image for Minix 2.0.4 at http://minix1.bio.umass.edu/pub/contrib/mx204bx01.zip.

Next download qemu. It is available at http://fabrice.bellard.free.fr/qemu/ or http://www.qemu.com (they point to the same site). Follow the instructions to download the CVS. Be sure to use "./configure --target-list=i386-softmmu" if all you want qemu for is to run Minix.

You can now run qemu without networking. Do this via "qemu -m 16 -hda minix204.img -hdachs 200,16,63" (the -m parameter specifies how much RAM qemu should provide to Minix).

The final step is to set up networking. There are 3 options. The easiest is to use user-mode emulated networking. This allows you to run qemu rootless but still surf the web in Minix. Just type this: "qemu -m 16 -hda minix204.img -hdachs 200,16,63 -user-net"

The next way (and the method that I use) is to install VDE. I use version 1.4.1 of VDE but that is rather old. Go to vde.sourceforge.net and download VDE (1.4.1 or newer) and extract it. Chdir into vde-1.4.1 (or whereever it extracted to) and type make. Once you've made vde_switch then chdir into qemu (yes there is a subdir called vde-1.4.1/qemu) and type make again. Once that is done you will want to rename vdeq to vdeqemu. Now load up the VDE daemon as such: "vde_switch -tap tap0 -daemon;ifconfig tap0 192.168.1.254;chmod 777 /tmp/vde.ctl", you may want to put this into a startup script. (vde_switch has to be run as root btw). Now you can start qemu with this command line: "vdeqemu -m 16 -hda minix204.img -hdachs 200,16,63" (this does not have to be started as root).

The third method is to use tuntap. For this you need to make a script called /etc/qemu-ifup and run qemu as root (or make /dev/net/tun readable&writeable by the user who will run qemu). [TODO: must write sample qemu-ifup script.]

Now that networking is set up you need to set up qemu to use it. Load up qemu and in the Minix boot monitor press ESC. Type the following at the monitor prompt:

DPETH0=300:9
net_on()
{servers=inet;DPETH0=300:9;image=/minix/2.0.4net}
save

Once that's done you can now type "menu" at the boot prompt. At this point you should not boot Minix Net yet, so press '=' to go into Minix. Now you will need to set up /etc/rc.net [TODO: figure out how I set up Minix's /etc/rc.net ... gateway was 192.168.1.254 and minix's static IP was 192.168.1.4 - no DHCP]

Now you can reboot Minix and press 'n' at the monitor screen. Minix will boot into networking mode and if all goes well you should be able to ping the host OS and surf the web. (Unless you have a firewall. You will need to set up the firewall first before Minix can go out on the net in that case. [TODO: section on setting up firewall])

Additional Notes

Hardware and versions:

The platform used for these experiments was Linux kernel 2.4.26 on a Redhat 7.3 (upgraded from Redhat 6.0). It's not a Redhat distro anymore, I just last upgraded to 7.3 before I stopped using rpms and starting compiling from source. Now it's not really any kind of distro anymore (I'd call it Linux-From-Scratch but its not exactly from Scratch).

I used Qemu CVS dated June 16 with some minor patches. However I also used qemu 0.5.5 (you lose -localtime and a few other things).

Qemu for other platforms:

Qemu works on other *nix systems (at least on FreeBSD from what I've heard, but probably many more as well). There is a separate Windows port. I don't know about the Mac, but I would assume qemu could run on it considering that qemu can emulate a PPC (there is talk of emulating a full Mac and running Mac OS X on an Intel CPU -- it is sad in a way, as Bellard (inventor of qemu) has said that he is no longer interested in using qemu to run Linux executables built for one arch on another, preferring total system emulation instead).

Timekeeping:

Timekeeping with Minix on qemu works somewhat well. First off, I needed to use qemu's -localtime option, otherwise the time would always be several hours off. This is because qemu will return the time in UTC instead of in the local timezone. Futhermore qemu doesn't provide a way to write to the CMOS so it's not possible to simply set the correct time as such updates are ignored. With the -localtime option, qemu returns the current time in the local time zone and all is well. -localtime is only supported in 0.5.6 so earlier versions do not have it and will return a time that is several hours off. (Since 0.5.6 is not out yet this means you must get qemu from CVS to get this option.) Even with -localtime, the clock seems to be several minutes off. The amount of time it lags behind appears to be porportional to the amount of time that qemu has been running. Running qemu for about 3 hours leaves the clock about 6 minutes off.

Qemu doesn't provide a fully emulated CMOS to the guest system. The main thing is you can't write to the emulated CMOS (let alone the real one), this is why you can't set the time in qemu. Not a real issue since after Minix sets the time qemu is suppose to refresh the CMOS by syncing with the actual time. (I haven't tried this on Minix but it works for Windows 98 on top of qemu).

Benchmarks:

Dhrystone(1.1) time for 46553 passes = 14.98 This machine benchmarks at 3106 dhrystones/second.

The real hardware is a 200mhz Pentium MMX with 128MB or RAM running Linux kernel 2.4.26

Qemu appears to be slower than the 33mhz 386 listed on the Dhrystone benchmarks for Minix page.


[HOME] [HINTS/FAQ] [MINIX DOWNLOADS] [CONTRIB SOFTWARE]
[NET SOFTWARE] [MINIX-VMD] [TEXTBOOK] [LINKS]

All material on this site not otherwise attributed is copyright ©1994-2004 Albert S. Woodhull
Click here for information on copying and other use.
Mail comments on this page to: Al Woodhull <awoodhull@hampshire.edu>
Viewable With Any Browser    [Valid XHTML 1.0!]