SHA256
1
0
forked from pool/qemu

Accepting request 952206 from home:dfaggioli:experimental2:Virtualization

- Binary firmwares are built from sources by default (and not only on
  x86) and then "cross-imported" among builds for different arches. Of
  course this requires, additionally to these changes, a proper project
  setup (see prjconf). This fixes bsc#1193545.
  * Build x86 firmwares only on x86 builds (i.e., stop cross building
    them on ARM)
  * Build x86 firmwares only once (during x86_64 builds only), instead
    of twice (i.e., during both %ix86 and x86_64, as we're doing now))
  * Always build PPC firmwares (only on PPC builds)
  * Build PPC firmwares only once (during ppc64le builds only), instead
    of twice (i.e., during both ppc64 and ppc64le, as we're doing now))

OBS-URL: https://build.opensuse.org/request/show/952206
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=687
This commit is contained in:
Dario Faggioli 2022-02-07 16:03:12 +00:00 committed by Git OBS Bridge
parent c709c87955
commit 773567aa73
3 changed files with 329 additions and 314 deletions

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sat Feb 5 14:27:32 UTC 2022 - Dario Faggioli <dfaggioli@suse.com>
- Binary firmwares are built from sources by default (and not only on
x86) and then "cross-imported" among builds for different arches. Of
course this requires, additionally to these changes, a proper project
setup (see prjconf). This fixes bsc#1193545.
* Build x86 firmwares only on x86 builds (i.e., stop cross building
them on ARM)
* Build x86 firmwares only once (during x86_64 builds only), instead
of twice (i.e., during both %ix86 and x86_64, as we're doing now))
* Always build PPC firmwares (only on PPC builds)
* Build PPC firmwares only once (during ppc64le builds only), instead
of twice (i.e., during both ppc64 and ppc64le, as we're doing now))
-------------------------------------------------------------------
Sun Jan 23 15:13:19 UTC 2022 - Li Zhang <li.zhang@suse.com>

316
qemu.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package qemu
# spec file
#
# Copyright (c) 2022 SUSE LLC
#
@ -22,37 +22,18 @@
%define _buildshell /bin/bash
%define build_x86_firmware_from_source 0
%define build_skiboot_from_source 0
%define build_slof_from_source 0
%define build_firmware_from_source 1
%define build_opensbi_from_source 0
%define kvm_available 0
%define legacy_qemu_kvm 0
%define force_fit_virtio_pxe_rom 1
%define build_rom_arch %ix86 x86_64 aarch64
%if "%{?distribution}" == ""
%define distro private-build
%else
%define distro %{distribution}
%endif
%ifarch %{build_rom_arch}
# choice of building all from source or using provided binary x86 blobs
%define build_x86_firmware_from_source 1
%endif
%ifarch ppc64
%define build_skiboot_from_source 0
%define build_slof_from_source 1
%endif
%ifarch ppc64le
%define build_skiboot_from_source 0
%define build_slof_from_source 1
%endif
%ifarch riscv64
%define build_opensbi_from_source 1
%endif
@ -228,47 +209,37 @@ syscall layer occurs on the native hardware and operating system.
# above section is for qemu-linux-user
# ------------------------------------------------------------------------
%else
%if %{build_x86_firmware_from_source}
%if %{build_firmware_from_source}
%ifarch x86_64
BuildRequires: acpica
%endif
BuildRequires: pkgconfig(alsa)
%if %{build_x86_firmware_from_source}
BuildRequires: binutils-devel
BuildRequires: dos2unix
BuildRequires: glibc-devel-32bit
BuildRequires: pkgconfig(liblzma)
%endif
%endif
BuildRequires: bison
BuildRequires: brlapi-devel
%if %{build_x86_firmware_from_source}
%ifnarch %{ix86} x86_64
# We must cross-compile on non-x86*
BuildRequires: cross-x86_64-binutils
BuildRequires: cross-x86_64-gcc%gcc_version
%endif
%endif
BuildRequires: pkgconfig(libcurl) >= 7.29
BuildRequires: pkgconfig(libsasl2)
%if %{build_x86_firmware_from_source}
BuildRequires: dos2unix
%endif
BuildRequires: flex
BuildRequires: pkgconfig(glib-2.0) >= 2.56
%if %{build_x86_firmware_from_source}
BuildRequires: glibc-devel-32bit
%endif
BuildRequires: libaio-devel
BuildRequires: libattr-devel
BuildRequires: libbz2-devel
BuildRequires: libfdt-devel >= 1.4.2
BuildRequires: libgcrypt-devel >= 1.8.0
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(epoxy)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(glib-2.0) >= 2.56
BuildRequires: pkgconfig(glusterfs-api) >= 3
BuildRequires: pkgconfig(gnutls) >= 3.5.18
BuildRequires: pkgconfig(gtk+-3.0) >= 3.22
BuildRequires: pkgconfig(libcacard) >= 2.5.1
BuildRequires: pkgconfig(libcap-ng)
BuildRequires: pkgconfig(libcurl) >= 7.29
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libiscsi) >= 1.9.0
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libsasl2)
%if 0%{?with_daxctl}
BuildRequires: pkgconfig(libndctl)
%endif
@ -320,9 +291,6 @@ BuildRequires: pkgconfig(vte-2.91)
BuildRequires: xen-devel >= 4.2
%endif
BuildRequires: xfsprogs-devel
%if %{build_x86_firmware_from_source}
BuildRequires: pkgconfig(liblzma)
%endif
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(zlib)
%if "%{name}" == "qemu"
@ -431,6 +399,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: %name = %{qemuver}
Requires: qemu-SLOF
Recommends: qemu-ipxe
Recommends: qemu-vgabios
@ -893,7 +862,10 @@ Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*)
This package contains the QEMU guest agent. It is installed in the linux guest
to provide information and control at the guest OS level.
%ifarch %{build_rom_arch}
%if %{build_firmware_from_source}
%ifarch x86_64
%package microvm
Summary: x86 MicroVM firmware for QEMU
Group: System/Emulators/PC
@ -907,6 +879,12 @@ QEMU. qboot provides the minimum resources needed to boot PVH and bzImages.
bios-microvm, created from a minimal seabios configuration, provides slightly
wider support than qboot, but still focuses on quick boot up.
%files microvm
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios-microvm.bin
%_datadir/%name/qboot.rom
%package seabios
Summary: x86 Legacy BIOS for QEMU
Group: System/Emulators/PC
@ -919,6 +897,14 @@ Conflicts: %name < 1.6.0
SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS
is the default and legacy BIOS for QEMU.
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/firmware/50-seabios-256k.json
%_datadir/%name/firmware/60-seabios-128k.json
%package vgabios
Summary: VGA BIOSes for QEMU
Group: System/Emulators/PC
@ -940,11 +926,29 @@ Release: 0
BuildArch: noarch
Conflicts: %name < 1.6.0
%files vgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/vgabios.bin
%_datadir/%name/vgabios-ati.bin
%_datadir/%name/vgabios-bochs-display.bin
%_datadir/%name/vgabios-cirrus.bin
%_datadir/%name/vgabios-qxl.bin
%_datadir/%name/vgabios-ramfb.bin
%_datadir/%name/vgabios-stdvga.bin
%_datadir/%name/vgabios-virtio.bin
%_datadir/%name/vgabios-vmware.bin
%description sgabios
The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy
x86 software to communicate with an attached serial console as if a video card
were attached. For use with QEMU.
%files sgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/sgabios.bin
%package ipxe
Summary: PXE ROMs for QEMU NICs
Group: System/Emulators/PC
@ -956,7 +960,27 @@ Conflicts: %name < 1.6.0
%description ipxe
Provides Preboot Execution Environment (PXE) ROM support for various emulated
network adapters available with QEMU.
%files ipxe
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/efi-e1000.rom
%_datadir/%name/efi-e1000e.rom
%_datadir/%name/efi-eepro100.rom
%_datadir/%name/efi-ne2k_pci.rom
%_datadir/%name/efi-pcnet.rom
%_datadir/%name/efi-rtl8139.rom
%_datadir/%name/efi-virtio.rom
%_datadir/%name/efi-vmxnet3.rom
%_datadir/%name/pxe-e1000.rom
%_datadir/%name/pxe-eepro100.rom
%_datadir/%name/pxe-ne2k_pci.rom
%_datadir/%name/pxe-pcnet.rom
%_datadir/%name/pxe-rtl8139.rom
%_datadir/%name/pxe-virtio.rom
%endif
%ifarch ppc64le
%package skiboot
Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems
@ -972,6 +996,35 @@ Provides: %name:%_datadir/%name/forsplits/06
Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as
traditionally packaged with QEMU.
%files skiboot
%defattr(-, root, root)
%dir %_datadir/%name
%dir %_datadir/%name/forsplits
%_datadir/%name/forsplits/06
%_datadir/%name/skiboot.lid
%_datadir/%name/skiboot.lid.qemu
%ghost %_sysconfdir/alternatives/skiboot.lid
%package SLOF
Summary: Slimline Open Firmware (SLOF)
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
BuildArch: noarch
%description SLOF
SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation
for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF.
%files SLOF
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/slof.bin
%endif
%endif
%package ksm
Summary: Kernel Samepage Merging services
Group: System/Emulators/PC
@ -1031,6 +1084,7 @@ BuildRequires: qemu-block-nfs = %{qemuver}
%if 0%{?with_rbd}
BuildRequires: qemu-block-rbd = %{qemuver}
%endif
BuildRequires: qemu-SLOF = %{qemuver}
BuildRequires: qemu-accel-qtest = %{qemuver}
BuildRequires: qemu-accel-tcg-x86 = %{qemuver}
BuildRequires: qemu-block-ssh = %{qemuver}
@ -1182,16 +1236,6 @@ efi-vmxnet3.rom}
# This second list group is specific to what this instance builds
%define ppc_default_built_firmware %{ppc_default_firmware}
%if %{build_skiboot_from_source} && %{build_slof_from_source}
%define ppc_extra_built_firmware %{ppc_extra_firmware}
%else
%if %{build_skiboot_from_source}
%define ppc_extra_built_firmware {skiboot.lid}
%endif
%if %{build_slof_from_source}
%define ppc_extra_built_firmware {slof.bin}
%endif
%endif
%ifarch ppc64
%define ppc64_only_default_built_firmware %{ppc64_only_default_firmware}
@ -1208,16 +1252,17 @@ efi-vmxnet3.rom}
%define s390x_extra_built_firmware %{s390x_extra_firmware}
%endif
%ifarch %ix86 x86_64
%define x86_default_built_firmware %{x86_default_firmware}
%ifarch x86_64
%define x86_default_built_firmware %{x86_default_firmware}
%define x86_64_only_default_built_firmware %{x86_64_only_default_firmware}
%endif
%endif
%if %{build_x86_firmware_from_source}
%define x86_extra_built_firmware %{x86_extra_firmware}
%if %{build_firmware_from_source}
%ifarch ppc64le
%define ppc_extra_built_firmware %{ppc_extra_firmware}
%endif
%ifarch x86_64
%define x86_extra_built_firmware %{x86_extra_firmware}
%define x86_64_only_extra_built_firmware %{x86_64_only_extra_firmware}
%endif
%endif
@ -1459,11 +1504,14 @@ cd %blddir
%if "%{name}" == "qemu"
# delete the firmware files that we intend to build
# If we're building the firmware from sources, delete the upstream provided
# binaries of the specific firmwares that we will build in this instance.
%if %{build_firmware_from_source}
for i in %built_firmware
do
unlink %srcdir/pc-bios/$i
done
%endif
make %{?_smp_mflags} V=1
@ -1483,7 +1531,7 @@ do
done
%endif
%ifarch %ix86 x86_64
%ifarch x86_64
for i in %x86_default_built_firmware
do
cp pc-bios/optionrom/$i %srcdir/pc-bios/
@ -1496,29 +1544,18 @@ done
%endif
%endif
%if %{build_x86_firmware_from_source}
%ifnarch %{ix86} x86_64
export CC=x86_64-suse-linux-gcc
export LD=x86_64-suse-linux-ld
%endif
%if %{build_firmware_from_source}
%ifarch x86_64
make %{?_smp_mflags} -C %srcdir/roms bios \
SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org"
make %{?_smp_mflags} -C %srcdir/roms qboot
make %{?_smp_mflags} -C %srcdir/roms seavgabios \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
make %{?_smp_mflags} -C %srcdir/roms seavgabios
make %{?_smp_mflags} -C %srcdir/roms seavgabios-ati \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
make %{?_smp_mflags} -C %srcdir/roms seavgabios-ati
make %{?_smp_mflags} -C %srcdir/roms pxerom
@ -1563,18 +1600,16 @@ for i in %supported_nics_small
exit 1
fi
done
%ifnarch %{ix86} x86_64
unset CC
unset LD
%endif
%endif
%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C %srcdir/roms skiboot CROSS=
%endif
%ifarch ppc64le
make %{?_smp_mflags} -C %srcdir/roms skiboot
%if %{build_slof_from_source}
make %{?_smp_mflags} -C %srcdir/roms slof
%endif
%endif
%if %{build_opensbi_from_source}
@ -1734,15 +1769,34 @@ ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt
%if "%{name}" == "qemu"
make %{?_smp_mflags} install DESTDIR=%{buildroot}
%ifarch %{build_rom_arch}
install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json
install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json
%else
# At this point, all firmware files have been installed. If we build them, we've
# installed the binaries that have been built; if we don't, we've installed the
# binaries that upstream provides.
#
# In any case, if we are building on an arch for which we don't create (some
# of) the firmware packages, we need to remove the binaries that would go in
# such packages. E.g. if we are not on x86_64, we are not building the x86
# firmware and we are not creating the x86 firmware packages. We, therefore,
# need to remove the upstream fimrware binaries that have been installed in
# the {buildroot} by `make install`, but wouldn't be included in any package.
%ifnarch x86_64
for f in %{x86_extra_firmware} \
%{x86_64_only_extra_firmware}; do
unlink %{buildroot}%_datadir/%name/$f
done
%endif
%ifnarch ppc64le
for f in %{ppc_extra_firmware} \
%{ppc64_only_extra_firmware}; do
unlink %{buildroot}%_datadir/%name/$f
done
%endif
%ifarch x86_64
install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json
install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json
%endif
%find_lang %name
install -d -m 0755 %{buildroot}%_datadir/%name/firmware
install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins
@ -1799,17 +1853,21 @@ unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd
# this was never meant for customer consumption - delete even though installed
unlink %{buildroot}%_bindir/elf2dmp
install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt
for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19
do
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X
done
%ifarch ppc64le
# in support of update-alternatives
mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu
# create a dummy target for /etc/alternatives/skiboot.lid
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06
%endif
install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt
for X in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19
do
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X
done
%suse_update_desktop_file qemu
%fdupes -s %{buildroot}
@ -1874,6 +1932,8 @@ fi
%postun ksm
%service_del_postun ksm.service
%if %{build_firmware_from_source}
%ifarch ppc64le
%post skiboot
update-alternatives --install \
%{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15
@ -1882,6 +1942,8 @@ update-alternatives --install \
if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then
update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu
fi
%endif
%endif
# above section is for qemu
%endif
@ -2168,7 +2230,6 @@ fi
%_datadir/%name/canyonlands.dtb
%_datadir/%name/openbios-ppc
%_datadir/%name/qemu_vga.ndrv
%_datadir/%name/slof.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%dir %_docdir/qemu-ppc
@ -2420,67 +2481,6 @@ fi
%files lang -f %blddir/%name.lang
%defattr(-, root, root)
%ifarch %{build_rom_arch}
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/firmware/50-seabios-256k.json
%_datadir/%name/firmware/60-seabios-128k.json
%files microvm
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios-microvm.bin
%_datadir/%name/qboot.rom
%files vgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/vgabios.bin
%_datadir/%name/vgabios-ati.bin
%_datadir/%name/vgabios-bochs-display.bin
%_datadir/%name/vgabios-cirrus.bin
%_datadir/%name/vgabios-qxl.bin
%_datadir/%name/vgabios-ramfb.bin
%_datadir/%name/vgabios-stdvga.bin
%_datadir/%name/vgabios-virtio.bin
%_datadir/%name/vgabios-vmware.bin
%files sgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/sgabios.bin
%files ipxe
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/efi-e1000.rom
%_datadir/%name/efi-e1000e.rom
%_datadir/%name/efi-eepro100.rom
%_datadir/%name/efi-ne2k_pci.rom
%_datadir/%name/efi-pcnet.rom
%_datadir/%name/efi-rtl8139.rom
%_datadir/%name/efi-virtio.rom
%_datadir/%name/efi-vmxnet3.rom
%_datadir/%name/pxe-e1000.rom
%_datadir/%name/pxe-eepro100.rom
%_datadir/%name/pxe-ne2k_pci.rom
%_datadir/%name/pxe-pcnet.rom
%_datadir/%name/pxe-rtl8139.rom
%_datadir/%name/pxe-virtio.rom
%endif
%files skiboot
%defattr(-, root, root)
%dir %_datadir/%name
%dir %_datadir/%name/forsplits
%_datadir/%name/forsplits/06
%_datadir/%name/skiboot.lid
%_datadir/%name/skiboot.lid.qemu
%ghost %_sysconfdir/alternatives/skiboot.lid
%files vhost-user-gpu
%defattr(-, root, root)
%dir %_datadir/%name/vhost-user

View File

@ -1,7 +1,7 @@
#
# spec file for package qemu
# spec file
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,37 +22,18 @@
%define _buildshell /bin/bash
%define build_x86_firmware_from_source 0
%define build_skiboot_from_source 0
%define build_slof_from_source 0
%define build_firmware_from_source 1
%define build_opensbi_from_source 0
%define kvm_available 0
%define legacy_qemu_kvm 0
%define force_fit_virtio_pxe_rom 1
%define build_rom_arch %ix86 x86_64 aarch64
%if "%{?distribution}" == ""
%define distro private-build
%else
%define distro %{distribution}
%endif
%ifarch %{build_rom_arch}
# choice of building all from source or using provided binary x86 blobs
%define build_x86_firmware_from_source 1
%endif
%ifarch ppc64
%define build_skiboot_from_source 0
%define build_slof_from_source 1
%endif
%ifarch ppc64le
%define build_skiboot_from_source 0
%define build_slof_from_source 1
%endif
%ifarch riscv64
%define build_opensbi_from_source 1
%endif
@ -160,32 +141,22 @@ syscall layer occurs on the native hardware and operating system.
# above section is for qemu-linux-user
# ------------------------------------------------------------------------
%else
%if %{build_x86_firmware_from_source}
%if %{build_firmware_from_source}
%ifarch x86_64
BuildRequires: acpica
BuildRequires: binutils-devel
BuildRequires: dos2unix
BuildRequires: glibc-devel-32bit
BuildRequires: pkgconfig(liblzma)
%endif
%endif
BuildRequires: pkgconfig(alsa)
%if %{build_x86_firmware_from_source}
BuildRequires: binutils-devel
%endif
BuildRequires: bison
BuildRequires: brlapi-devel
%if %{build_x86_firmware_from_source}
%ifnarch %{ix86} x86_64
# We must cross-compile on non-x86*
BuildRequires: cross-x86_64-binutils
BuildRequires: cross-x86_64-gcc%gcc_version
%endif
%endif
BuildRequires: pkgconfig(libcurl) >= 7.29
BuildRequires: pkgconfig(libsasl2)
%if %{build_x86_firmware_from_source}
BuildRequires: dos2unix
%endif
BuildRequires: flex
BuildRequires: pkgconfig(glib-2.0) >= 2.56
%if %{build_x86_firmware_from_source}
BuildRequires: glibc-devel-32bit
%endif
BuildRequires: libaio-devel
BuildRequires: libattr-devel
BuildRequires: libbz2-devel
@ -252,9 +223,6 @@ BuildRequires: pkgconfig(vte-2.91)
BuildRequires: xen-devel >= 4.2
%endif
BuildRequires: xfsprogs-devel
%if %{build_x86_firmware_from_source}
BuildRequires: pkgconfig(liblzma)
%endif
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(libzstd)
%if "%{name}" == "qemu"
@ -363,6 +331,7 @@ Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
Requires: %name = %{qemuver}
Requires: qemu-SLOF
Recommends: qemu-ipxe
Recommends: qemu-vgabios
@ -825,7 +794,10 @@ Supplements: modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*)
This package contains the QEMU guest agent. It is installed in the linux guest
to provide information and control at the guest OS level.
%ifarch %{build_rom_arch}
%if %{build_firmware_from_source}
%ifarch x86_64
%package microvm
Summary: x86 MicroVM firmware for QEMU
Group: System/Emulators/PC
@ -839,6 +811,12 @@ QEMU. qboot provides the minimum resources needed to boot PVH and bzImages.
bios-microvm, created from a minimal seabios configuration, provides slightly
wider support than qboot, but still focuses on quick boot up.
%files microvm
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios-microvm.bin
%_datadir/%name/qboot.rom
%package seabios
Summary: x86 Legacy BIOS for QEMU
Group: System/Emulators/PC
@ -851,6 +829,14 @@ Conflicts: %name < 1.6.0
SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS
is the default and legacy BIOS for QEMU.
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/firmware/50-seabios-256k.json
%_datadir/%name/firmware/60-seabios-128k.json
%package vgabios
Summary: VGA BIOSes for QEMU
Group: System/Emulators/PC
@ -872,11 +858,29 @@ Release: 0
BuildArch: noarch
Conflicts: %name < 1.6.0
%files vgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/vgabios.bin
%_datadir/%name/vgabios-ati.bin
%_datadir/%name/vgabios-bochs-display.bin
%_datadir/%name/vgabios-cirrus.bin
%_datadir/%name/vgabios-qxl.bin
%_datadir/%name/vgabios-ramfb.bin
%_datadir/%name/vgabios-stdvga.bin
%_datadir/%name/vgabios-virtio.bin
%_datadir/%name/vgabios-vmware.bin
%description sgabios
The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy
x86 software to communicate with an attached serial console as if a video card
were attached. For use with QEMU.
%files sgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/sgabios.bin
%package ipxe
Summary: PXE ROMs for QEMU NICs
Group: System/Emulators/PC
@ -888,7 +892,27 @@ Conflicts: %name < 1.6.0
%description ipxe
Provides Preboot Execution Environment (PXE) ROM support for various emulated
network adapters available with QEMU.
%files ipxe
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/efi-e1000.rom
%_datadir/%name/efi-e1000e.rom
%_datadir/%name/efi-eepro100.rom
%_datadir/%name/efi-ne2k_pci.rom
%_datadir/%name/efi-pcnet.rom
%_datadir/%name/efi-rtl8139.rom
%_datadir/%name/efi-virtio.rom
%_datadir/%name/efi-vmxnet3.rom
%_datadir/%name/pxe-e1000.rom
%_datadir/%name/pxe-eepro100.rom
%_datadir/%name/pxe-ne2k_pci.rom
%_datadir/%name/pxe-pcnet.rom
%_datadir/%name/pxe-rtl8139.rom
%_datadir/%name/pxe-virtio.rom
%endif
%ifarch ppc64le
%package skiboot
Summary: OPAL firmware (aka skiboot), used in booting OpenPOWER systems
@ -904,6 +928,35 @@ Provides: %name:%_datadir/%name/forsplits/06
Provides OPAL (OpenPower Abstraction Layer) firmware, aka skiboot, as
traditionally packaged with QEMU.
%files skiboot
%defattr(-, root, root)
%dir %_datadir/%name
%dir %_datadir/%name/forsplits
%_datadir/%name/forsplits/06
%_datadir/%name/skiboot.lid
%_datadir/%name/skiboot.lid.qemu
%ghost %_sysconfdir/alternatives/skiboot.lid
%package SLOF
Summary: Slimline Open Firmware (SLOF)
Group: System/Emulators/PC
Version: %{qemuver}
Release: 0
BuildArch: noarch
%description SLOF
SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation
for certain IBM POWER hardware. The sources are at https://github.com/aik/SLOF.
%files SLOF
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/slof.bin
%endif
%endif
%package ksm
Summary: Kernel Samepage Merging services
Group: System/Emulators/PC
@ -984,6 +1037,7 @@ BuildRequires: qemu-s390x = %{qemuver}
BuildRequires: qemu-seabios = %{sbver}
BuildRequires: qemu-sgabios = 8
BuildRequires: qemu-skiboot = %{qemuver}
BuildRequires: qemu-SLOF = %{qemuver}
BuildRequires: qemu-tools = %{qemuver}
BuildRequires: qemu-ui-curses = %{qemuver}
BuildRequires: qemu-ui-gtk = %{qemuver}
@ -1047,16 +1101,6 @@ efi-vmxnet3.rom}
# This second list group is specific to what this instance builds
%define ppc_default_built_firmware %{ppc_default_firmware}
%if %{build_skiboot_from_source} && %{build_slof_from_source}
%define ppc_extra_built_firmware %{ppc_extra_firmware}
%else
%if %{build_skiboot_from_source}
%define ppc_extra_built_firmware {skiboot.lid}
%endif
%if %{build_slof_from_source}
%define ppc_extra_built_firmware {slof.bin}
%endif
%endif
%ifarch ppc64
%define ppc64_only_default_built_firmware %{ppc64_only_default_firmware}
@ -1073,16 +1117,17 @@ efi-vmxnet3.rom}
%define s390x_extra_built_firmware %{s390x_extra_firmware}
%endif
%ifarch %ix86 x86_64
%define x86_default_built_firmware %{x86_default_firmware}
%ifarch x86_64
%define x86_default_built_firmware %{x86_default_firmware}
%define x86_64_only_default_built_firmware %{x86_64_only_default_firmware}
%endif
%endif
%if %{build_x86_firmware_from_source}
%define x86_extra_built_firmware %{x86_extra_firmware}
%if %{build_firmware_from_source}
%ifarch ppc64le
%define ppc_extra_built_firmware %{ppc_extra_firmware}
%endif
%ifarch x86_64
%define x86_extra_built_firmware %{x86_extra_firmware}
%define x86_64_only_extra_built_firmware %{x86_64_only_extra_firmware}
%endif
%endif
@ -1324,11 +1369,14 @@ cd %blddir
%if "%{name}" == "qemu"
# delete the firmware files that we intend to build
# If we're building the firmware from sources, delete the upstream provided
# binaries of the specific firmwares that we will build in this instance.
%if %{build_firmware_from_source}
for i in %built_firmware
do
unlink %srcdir/pc-bios/$i
done
%endif
make %{?_smp_mflags} V=1
@ -1348,7 +1396,7 @@ do
done
%endif
%ifarch %ix86 x86_64
%ifarch x86_64
for i in %x86_default_built_firmware
do
cp pc-bios/optionrom/$i %srcdir/pc-bios/
@ -1361,29 +1409,18 @@ done
%endif
%endif
%if %{build_x86_firmware_from_source}
%ifnarch %{ix86} x86_64
export CC=x86_64-suse-linux-gcc
export LD=x86_64-suse-linux-ld
%endif
%if %{build_firmware_from_source}
%ifarch x86_64
make %{?_smp_mflags} -C %srcdir/roms bios \
SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org"
make %{?_smp_mflags} -C %srcdir/roms qboot
make %{?_smp_mflags} -C %srcdir/roms seavgabios \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
make %{?_smp_mflags} -C %srcdir/roms seavgabios
make %{?_smp_mflags} -C %srcdir/roms seavgabios-ati \
%ifnarch %ix86 x86_64
HOSTCC=cc \
%endif
make %{?_smp_mflags} -C %srcdir/roms seavgabios-ati
make %{?_smp_mflags} -C %srcdir/roms pxerom
@ -1428,18 +1465,16 @@ for i in %supported_nics_small
exit 1
fi
done
%ifnarch %{ix86} x86_64
unset CC
unset LD
%endif
%endif
%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C %srcdir/roms skiboot CROSS=
%endif
%ifarch ppc64le
make %{?_smp_mflags} -C %srcdir/roms skiboot
%if %{build_slof_from_source}
make %{?_smp_mflags} -C %srcdir/roms slof
%endif
%endif
%if %{build_opensbi_from_source}
@ -1599,15 +1634,34 @@ ln -s qemu-binfmt %{buildroot}%_bindir/qemu-xtensaeb-binfmt
%if "%{name}" == "qemu"
make %{?_smp_mflags} install DESTDIR=%{buildroot}
%ifarch %{build_rom_arch}
install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json
install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json
%else
# At this point, all firmware files have been installed. If we build them, we've
# installed the binaries that have been built; if we don't, we've installed the
# binaries that upstream provides.
#
# In any case, if we are building on an arch for which we don't create (some
# of) the firmware packages, we need to remove the binaries that would go in
# such packages. E.g. if we are not on x86_64, we are not building the x86
# firmware and we are not creating the x86 firmware packages. We, therefore,
# need to remove the upstream fimrware binaries that have been installed in
# the {buildroot} by `make install`, but wouldn't be included in any package.
%ifnarch x86_64
for f in %{x86_extra_firmware} \
%{x86_64_only_extra_firmware}; do
unlink %{buildroot}%_datadir/%name/$f
done
%endif
%ifnarch ppc64le
for f in %{ppc_extra_firmware} \
%{ppc64_only_extra_firmware}; do
unlink %{buildroot}%_datadir/%name/$f
done
%endif
%ifarch x86_64
install -D -m 0644 %{SOURCE14} %{buildroot}%_datadir/%name/firmware/50-seabios-256k.json
install -D -m 0644 %{SOURCE15} %{buildroot}%_datadir/%name/firmware/60-seabios-128k.json
%endif
%find_lang %name
install -d -m 0755 %{buildroot}%_datadir/%name/firmware
install -d -m 0755 %{buildroot}/usr/lib/supportconfig/plugins
@ -1664,17 +1718,21 @@ unlink %{buildroot}%_datadir/%name/edk2-x86_64-secure-code.fd
# this was never meant for customer consumption - delete even though installed
unlink %{buildroot}%_bindir/elf2dmp
install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt
for X in 00 01 02 03 04 05 07 08 09 10 11 12 13 14 15 16 17 18 19
do
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X
done
%ifarch ppc64le
# in support of update-alternatives
mv %{buildroot}%_datadir/%name/skiboot.lid %{buildroot}%_datadir/%name/skiboot.lid.qemu
# create a dummy target for /etc/alternatives/skiboot.lid
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/skiboot.lid %{buildroot}%{_datadir}/%name/skiboot.lid
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/06
%endif
install -D -m 0644 %{SOURCE201} %{buildroot}%_datadir/%name/forsplits/pkg-split.txt
for X in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19
do
ln -s pkg-split.txt %{buildroot}%_datadir/%name/forsplits/$X
done
%suse_update_desktop_file qemu
%fdupes -s %{buildroot}
@ -1739,6 +1797,8 @@ fi
%postun ksm
%service_del_postun ksm.service
%if %{build_firmware_from_source}
%ifarch ppc64le
%post skiboot
update-alternatives --install \
%{_datadir}/%name/skiboot.lid skiboot.lid %{_datadir}/%name/skiboot.lid.qemu 15
@ -1747,6 +1807,8 @@ update-alternatives --install \
if [ ! -f %{_datadir}/%name/skiboot.lid.qemu ] ; then
update-alternatives --remove skiboot.lid %{_datadir}/%name/skiboot.lid.qemu
fi
%endif
%endif
# above section is for qemu
%endif
@ -2033,7 +2095,6 @@ fi
%_datadir/%name/canyonlands.dtb
%_datadir/%name/openbios-ppc
%_datadir/%name/qemu_vga.ndrv
%_datadir/%name/slof.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%dir %_docdir/qemu-ppc
@ -2285,67 +2346,6 @@ fi
%files lang -f %blddir/%name.lang
%defattr(-, root, root)
%ifarch %{build_rom_arch}
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/firmware/50-seabios-256k.json
%_datadir/%name/firmware/60-seabios-128k.json
%files microvm
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios-microvm.bin
%_datadir/%name/qboot.rom
%files vgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/vgabios.bin
%_datadir/%name/vgabios-ati.bin
%_datadir/%name/vgabios-bochs-display.bin
%_datadir/%name/vgabios-cirrus.bin
%_datadir/%name/vgabios-qxl.bin
%_datadir/%name/vgabios-ramfb.bin
%_datadir/%name/vgabios-stdvga.bin
%_datadir/%name/vgabios-virtio.bin
%_datadir/%name/vgabios-vmware.bin
%files sgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/sgabios.bin
%files ipxe
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/efi-e1000.rom
%_datadir/%name/efi-e1000e.rom
%_datadir/%name/efi-eepro100.rom
%_datadir/%name/efi-ne2k_pci.rom
%_datadir/%name/efi-pcnet.rom
%_datadir/%name/efi-rtl8139.rom
%_datadir/%name/efi-virtio.rom
%_datadir/%name/efi-vmxnet3.rom
%_datadir/%name/pxe-e1000.rom
%_datadir/%name/pxe-eepro100.rom
%_datadir/%name/pxe-ne2k_pci.rom
%_datadir/%name/pxe-pcnet.rom
%_datadir/%name/pxe-rtl8139.rom
%_datadir/%name/pxe-virtio.rom
%endif
%files skiboot
%defattr(-, root, root)
%dir %_datadir/%name
%dir %_datadir/%name/forsplits
%_datadir/%name/forsplits/06
%_datadir/%name/skiboot.lid
%_datadir/%name/skiboot.lid.qemu
%ghost %_sysconfdir/alternatives/skiboot.lid
%files vhost-user-gpu
%defattr(-, root, root)
%dir %_datadir/%name/vhost-user