Rebuild KVM/QEMU to support SPICE on Ubuntu 11.04 (Natty Narwhal)

Rebuild procedure of regular qemu-kvm package to support spice on Natty Narwhal follows bellow. It depends on all packages from ppa:serge-hallyn/spice2 except qemu-kvm-spice. New packages install spice enabled /usr/bin/qemu* binaries and graphical spice client. I just disabled libvirtd’s AppArmor profile to be able manage domains via virt-manager. Spice install may be performed via virt-install. It would understand options “–graphics spice”, “–video qxl”. All required packages have been uploaded and built in PPA Spice on Ubuntu 11.04. View also
Building qemu-kvm&spice based on current /virt/kvm/qemu-kvm.git for Ubuntu 11.04
Uncompress regular Natty qemu-kvm package :-

qemu-kvm_0.14.0+noroms-0ubuntu4.diff.gz
qemu-kvm_0.14.0+noroms-0ubuntu4.dsc
qemu-kvm_0.14.0+noroms.orig.tar.gz

# dpkg-source -x qemu-kvm_0.14.0+noroms-0ubuntu4.dsc
# cd qemu-kvm_0.14.0+noroms-0ubuntu4

Edit debian/rules and comment line ( per Serge Hallyn)

# $(MAKE) -f debian/rules unpatch

to get patching to work !!

That’s a reason why hack “spice-qxl-locking-fix-for-qemu-kvm.patch” didn’t work originally.

Change ./configure part of debian/rules adding “–enable-spice” :-

config-host.mak: $(QUILT_STAMPFN)
dh_testdir
./configure \
–target-list=”x86_64-softmmu i386-softmmu x86_64-linux-user i386-linux-user” \
–prefix=/usr \
–interp-prefix=/etc/qemu-binfmt/%M \
–disable-blobs \
–disable-strip \
–enable-spice \
$(conf_arch)
Save

Edit debian/patches/series:-

larger_default_ram_size.patch
# Detect-and-use-GCC-atomic-builtins-for-locking.patch
# spice-qxl-locking-fix-for-qemu-kvm.patch
0001-qxl-spice-display-move-pipe-to-ssd.patch
0002-qxl-implement-get_command-in-vga-mode-without-locks.patch
0003-qxl-spice-remove-qemu_mutex_-un-lock_iothread-around.patch
0004-hw-qxl-render-drop-cursor-locks-replace-with-pipe.patch

Save and copy required patches to debian/patches.

Edit debian/control like in SPICE2 PPA:-

Build-Depends: bcc,
bzip2,
debhelper (>= 7),
device-tree-compiler [powerpc],
iasl,
libaio-dev,
libasound2-dev,
libcelt051-dev,
libcurl4-gnutls-dev,
libgnutls-dev,
libncurses5-dev,
libpci-dev,
libpixman-1-dev,
libpulse-dev,
libsasl2-dev,
libsdl1.2-dev (>= 1.2.14),
libssl-dev,
libx11-dev,
nasm,
perl,
pkg-config,
quilt (>= 0.40),
libspice-server-dev,
spice-protocol-dev,
sysv-rc (>= 2.86.ds1-14.1ubuntu2),
texi2html,
texinfo,
uuid-dev,
zlib1g-dev
Save.

Edit debian/chagelog and upgrade version to 5.
# cd ..
# dpkg-buildpackage -rfakeroot -b -us -uc
# cd ..
root@boris-System-P5Q3:~/QEMU14# # dpkg -i ./qemu-kvm_0.14.0+noroms-0ubuntu5_amd64.deb \
qemu_0.14.0+noroms-0ubuntu5_amd64.deb \
qemu-common_0.14.0+noroms-0ubuntu5_all.deb

(Reading database … 141175 files and directories currently installed.)
Preparing to replace qemu-kvm 0.14.0+noroms-0ubuntu4 (using …/qemu-kvm_0.14.0+noroms-0ubuntu5_amd64.deb) …
Unpacking replacement qemu-kvm …
Preparing to replace qemu 0.14.0+noroms-0ubuntu4 (using qemu_0.14.0+noroms-0ubuntu5_amd64.deb) …
Unpacking replacement qemu …
Preparing to replace qemu-common 0.14.0+noroms-0ubuntu4 (using qemu-common_0.14.0+noroms-0ubuntu5_all.deb) …
Unpacking replacement qemu-common …
Setting up qemu-common (0.14.0+noroms-0ubuntu5) …
Setting up qemu-kvm (0.14.0+noroms-0ubuntu5) …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Processing triggers for man-db …
Setting up qemu (0.14.0+noroms-0ubuntu5) …

# dpkg -l | grep qemu

ii qemu 0.14.0+noroms-0ubuntu5 dummy transitional package from qemu to qemu-kvm
ii qemu-common 0.14.0+noroms-0ubuntu5 qemu common functionality (bios, documentation, etc)
ii qemu-kvm 0.14.0+noroms-0ubuntu5 Full virtualization on i386 and amd64 hardware

root@boris-System-P5Q3:~/QEMU14# ls -l /usr/bin/kvm*
lrwxrwxrwx 1 root root 18 2011-05-06 15:24 /usr/bin/kvm -> qemu-system-x86_64
lrwxrwxrwx 1 root root 8 2011-05-06 15:24 /usr/bin/kvm-img -> qemu-img
lrwxrwxrwx 1 root root 8 2011-05-06 15:24 /usr/bin/kvm-nbd -> qemu-nbd
-rwxr-xr-x 1 root root 11792 2011-02-22 16:34 /usr/bin/kvm_stat

root@boris-System-P5Q3:~/QEMU14# ls -l /usr/bin/qemu*
-rwxr-xr-x 1 root root 3520568 2011-05-06 15:08 /usr/bin/qemu
-rwxr-xr-x 1 root root 2014976 2011-05-06 15:08 /usr/bin/qemu-i386
-rwxr-xr-x 1 root root 270 2011-05-06 14:04 /usr/bin/qemu-ifdown
-rwxr-xr-x 1 root root 138 2011-02-22 16:34 /usr/bin/qemu-ifup
-rwxr-xr-x 1 root root 350640 2011-05-06 15:08 /usr/bin/qemu-img
-rwxr-xr-x 1 root root 362928 2011-05-06 15:08 /usr/bin/qemu-io
-rwxr-xr-x 1 root root 338384 2011-05-06 15:08 /usr/bin/qemu-nbd
lrwxrwxrwx 1 root root 4 2011-05-06 15:24 /usr/bin/qemu-system-i386 -> qemu
-rwxr-xr-x 1 root root 3590968 2011-05-06 15:08 /usr/bin/qemu-system-x86_64
-rwxr-xr-x 1 root root 2055128 2011-05-06 15:08 /usr/bin/qemu-x86_64

Signed packages uploaded to https://launchpad.net/~bderzhavets/+archive/spice2

Leave a comment