# # spec file for package kvm # # Copyright (c) 2018 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/ # # norootforbuild # icecream 0 %bcond_with vde %define bios_id seabios-0.5.1-git-9fb3f4d950744e97cc655b7d7b523d8bf101e4a0 %define pxe_rom_id gpxe-0.9.9 #%define vgabios_id vgabios-0.6c # note that this list doesn't include the gpxe roms since they get handled # individually and not as a group %define firmware_files {bios.bin vgabios.bin vgabios-cirrus.bin optionrom/extboot.bin optionrom/linuxboot.bin optionrom/multiboot.bin optionrom/vapic.bin} 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 # build the Mac BIOS on x86 platforms %define mac_bios 1 %else %define build_fw_from_source 0 # build no Mac BIOS on others %define mac_bios 0 %endif %define using_buildservice 0%{?opensuse_bs} Name: kvm BuildRequires: SDL-devel alsa alsa-devel gnutls-devel libaio-devel ncurses-devel pciutils-devel perl python texinfo libpixman-1-0-devel BuildRequires: libpixman-1-0-devel >= 0.16.0-2.0 Requires: libpixman-1-0 >= 0.16.0-2.0 %ifarch %ix86 x86_64 %if %{build_fw_from_source} # needed for building vgabios: BuildRequires: bin86 %ifarch x86_64 #needed by bcc compiler which is needed for building vgabios: BuildRequires: glibc-32bit %endif %endif %if %suse_version > 1110 BuildRequires: acpica %else BuildRequires: pmtools %endif %endif Requires: virt-utils %if %suse_version >= 1100 BuildRequires: libcurl-devel libpulse-devel %endif %if %{with vde} BuildRequires: vde2-devel %endif Requires: python-curses %if %suse_version < 1110 Requires: kvm-kmp %endif License: (GPL-2.0 and LGPL-2.1) and GPL-3.0 Group: System/Kernel Summary: Kernel-based Virtual Machine Url: http://www.linux-kvm.org Version: 0.12.5 Release: 1. Source0: qemu-%{name}-%{version}.tar.bz2 Source1: 60-kvm.rules Source2: qemu-ifup Source4: win-virtio-drivers.iso Source5: win-virtio-drivers-src.tar.bz2 Source6: %{bios_id}.tar.bz2 Source7: %{pxe_rom_id}.tar.bz2 Source8: bcc-0.16.17-2.i486.rpm Source9: update_git.sh Source10: kvm-supported.txt Source11: s390-zipl.rom Source12: 60-kvm.rules.s390 # common and X86 patches Patch01: gpxe-rom-settings.patch Patch02: gpxe-code-cleanups.patch Patch03: gpxe-virtio-Replace-virtio-net-with-native-gPXE-driver.patch Patch04: seabios-sanitize-version.patch Patch05: vgabios-bcc-paths.patch Patch09: seabios-preXX-ap-start.patch Patch10: seabios-preXX-enable-irq-in-spin-functions.patch Patch90: kvm-bios.patch PATCH_FILES BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: /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 Linux, Windows, and Mac OS X. 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 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, and in the case of Windows, included. KVM is compatible with various VM management solutions, including libvirt, virt-manager and vm-install. Authors: -------- Avi Kivity Yaniv Kamay Dor Laor %prep %if %{build_fw_from_source} mkdir bcc-bits cd bcc-bits/ rpm2cpio %{SOURCE8} | cpio -id ./usr/bin/bcc ./usr/lib/bcc/bcc-cc1 %setup -q -T -D -n %{pxe_rom_id} -b 7 %patch01 -p1 %patch02 -p1 %patch03 -p1 %endif %setup -q -n qemu-%{name}-%{version} -a 6 #%setup -q -n qemu-%{name}-%{version} -a 6 -a 9 %if %{build_fw_from_source} #ensure that we only end up with the ones we built for i in %firmware_files do rm -f pc-bios/$i done %patch04 -p1 %patch05 -p1 %endif %ifarch s390x cp %{SOURCE11} pc-bios/ %endif cp %{SOURCE10} . %patch09 -p1 %patch10 -p1 # Mac OS X guest %if %{mac_bios} cp -a roms/seabios roms/seabios-mac %patch90 -p1 -b .bios-mac %endif PATCH_EXEC %build ./configure --prefix=%{_prefix} \ --audio-card-list="ac97 adlib cs4231a gus" \ --with-system-pixman \ %if %{build_fw_from_source} --disable-blobs \ %endif %if %suse_version >= 1100 --audio-drv-list="alsa sdl pa oss" \ %else --audio-drv-list="alsa sdl oss" \ %endif %ifarch s390x --target-list="s390x-softmmu" \ %endif --extra-cflags="%{optflags}" \ --disable-strip \ --disable-werror # Aborts if curses support is not enabled: grep "^CONFIG_CURSES=y" config-host.mak # Patch kvm/user Makefile to accept inital CFLAGS: # XXX why? we don't install anything from kvm/user/ sed -i 's/CFLAGS =/CFLAGS +=/' kvm/user/Makefile echo "CFLAGS=%optflags" >> kvm/user/config.mak # Patch the version, so we know which revision was installed: # sed -i "s|kvm-%{version}|kvm-%{version}-%{release}|" config-host.h echo "%{version}-%{release}" > VERSION # userspace: make KVM_KMOD="no" %{?jobs:-j%jobs} # Firmware %ifarch %ix86 x86_64 make -C roms/seabios cp roms/seabios/out/bios.bin pc-bios/bios.bin %if %{mac_bios} make -C roms/seabios-mac %endif %if %{build_fw_from_source} make -C kvm/vgabios cp kvm/vgabios/VGABIOS-lgpl-latest.cirrus.bin pc-bios/vgabios-cirrus.bin cp kvm/vgabios/VGABIOS-lgpl-latest.bin pc-bios/vgabios.bin cd ../%{pxe_rom_id}/src make bin/blib.a make bin/8086100e.rom make bin/10222000.rom make bin/10500940.rom make bin/10ec8139.rom make bin/80861209.rom make bin/1af41000.rom %endif %endif %install make DESTDIR=%{buildroot} KVM_KMOD="no" install %if %{mac_bios} install -m 644 roms/seabios-mac/out/bios.bin %{buildroot}%{_datadir}/qemu-kvm/bios-mac.bin %endif mkdir -p %{buildroot}%{_docdir}/kvm cp qemu-doc.html qemu-kvm.html install -m 755 kvm/kvm_stat %{buildroot}%{_bindir}/ %if %{build_fw_from_source} for i in %firmware_files do install -m 644 pc-bios/$i %{buildroot}%{_datadir}/qemu-kvm/ done install_rom() { install -m 644 $1.rom %{buildroot}%{_datadir}/qemu-kvm/$2.bin } cd ../%{pxe_rom_id}/src/bin/ install_rom 8086100e pxe-e1000 install_rom 10222000 pxe-pcnet install_rom 10500940 pxe-ne2k_pci install_rom 10ec8139 pxe-rtl8139 install_rom 80861209 pxe-i82559er install_rom 1af41000 pxe-virtio %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 -r .%_datadir/qemu-kvm/{openbios-sparc32,openbios-sparc64,ppc_rom.bin,openbios-ppc,video.x,bamboo.dtb,petalogix-s3adsp1800.dtb} %endif %ifarch s390x rm -f .%_datadir/qemu-kvm/bios.bin %endif rm -r .{%_mandir/man1/qemu-img.1,%_mandir/man8/qemu-nbd.8} mv .%_bindir/{qemu-system*,qemu-kvm} mv .%_mandir/man1/{qemu.1,qemu-kvm.1} chmod 644 .%_mandir/man1/* %ifarch s390x install -D -m 644 %{SOURCE12} %{buildroot}/etc/udev/rules.d/60-kvm.rules %else install -D -m 644 %{SOURCE1} %{buildroot}/etc/udev/rules.d/60-kvm.rules %endif install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu-kvm/qemu-ifup install -D -m 644 %{SOURCE4} %{buildroot}/usr/share/qemu-kvm/win-virtio-drivers.iso %clean cd ../ rm -rf bcc-bits rm -rf %{pxe_rom_id} rm -rf $RPM_BUILD_ROOT %pre /usr/sbin/groupadd -r kvm 2>/dev/null || : %files %defattr(-,root,root) %doc qemu-kvm.html kvm-supported.txt %attr(755,root,kvm) %{_bindir}/qemu-kvm %attr(755,root,kvm) %{_bindir}/qemu-img-kvm %attr(755,root,kvm) %{_bindir}/kvm_stat %{_datadir}/qemu-kvm %config /etc/udev/rules.d/60-kvm.rules %_mandir/man1/qemu-kvm.1.gz %changelog