Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

HOWTO: How to build a PC Emulator QEMU RPM for Fedora Core

by Thomas Chung on 2005-05-19 (Updated 2007-02-17)

UPDATE 2007-02-17
Here is QEMU 0.9.0 RPM for FC6.
Please note kqemu 1.3.0pre11 is now GPL! See its changelog.

UPDATE 2006-11-29
Here is QEMU 0.8.2 RPM for FC6.

UPDATE 2006-09-02
Here is QEMU 0.8.2 RPM for FC5.

UPDATE 2006-05-20
Here is QEMU 0.8.1 RPM for FC5.

UPDATE 2006-04-18
Here is QEMU 0.8.0 RPM for FC4 and FC5.


QEMU is a FAST! generic and open source processor emulator which achieves a good emulation speed by using dynamic translation.

QEMU has two operating modes:

* Full system emulation. In this mode, QEMU emulates a full system (for example a PC), including a processor and various peripherials. It can be used to launch different Operating Systems without rebooting the PC or to debug system code.

* User mode emulation (Linux host only). In this mode, QEMU can launch Linux processes compiled for one CPU on another CPU. It can be used to launch the Wine Windows API emulator (http://www.winehq.org) or to ease cross-compilation and cross-debugging.

QEMU can run without an host kernel driver and yet gives acceptable performance.

In this article, I'll discuss how we can build QEMU RPM with QEMU Accelerator also known as kernel-module driver "kqemu" which will be optimized for your Fedora Core 3 Kernel.

Let's begin. As usual, make sure to have rpmbuild directory ready.

Step 1) Download following source files, patch file and spec file:

Source0: qemu-0.7.0.tar.gz
Source1:kqemu-0.6.2-1.tar.gz
Patch0: Makefile.patch
Spec: qemu.spec

Step 2) Build the RPM:

 
[tchung@tchung-home qemu]$ ls
kqemu-0.6.2-1.tar.gz  Makefile.patch  qemu-0.7.0.tar.gz  qemu.spec
[tchung@tchung-home qemu]$ cp *.gz *.patch ~/rpmbuild/SOURCES/
[tchung@tchung-home qemu]$ cp *.spec ~/rpmbuild/SPECS/
[tchung@tchung-home qemu]$ rpmbuild -ba ~/rpmbuild/SPECS/qemu.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.62841
+ umask 022
+ cd /home/tchung/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /var/tmp/qemu-buildroot
+ cd /home/tchung/rpmbuild/BUILD
+ rm -rf qemu-0.7.0
+ /usr/bin/gzip -dc /home/tchung/rpmbuild/SOURCES/qemu-0.7.0.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd qemu-0.7.0
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (Makefile.patch):'
Patch #0 (Makefile.patch):
+ patch -p0 -s
+ tar zxf /home/tchung/rpmbuild/SOURCES/kqemu-0.6.2-1.tar.gz -C /home/tchung/rpmbuild/BUILD/qemu-0.7.0
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.13398
+ umask 022
+ cd /home/tchung/rpmbuild/BUILD
+ cd qemu-0.7.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ ./configure --prefix=/usr
Install prefix    /usr
BIOS directory    /usr/share/qemu
binary directory  /usr/bin
Manual directory  /usr/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /home/tchung/rpmbuild/BUILD/qemu-0.7.0
C compiler        gcc
make              make
host CPU          i386
host big endian   no
target list       i386-user arm-user armeb-user sparc-user 
                  ppc-user i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu
gprof enabled     no
static build      no
SDL support       yes
SDL static link   yes
mingw32 support   no
Adlib support     no
FMOD support      no
kqemu support     yes

KQEMU Linux module configuration:
kernel sources    /lib/modules/2.6.11-1.14_FC3smp/build
kbuild type       2.6
+ make
...
omitted
...
Wrote: /home/tchung/rpmbuild/SRPMS/qemu-0.7.0-3.FC3.src.rpm
Wrote: /home/tchung/rpmbuild/RPMS/i386/qemu-0.7.0-3.FC3.i386.rpm
Wrote: /home/tchung/rpmbuild/RPMS/i386/qemu-debuginfo-0.7.0-3.FC3.i386.rpm
Wrote: /home/tchung/rpmbuild/RPMS/i386/kernel-modules-qemu-0.6.2-2.6.11_1.14_FC3smp.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.95594
+ umask 022
+ cd /home/tchung/rpmbuild/BUILD
+ cd qemu-0.7.0
+ rm -rf /var/tmp/qemu-buildroot
+ exit 0
[tchung@tchung-home qemu]$

Step 3) Install the RPM:

 
[tchung@tchung-home qemu]$ mv ~/rpmbuild/RPMS/i386/*.rpm . 
[tchung@tchung-home qemu]$ ls *.rpm
kernel-modules-qemu-0.6.2-2.6.11_1.14_FC3smp.i386.rpm  
qemu-0.7.0-3.FC3.i386.rpm  
qemu-debuginfo-0.7.0-3.FC3.i386.rpm
[tchung@tchung-home qemu]$ sudo rpm -Uvh qemu-0.7.0-3.FC3.i386.rpm
Preparing...                ########################################### [100%]
   1:qemu                   ########################################### [100%]
[tchung@tchung-home qemu]$ sudo rpm -Uvh kernel-modules-qemu-0.6.2-2.6.11_1.14_FC3smp.i386.rpm
Preparing...                ########################################### [100%]
   1:kernel-modules-qemu    ########################################### [100%]
[tchung@tchung-home qemu]$

To verify if Kernel Module QEMU Accelerator (kqemu) has been loaded in your Fedora Core 3 Kernel, type following command:

[tchung@tchung-home qemu]$ /sbin/lsmod | grep kqemu
kqemu                  48008  0
[tchung@tchung-home qemu]$

Screenshots
Here are some screenshots of Win2K running on FC3 and Firefox 1.0.4 running on Win2K.

References:
QEMU Home Page - http://fabrice.bellard.free.fr/qemu/
QEMU on Freshmeat - http://freshmeat.net/projects/qemu/
QEMU on Savannha - http://savannah.nongnu.org/projects/qemu
QEMU User Forum - http://m2.dad-answers.com/qemu-forum/
QEMU Developers Mailing List - http://lists.nongnu.org/mailman/listinfo/qemu-devel

Redistribution:
If you're considering redistribution of the program, please read the License.

"Redistribution of the QEMU Accelerator Module: any person or organisation wishing to distribute it, for example on a CD or as a binary or source package, must have an explicit authorization from the author."

UPDATE 2005-05-20
I'm happy to report that we just received an email authorization from the author to allow to redistribute QEMU and QEMU Accelerator RPM for Fedora Community. :)