|Version 9 (modified by 2 months ago) ( diff ),|
There are many different ways of using qemu. Hopefully, people will add notes for what they do.
Use as a server
Xorg drivers if using qemu to build an LFS desktop guest
For a plain guest BLFS x86 or x86_64 system running Xorg without spice there are two choices for the graphics driver:
1. the modesetting driver
This is now part of Xorg-server, provided you enabled libepoxy.
It requires CONFIG_FB, CONFIG_DRM_BOCHS, and you should also use CONFIG_DRM_VGEM in your kernel config to speed up video output (e.g. when listing files). For me this defaults to a 1024x768 framebuffer, but offers modes which will depend on your machine. Although you can force this with '-vga std' that is now the default.
If the 1024x768 framebuffer console is too small to read, enable the 12x22 font in the kernel, you can optionally use the LatGrkCyr-12x22 font in /etc/sysconfig/console provided you are running a UTF-8 system.
2. the vmware driver, which is in BLFS
This is only really relevant if you are using vmware. When last reviewed (2014!), this came up as 1024x768 if the CONFIG_FB and CONFIG_DRM_VMWGFX kernel options were set, or 800x600 if they were not. It supported a large maximum resolution (bigger than my screen). I have no recent experience of this.
other notes on setting up Xorg in a guest
To get other screen sizes, use xrandr. To see which modes are supported you should run 'xrandr' and make a note of both the modes (sizes) and the output (in qemu. You can then invoke xrandr with a line like the following (for the modesetting driver), and if you like it you can add it to the .xinitrc.
xrandr -s 1280x960
Integrating with KVM and SPICE
Please note that these instructions are preliminary. The following packages need to be added in addition to those listed currently in BLFS:
There are no additional dependencies for lz4.
wget https://www.github.com/lz4/lz4/archive/v1.9.1/lz4-1.9.1.tar.gz && tar -xf lz4-1.9.1.tar.gz && cd lz4-1.9.1 && make -C lib PREFIX=/usr && make -C programs PREFIX=/usr lz4 lz4c && sudo make install PREFIX=/usr MANDIR=/usr/share/man/man1
Usbredir depends only on libusb.
wget http://www.spice-space.org/download/usbredir/usbredir-0.8.0.tar.bz2 && tar -xf usbredir-0.8.0.tar.bz2 && cd usbredir-0.8.0 && ./configure --prefix=/usr && make && sudo make install
celt-0.5.1 (this version specifically does not interfere with newer versions)
Celt-0.5.1 depends on libogg.
wget https://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz && tar -xf celt-0.5.1.3.tar.gz && cd celt-0.5.1.3 && ./configure --prefix=/usr && make && sudo make install
No additional dependencies.
wget https://gitlab.freedesktop.org/spice/spice-protocol/uploads/f18acfa4a10482062b3f3484bddeb9fa/spice-protocol-0.14.0.tar.bz2 && tar -xf spice-protocol-0.14.0.tar.bz2 && cd spice-protocol-0.14.0 && ./configure --prefix=/usr && make && sudo make install
No additional dependencies.
git clone git://anongit.freedesktop.org/gstreamer/orc && cd orc && mkdir build && cd build && meson --prefix=/usr .. && ninja && sudo ninja install
Depends on celt-0.5.1, cyrus-sasl, glib2, gtk2, gst-libav, libjpeg, lz4, openssl, opus, orc, pixman, and python2. Optional dependencies are libvpx, valgrind, and x264.
wget https://www.spice-space.org/download/releases/spice-server/spice-0.14.1.tar.bz2 && tar -xf spice-0.14.1.tar.bz2 && cd spice-0.14.1 && ./configure --prefix=/usr --disable-static --enable-client --disable-werror --enable-celt051 && # --enable-smartcard make && sudo make install
Depends on Cyrus-SASL, DBUS, gst-libav, gtk+-3.x, lz4, PulseAudio, and spice-server. Optionally depends on usbredir for usb redirection to host.
wget https://www.spice-space.org/download/gtk/spice-gtk-0.36.tar.bz2 && tar -xf spice-gtk-0.36.tar.bz2 && cd spice-gtk-0.36 && ./configure --prefix=/usr --enable-celt051 && make && sudo make install
This is needed on the guest, not the host, however, xspice can be built on any real host as well to allow remote control. This should generally perform better than VNC or XFWD, and in some cases, better than NX server. Instructions for use on real hardware will be added at a later time. Depends on spice-protocols and xorg-server.
wget http://xorg.freedesktop.org/releases/individual/driver/xf86-video-qxl-0.1.5.tar.bz2 && tar -xf xf86-video-qxl-0.1.5.tar.bz2 && cd xf86-video-qxl-0.1.5 && ./configure $XORG_CONFIG && # --enable-xspice=yes (use if you want to use spice as a remote control application on the host) make && sudo make install
This is needed on your guests (and can be useful on a real host if using spice for remote control of host) Depends on libinput, libpciaccess, and xf86-video-qxl.
wget https://www.spice-space.org/download/releases/spice-vdagent-0.19.0.tar.bz2 && tar -xf spice-vdagent-0.19.0.tar.bz2 && cd spice-vdagent-0.19.0 && ./configure --prefix=/usr --sysconfdir=/etc --with-init-script=systemd && # || --with-init-script=redhat # if using SysV book (but it needs to be modified) sed 's@-Werror@@g' -i Makefile && make && sudo make install
Libvirt is a generic interface for managing multiple types of hypervisors.
wget https://libvirt.org/sources/libvirt-5.4.0.tar.xz && tar -xf libvirt-5.4.0.tar.xz && cd libvirt-5.4.0 && ./configure --prefix=/usr -with-storage-lvm --without-xen \ --with-udev --without-hal --disable-static \ --with-init-script=systemd --with-qemu-user=nobody \ --with-qemu-group=nobody --with-interface && # || --with-init-script=none # if using SysV book (will need to create them, look at the systemd services files in: # tools/libvirt-guests.service.in, src/remote/libvirtd.service.in, src/logging/virtlogd.service.in, and src/locking/virtlockd.service.in # --with-netcf --with-storage-iscsi # if you have these available make && sudo make install
Now build qemu as per BLFS instructions, then continue on with virt-manager.
Virt-manager is a PyGTK control interface for libvirt that allows you to create, modify, monitor, and operate your VMs.
Depends on several python modules not in BLFS. For the ones in BLFS, pycairo, pygobject, and pygtk against python2 along with VTE. The others are requests and ipaddrinfo. Also need libosinfo (all to be added later).
wget https://virt-manager.org/download/sources/virt-manager/virt-manager-2.1.0.tar.gz && tar -xf virt-manager-2.1.0.tar.gz && cd virt-manager-2.1.0 && python setup.py build && sudo python setup.py install --optimize=1