DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 5th May 2008
vermaden's Avatar
vermaden vermaden is offline
Administrator
 
Join Date: Apr 2008
Location: pl_PL.lodz
Posts: 1,052
Thanked 118 Times in 93 Posts
Default HOWTO: QEMU on FreeBSD

I wrote short qemu howto install/usage on FreeBSD as host os, and in this example with Win2000 as guest os.

changelog:
1. removed useless /etc/qemu-ifup script [it was used in older versions of qemu with tap/bridge interfaces]
2. added info about sound emumation inside qemu OS.
3. removed HACKS_CIRRUS from options [thx to scottro sugestion], reason here: http://forums.bsdnexus.com/viewtopic...d=14036#p14036
4. sometimes OS installation requires unload of kqemu. short: install without kqemu and the use with kqemu
Install qemu with options showed below:
Code:
# cd /usr/ports/emulators/qemu && make install clean
Code:
Options for qemu:
 [X] KQEMU          Build with (alpha!) accelerator module
 [ ] HACKS_CIRRUS   Large display speedup (buggy!)
 [ ] RTL8139_TIMER  allow use of re(4) nic with FreeBSD guests
 [ ] SAMBA          samba dependency (for -smb)
 [X] SDL            SDL/X dependency (graphical output)
 [X] CDROM_DMA      IDE CDROM DMA
install and configure sudo:
Code:
# cd /usr/ports/security/sudo && make install clean
sudo config:
Code:
# cat > /usr/local/etc/sudoers << EOF
root            ALL=(ALL) ALL
username        ALL=(ALL) NOPASSWD: ALL
EOF
username is YOU.

load needed modules:
Code:
# sudo kldload aio
# sudo kldload kqemu
create Windows2000 install CD image, use cat or dd:
Code:
% cat /dev/acd0 > ~/qemu/win2k.iso
% dd bs=2048 if=/dev/acd0 of=~/qemu/win2k.iso
create qemu image for new OS:
Code:
% qemu-img create -f qcow2 ~/qemu/win2000.img 4G
install new os, Windows2000 in our example:
Code:
% qemu -boot d -hda ~/qemu/win2000.img -m 128 -cdrom ~/qemu/win2k.iso -win2k-hack -localtime
if You have any problems while installing the OS then unload kqemu module and install again, then after install, load the kqemu module again:
Code:
% sudo kldunload kqemu
% qemu -boot d -hda ~/qemu/win2000.img -m 128 -cdrom ~/qemu/win2k.iso -win2k-hack -localtime
% sudo kldload kqemu
typical usage of OS under qemu:
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime
typical usage of OS under qemu in snapshot mode [to commit made changes hit left_CTRL+left_ALT+2 and type commit]:
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -snapshot
1. to switch focus between qemu mouse focus and X11 mouse focus use: left_CTRL+left_ALT
2. to ensure that You use kqemu kernel module in user mode hit left_CTRL+left_ALT+2 and type info kqemu, if everything is ok You will see:
Code:
kqemu support: enabled for user code
if not You will see:
Code:
kqemu support: disabled
if disabled it will work, but terribly slow, You will be running at Pentium 75 speed at host with CPU AthlonXP 1.66GHz.
3. to switch between qemu console and qemu os emualtion use left_CTRL+left_ALT+2 to go to console and left_CTRL+left_ALT+1 to back to emulation.
4. enabling network on emulated os, use DHCP configuration inside emulated os to get automatic IP adress 10.x.x.x

after You quit You os inside emulated os, or by qemu console left_CTRL+left_ALT+2 and type quit use this command to launch again Your emulated OS:
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime

How to have sound in qemu OS, You just need to launch qemu the way I listed above, only with -soundhw sb16 or -soundhw es1370 to emulate Sound Blaster 16, or Sound Blaster 128. You can also enable standart annoying BEEP with -soundhw pcspk. You can also enable all three of them like that: -soundhw sb16,es1370,pcspk, or just BEEP + one of them: -soundhw es1370,pcspk, examples
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw pcspk
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw es1370,pcspk
Code:
% qemu -hda ~/qemu/win2000.img -m 256 -localtime -soundhw es1370,pcspk,sb16

fluxbox add-on:
in ~/.fluxbox/apps:
Code:
# qemu
[app] (class=SDL_App)
  [Workspace]  {2}
  [Deco]       {BORDER}
[end]
resources:

man qemu-img
man qemu
man aio
man dd
man cat
http://kidsquid.com/cgi-bin/moin.cgi/QuickStartGuide
http://qemu-forum.ipi.fi/qemu-snapshots/
http://qemu-forum.ipi.fi/
http://qemu.org/user-doc.html
http://en.wikipedia.org/wiki/QEMU


The same schema works for Solaris 10 and WindowsXP, You only do not use -win2k-hack.

feel free to point errors, typo and Your hints/suggestions here.
__________________
religions, worst damnation of mankind
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds

Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”.
vermaden's: links resources deviantart spreadbsd

Last edited by Carpetsmoker; 7th May 2008 at 06:43 AM. Reason: Fix title
Reply With Quote
 

Tags
qemu

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeBSD GPT howto graudeejs Guides 10 21st December 2010 12:24 AM
HOWTO: FreeBSD CPU Scaling with cpufreq.ko vermaden Guides 10 27th October 2010 07:58 AM
HOWTO: Enemy Territory on FreeBSD tangram Guides 0 9th June 2009 03:31 PM
HOWTO: FreeBSD with CCACHE vermaden Guides 10 9th July 2008 06:14 PM
ssh to FreeBSD run in Qemu mfaridi FreeBSD Security 11 19th May 2008 01:00 PM


All times are GMT. The time now is 02:14 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick