Building qemu from upstream git source

From time to time, I test from upstream qemu to try out some specific area that I’m interested in (lately, block layer operations). Here’s how I try to build qemu from upstream git source, for a specific target — x86_64.

Install development tools (I’m using a Fedora 18 machine here). And a couple of other development libraries

$  yum groupinstall "Development Tools" 
$  yum install glib2-devel zlibrary zlib-devel -y 

Clone the qemu upstream source tree

$  git clone git://git.qemu.org/qemu.git  
$  cd qemu 

Run the qemu configure script for x86_64 architecture, and run make

$ ./configure --target-list=x86_64-softmmu \
--disable-werror --enable-debug 
$  make -j5 

Note: When the qemu configure script is invoked, it’ll throw an error asking you to either install the pixman package or fetch its git submodule.

I fetched pixman submodule

 $  git submodule update --init pixman 

If you have an OS disk image handy, you can invoke the newly built qemu binary to boot a guest on the stdio, assuming there’s a serial console enabled — having console=tty0 console=ttyS0,115200 inside your guest’s kernel command line in /etc/grub2.conf

$ ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm \
-smp 2 -m 1024 /export/images/fedora18.qcow2 \
-nographic

Note: With the above invocation, --enable-kvm parameter will make use of existing kvm kernel module from the system.

Advertisement

8 Comments

Filed under Uncategorized

8 responses to “Building qemu from upstream git source

  1. mfq

    Instead of manually installing qemu’s build dependencies (zlib-devel, pixman-devel and many more) you can also ‘yum-builddep’ them. As long as the requirements didn’t change compared to the fedora package you’re ready to go then.

    • Right, I usually do that — yum-builddep — while building libguestfs. But for qemu, it asked me to install 306 M of installed pkgs, so I manually built it. However, thanks for the reminder.

  2. rich

    Also a fun libguestfs command:

    make check-with-upstream-qemu
    

    This page lists some common targets.

    • Ah, it’s in the ‘extra-tests’ section in Makefile.am. Thanks Rich, very useful.

      While I have your attention here, Rich, can I ask you to add a ‘Search’ bar on your blog? It has a goldmine of useful information. The other day, I recall Eric Blake trying to search for a specific article.

  3. Yaniv

    My ./configure line is a bit longer, but I think it makes more sense for x86 KVM virt guest:

    ./configure –target-list=x86_64-softmmu –audio-card-list=hda –disable-nptl –disable-guest-base –enable-spice –disable-werror –disable-usb-redir –disable-smartcard-nss –disable-xen –disable-curses –disable-docs –disable-guest-agent –disable-seccomp –enable-vhost-net –disable-linux-user –disable-bsd-user –disable-slirp –disable-system –disable-bluez –audio-card-list=ac97,hda –disable-virtfs –enable-linux-aio $1

  4. Tony Titus

    Any idea what is the difference between QEMU configure targets x86_64-linux-user and x86_64-softmmu? The former creates qemu-x86_64 binary and the latter qemu-system-x86_64.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s