# # spec file for package kvm # # Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # This is a reminder that kvm now builds for compatability with a # dynamically loaded rbd plugin, in support of the SUSE Cloud Ceph # initiative. Currently this plugin is not single sourced, but it may # be advantageous to do so in the future. This marks that interdependency. %bcond_with rbd %bcond_with vde %define package_true_version 1.4.2 %define package_base_version 1.4.2 %define bios_id seabios-1.7.2.1 %define pxe_rom_id ipxe-11ad0ba # (this is post v1.0.0 upstream ipxe code) %define vgabios_id vgabios-0.6c %define sgabios_id sgabios # (sgabios comes from: http://sgabios.googlecode.com/svn/trunk, Rev 8) %define firmware_files {acpi-dsdt.aml bios.bin q35-acpi-dsdt.aml sgabios.bin vgabios.bin vgabios-cirrus.bin vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin optionrom/linuxboot.bin optionrom/multiboot.bin optionrom/kvmvapic.bin pxe-e1000.rom pxe-pcnet.rom pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom} ExclusiveArch: %ix86 x86_64 s390x %ifarch %ix86 x86_64 # choice of building all from source or using provided binary x86 blobs %define build_fw_from_source 1 %else %define build_fw_from_source 0 %endif %define using_buildservice 0%{?opensuse_bs} Name: kvm BuildRequires: SDL-devel BuildRequires: alsa BuildRequires: alsa-devel %ifarch x86_64 BuildRequires: ceph-devel %endif BuildRequires: glib2-devel BuildRequires: gnutls-devel BuildRequires: libaio-devel BuildRequires: libattr-devel BuildRequires: libcap-devel BuildRequires: libcap-ng-devel BuildRequires: libcurl-devel BuildRequires: libpulse-devel BuildRequires: ncurses-devel BuildRequires: pciutils-devel BuildRequires: perl BuildRequires: python BuildRequires: xfsprogs-devel BuildRequires: pwdutils %ifarch %ix86 x86_64 BuildRequires: libseccomp-devel %if %{build_fw_from_source} # needed for building vgabios: BuildRequires: dev86 %endif %if 0%{?suse_version} > 1110 BuildRequires: acpica %else BuildRequires: pmtools %endif %endif %if 0%{?suse_version} >= 1130 BuildRequires: brlapi-devel %endif %if %{with vde} BuildRequires: vde2-devel %endif Requires: pwdutils Requires: python-curses Requires: virt-utils Summary: Kernel-based Virtual Machine License: BSD-3-Clause ; GPL-2.0 ; GPL-2.0+ ; LGPL-2.1+ ; MIT Group: System/Kernel Url: http://www.linux-kvm.org Version: %{package_true_version} Release: 0 Source0: qemu-%{package_true_version}.tar.bz2 Source1: 60-kvm.rules Source2: qemu-ifup Source3: kvm-supported.txt Source4: %{bios_id}.tar.bz2 Source5: %{pxe_rom_id}.tar.bz2 Source6: %{vgabios_id}.tar.bz2 Source7: %{sgabios_id}.tar.bz2 Source8: bridge.conf Source10: update_git.sh # ipxe patches Patch01: ipxe-rom-settings.patch # seabios patches Patch20: seabios-sanitize-version.patch Patch21: seabios-disable-graphical-splashscreen.patch Patch22: seabios-enable-ata-dma.patch Patch23: seabios-enable-ide-fast-timing.patch Patch24: seabios-use-fw_cfg-memory-value-for-above-4-gb-memory-amount.patch # vgabios patches # Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch # This patch queue is auto-generated from https://gitlab.suse.de/virtualization/qemu PATCH_FILES # Please do not add QEMU patches manually here. # Run update_git.sh to regenerate this queue. BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires(pre): /usr/sbin/groupadd %description KVM (Kernel-based Virtual Machine) is virtualization software for Linux. It is based on the hardware virtualization extensions provided by Intel VT and AMD-V technologies. KVM kernel modules provide a control interface at /dev/kvm which the qemu-kvm user-space program uses to provide a hybrid emulated and actual hardware environment sufficent to run various PC operating systems (guests) in unmodified form, including various Linux and Windows versions. Since qemu-kvm is derived from the qemu processor emulator sources it also is able to run guests using processor emulation mode, but with the expected performance impact. Conversely, hardware virtualization features outside the processor such as iommu and sr-iov are used by KVM allowing for improved performance. The seabios, vgabios, sgabios and ipxe open source projects are also pulled from to provide the firmware components included. To increase performance over emulated hardware devices virtio drivers are supported. KVM is compatible with various VM management solutions, including libvirt, virt-manager and vm-install. Authors: -------- Avi Kivity Yaniv Kamay Dor Laor %prep %setup -q -n qemu-%{package_true_version} %if %{build_fw_from_source} # start with clean rom directories (use our own firmware sources) rm -rf roms/seabios/ roms/ipxe/ roms/vgabios/ roms/sgabios/ %setup -q -n qemu-%{package_true_version} -D -T -a 4 -a 5 -a 6 -a 7 #ensure that we only end up with the binaries we build for i in %firmware_files do rm -f pc-bios/$i done # ipxe patches %patch01 -p1 # seabios patches %patch20 -p1 %patch21 -p1 %patch22 -p1 %patch23 -p1 %patch24 -p1 # vgabios patches %endif # qemu patches from git PATCH_EXEC cp %{SOURCE3} . %build # change from devel version to actual version echo "%{package_base_version}" > VERSION echo "kvm-%{version}-%{release}" > KVM_VERSION ./configure \ --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ --libexecdir=%{_libexecdir} \ --with-confsuffix=/qemu-kvm \ --extra-cflags="%{optflags}" \ --disable-debug-tcg \ --disable-sparse \ --enable-werror \ %ifarch x86_64 --enable-rbd \ %endif --enable-sdl \ %if 0%{?suse_version} >= 1100 --audio-drv-list="pa alsa sdl oss" \ %else --audio-drv-list="alsa sdl oss" \ %endif --audio-card-list="ac97 adlib cs4231a gus sb16 hda" \ %ifarch s390x --target-list="s390x-softmmu" \ %else --target-list="x86_64-softmmu" \ %endif --disable-xen \ --enable-vnc-tls \ --disable-vnc-sasl \ --disable-vnc-jpeg \ --disable-vnc-png \ --enable-curses \ --enable-curl \ --disable-fdt \ --disable-bluez \ --enable-kvm \ --disable-user \ %if !%{with vde} --disable-vde \ %endif --enable-virtfs \ --enable-cap-ng \ %if %{build_fw_from_source} --disable-blobs \ %endif --enable-docs \ %if 0%{?suse_version} == 1120 --disable-linux-aio \ %else --enable-linux-aio \ %endif %if 0%{?suse_version} >= 1130 --enable-brlapi \ %else --disable-brlapi \ %endif %ifarch %ix86 x86_64 --enable-seccomp \ %else --disable-seccomp \ %endif --enable-vhost-net \ --disable-spice make %{?_smp_mflags} strip fsdev/virtfs-proxy-helper strip qemu-ga strip qemu-img strip qemu-bridge-helper # Firmware %ifarch %ix86 x86_64 %if %{build_fw_from_source} echo "%{bios_id}" > roms/seabios/.version make -C roms/seabios %{?_smp_mflags} cp roms/seabios/out/bios.bin pc-bios/bios.bin cp roms/seabios/out/acpi-dsdt.aml pc-bios/acpi-dsdt.aml cp roms/seabios/out/q35-acpi-dsdt.aml pc-bios/q35-acpi-dsdt.aml make -C roms/sgabios cp roms/sgabios/sgabios.bin pc-bios/sgabios.bin sed -i 's/CFLAGS =/CFLAGS +=/' roms/vgabios/Makefile make -C roms/vgabios %{?_smp_mflags} cp roms/vgabios/VGABIOS-lgpl-latest.bin pc-bios/vgabios.bin cp roms/vgabios/VGABIOS-lgpl-latest.cirrus.bin pc-bios/vgabios-cirrus.bin cp roms/vgabios/VGABIOS-lgpl-latest.stdvga.bin pc-bios/vgabios-stdvga.bin cp roms/vgabios/VGABIOS-lgpl-latest.vmware.bin pc-bios/vgabios-vmware.bin cp roms/vgabios/VGABIOS-lgpl-latest.qxl.bin pc-bios/vgabios-qxl.bin make -C roms/ipxe/src bin/blib.a %{?_smp_mflags} make -C roms/ipxe/src bin/8086100e.rom %{?_smp_mflags} make -C roms/ipxe/src bin/10222000.rom %{?_smp_mflags} make -C roms/ipxe/src bin/10500940.rom %{?_smp_mflags} make -C roms/ipxe/src bin/10ec8139.rom %{?_smp_mflags} make -C roms/ipxe/src bin/80861209.rom %{?_smp_mflags} make -C roms/ipxe/src bin/1af41000.rom %{?_smp_mflags} cp roms/ipxe/src/bin/8086100e.rom pc-bios/pxe-e1000.rom cp roms/ipxe/src/bin/10222000.rom pc-bios/pxe-pcnet.rom cp roms/ipxe/src/bin/10500940.rom pc-bios/pxe-ne2k_pci.rom cp roms/ipxe/src/bin/10ec8139.rom pc-bios/pxe-rtl8139.rom cp roms/ipxe/src/bin/80861209.rom pc-bios/pxe-eepro100.rom cp roms/ipxe/src/bin/1af41000.rom pc-bios/pxe-virtio.rom # enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward %ifarch x86_64 # the following need to be > 64K %define supported_nics_large {e1000 rtl8139} # the following need to be <= 64K %define supported_nics_small {virtio} %else # the following need to be > 64K %define supported_nics_large {e1000 rtl8139 virtio} # the following need to be <= 64K %define supported_nics_small {} %endif # Though not required, make unsupported pxe roms migration compatable as well %define unsupported_nics {eepro100 ne2k_pci pcnet} for i in %supported_nics_large %unsupported_nics do if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -gt "131072" ; then echo "pxe rom is too large" exit 1 fi if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -le "65536" ; then ./roms/ipxe/src/util/padimg.pl pc-bios/pxe-$i.rom -s 65536 -b 255 echo -ne "SEGMENT OVERAGE\0" >> pc-bios/pxe-$i.rom fi done for i in %supported_nics_small do if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -gt "65536" ; then echo "pxe rom is too large" exit 1 fi done %endif %endif %ifarch s390x make -C pc-bios/s390-ccw %{?_smp_mflags} cp pc-bios/s390-ccw/s390-ccw.img pc-bios/s390-ccw.img %endif %install make install DESTDIR=%{buildroot} %{?_smp_mflags} mkdir -p %{buildroot}%{_docdir}/kvm cp qemu-doc.html qemu-kvm.html cp qemu-tech.html qemu-kvm-tech.html cp QMP/qmp-commands.txt qmp-commands.txt install -m 755 scripts/kvm/kvm_stat %{buildroot}%{_bindir}/ install -m 644 pc-bios/qemu-icon.bmp %{buildroot}%{_datadir}/qemu-kvm/ %ifarch s390x install -m 644 pc-bios/s390-ccw.img %{buildroot}%{_datadir}/qemu-kvm/ %endif %if %{build_fw_from_source} for i in %firmware_files do install -m 644 pc-bios/$i %{buildroot}%{_datadir}/qemu-kvm/ done %endif cd %{buildroot} rm -r .{%_bindir/qemu-io,%_bindir/qemu-nbd,%_datadir/doc/qemu} mv .%_bindir/qemu-img{,-kvm} %if !%{build_fw_from_source} rm .%_datadir/qemu-kvm/{openbios-sparc32,openbios-sparc64,ppc_rom.bin,openbios-ppc,bamboo.dtb,petalogix-ml605.dtb,petalogix-s3adsp1800.dtb,palcode-clipper} %endif %ifarch s390x rm .%_datadir/qemu-kvm/bios.bin mv %{buildroot}%{_sysconfdir}/qemu-kvm/target-x86_64.conf \ %{buildroot}%{_sysconfdir}/qemu-kvm/target-s390x.conf %endif rm -r .%_mandir/man8/qemu-nbd.8 mv .%_bindir/{qemu-system*,qemu-kvm} mv .%_mandir/man1/{qemu.1,qemu-kvm.1} mv .%_mandir/man1/{qemu-img.1,qemu-img-kvm.1} chmod 644 .%_mandir/man1/* install -D -m 644 %{SOURCE1} %{buildroot}/etc/udev/rules.d/60-kvm.rules install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu-kvm/qemu-ifup install -D -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/qemu-kvm/bridge.conf %clean cd ../ rm -rf $RPM_BUILD_ROOT %pre %{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null %{_bindir}/getent group qemu >/dev/null || %{_sbindir}/groupadd -r qemu 2>/dev/null %{_bindir}/getent passwd qemu >/dev/null || \ %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu %post chmod u+s %{_libexecdir}/qemu-bridge-helper %files %defattr(-,root,root) %doc COPYING COPYING.LIB Changelog README qemu-kvm.html qemu-kvm-tech.html kvm-supported.txt qmp-commands.txt %attr(755,root,kvm) %{_bindir}/qemu-kvm %attr(755,root,kvm) %{_bindir}/qemu-img-kvm %attr(755,root,kvm) %{_bindir}/virtfs-proxy-helper %attr(755,root,kvm) %{_bindir}/qemu-ga %attr(755,root,kvm) %{_bindir}/kvm_stat %attr(754,root,kvm) %_libexecdir/qemu-bridge-helper %{_datadir}/qemu-kvm %verify(not mode) %_libexecdir/qemu-bridge-helper %dir %attr(0755,root,kvm) %{_sysconfdir}/qemu-kvm/ %ifarch s390x %config %attr(644,root,kvm) %{_sysconfdir}/qemu-kvm/target-s390x.conf %else %config %attr(644,root,kvm) %{_sysconfdir}/qemu-kvm/target-x86_64.conf %endif %config %attr(644,root,kvm) %{_sysconfdir}/qemu-kvm/bridge.conf %config %{_sysconfdir}/udev/rules.d/60-kvm.rules %_mandir/man1/qemu-kvm.1.gz %_mandir/man1/qemu-img-kvm.1.gz %_mandir/man1/virtfs-proxy-helper.1.gz %changelog