Topic: Qemu

Running QEMU

What is QEMU: QEMU is a FAST! processor emulator using dynamic translation to achieve good emulation speed.
It's the best emulator I've ever seen. That's why I took some time to rewrite an howto about it.

Like the old howto I chose to run DragonFlyBSD as guest OS on a NetBSD-current (3.99.3) system as host OS.

The qemu directory I use is ~/qemu.

1. Install the qemu package
# cd /usr/pkgsrc/emulators/qemu/
# make install clean

Today's pkgsrc version is 0.6.1 (nb4)

2. Download DragonFlyBSD (Optional)
Today's version is 1.2
I got in from a french mirror. The file is called dfly-1.2.0_REL.iso.gz.
The file has to be gunzipped before use.
# cd ~/qemu/
# mkdir imgs
# cd imgs

download DragonFlyBSD
# gunzip dfly-1.2.0_REL.iso.gz

3. Create a disk image (still in ~/qemu/imgs/)
# qemu-img create -f qcow dfly.qcow 4G
This creates a 4Gb qcow format disk image file called dfly.qcow
Why qcow over raw or ... ? The qcow format compresses the image so that the empty space doesn't add up to the size of the file.
So the image doesn't take 4Gb of disk space but only the needed space!

4. Run qemu !
# qemu -m 256 -cdrom dfly-1.2.0_REL.iso -hda dfly.qcow -boot d
This means I allocate 256Mb of memory (RAM), cdrom is will be the iso image and the hard disk the image file we created the step before and boot on D ( = cdrom).
Beware! On NetBSD systems you can get a "Could not allocate physical memory" it is due to ulimit that actually limits datasize (run `limit` to see this). So you have two choices. Make it unlimited with `ulimit -d unlimited` or replace 'unlimited' with a size!

It's as easy as this.
I wont put any screenshot of the install process since it would take too much time.
But you can find the one I made for the old howto here

5. Getting a network interface up and running
This is the only tricky part of the howto!
Basically what you have to do is instruct qemu about how he should take care of the network layer.
This is to come a bit later cause I'm at work at the moment smile

6. Transfering data from the host os to the guest os and the other way round
This wasn't covered in my last howto. So a good has come from the bad!
Qemu has samba support. So you can specify a share of the local samba installation with the -smb argument.
I won't explain how to install samba (though it's as simple as going into the correct pkgsrc directory and run make).
All you need to do is add a share to your smb.conf. Let's call it "qemu":

[qemu]
   comment = QEMU share
   path = /home/dynek/qemu/share
   read only = no
   public = yes

You now just have to add -smb qemu when running qemu!
For more info read the manual of qemu because there's a tricky step with lmhosts. Have to try this before I can tell how it works.

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue

Re: Qemu

big_smile Well done dude!

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus

3

Re: Qemu

YAY! big_smile

Re: Qemu

I use qemu here at the college for the security classes so the students have have win2k server and fedoraC3 at the same time, saved them from dualbooting and vmware smile

For example, Linux had at least two completely independent USB stacks before Linus Torvalds rejected them both and wrote a third one from scratch, after he found both existent Linux  stacks unsatisfactory.  (When pressed for an explanation as to why he selected the API he did, Torvalds stated: "because I wanted to."

Re: Qemu

cool!

Re: Qemu

andre wrote:

YAY! big_smile

I promise, given the time, to install DFLY under QEMU on my NetBSD workstation and try it

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus

Re: Qemu

Yes, Andre is going to make all of us do that.  smile

I might try the PCBSD as well--right now, I threw it over an unused Debian install--it's installing as I write.  I'm big on advocacy (a disease of living in NY?) and I keep having this thought of working at a place that has user friendly *nix for the users.

<@andre> i would be so much more efficient if i wasn't so stupid

8

Re: Qemu

scottro wrote:

Yes, Andre is going to make all of us do that.  :)

yeah, and that's just the first half of the world domination plans... >:)

Re: Qemu

Well, I found this HOWTO helpful as I'm installing plan9 via qemu on my DFly workstation. 

<cheerleader type="peppy">Yay dynek!</cheerleader>

May Science bless you.

Re: Qemu

wow, I don't even remember posting in this thread.  maybe I'll try qemu soon.

Re: Qemu

QEMU rules! its like virtual pc for the little people!  Its just a shame the mouse support isnt 100% for NeXTSTEP...

Re: Qemu

thanks for this thread, dynek, I'm installing Fedora right now (I know, I know tongue).

Re: Qemu

so I got Fedora running.  qemu is pretty cool.  for the sake of testing OSs, I'm not sure how much I like it though.  it doesn't really give you a good feel for the OS, because after using it for about 5 minutes, the speed becomes pretty frustrating.

Re: Qemu

that's always the problem with {sim,em}ulators

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue

Re: Qemu

there is a qemu patch(for linux though sad) that let's you run up to speeds of 1:2 for x86 on x86 emulation. Maybe you can ask the author to port it to  whatever OS you are on.

Re: Qemu

yeah, I read about it on the qemu website.  nothing in pkgsrc or pkgsrc-wip though hmm.  maybe I'll e-mail 'im.

17

Re: Qemu

qemu is nice, I've used it for various flavors of linux and unix...I had a native install of Plan 9 so didn't need qemu for that but yes it's just to get to know the os a bit and play with it you can't do any productive work in it really.

Re: Qemu

I've installed Debian using qemu 0.8. No need to set up the network, it's done automaticaly :]

Delf
Windows & FreeBSD addited

Re: Qemu

Hello everyone, long time smile

I'm need to install DOS on Linux and BSD. I hope this will work for my ASM coding too!

Re: Qemu

oh btw...

I think there's a soc or something else about this qemu speed improver...

<wintellect> NetBSD users are smart enough to accept that there's no 3D support tongue

Re: Qemu

rand, what's up!? stick around.

Re: Qemu

DOS? oh please that 16bit disaster runs in so many programs.. They really should make asm classes in running MSDOS...

Anyways if you need pointers let us know! Some of us (well probably 3) are qemu addicts!  Im sure we can find something for ya!

Re: Qemu

ubuntu linux hints.....

FWIW Im running under XP.  The first thing is that you really want to run on a platform that supports kqemu.  Otherwise it is VERY VERY slow.  Next be sure to add the flag -noacpi  on the qemu command line.

Then finally before you boot make sure you add the following to the linux command line:

idle=halt

Its approaching usable with those flags.

Re: Qemu

How to get QEMU with tap networking - http://forums.bsdnexus.com/viewtopic.php?id=1563 .

I think this link might help those who come here through Google. smile

Keep Smiling

Re: Qemu

Note, however, that that how to is very specific to FreeBSD-7.x   There are various differences in other O/S's, and indeed, even in FreeBSD 6.x

<@andre> i would be so much more efficient if i wasn't so stupid