spec: Generate qemu compatible rom filenames

Add the files to /usr/share/ipxe/qemu. The qemu package can then
use this as one of its firmwarepaths, and save itself the symlink
setup complication

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2021-07-07 11:02:43 -04:00
parent 86779a8f6f
commit fd5ab2443c

View File

@ -2,17 +2,16 @@
%global cross 1 %global cross 1
%endif %endif
# PCI IDs (vendor,product) of the ROMS we want for QEMU # ROMS we want for QEMU with format PCIID:QEMUNAME
# %global qemuroms \\\
# pcnet32: 0x1022 0x2000 10222000:pcnet \\\
# ne2k_pci: 0x10ec 0x8029 10ec8029:ne2k_pci \\\
# e1000: 0x8086 0x100e 8086100e:e1000 \\\
# rtl8139: 0x10ec 0x8139 10ec8139:rtl8139 \\\
# virtio-net: 0x1af4 0x1000 1af41000:virtio \\\
# eepro100: 0x8086 0x1209 80861209:eepro100 \\\
# e1000e: 0x8086 0x10d3 808610d3:e1000e \\\
# vmxnet3: 0x15ad 0x07b0 15ad07b0:vmxnet3
%global qemuroms 10222000 10ec8029 8086100e 10ec8139 1af41000 80861209 808610d3 15ad07b0
# We only build the ROMs if on an x86 build host. The resulting # We only build the ROMs if on an x86 build host. The resulting
# binary RPM will be noarch, so other archs will still be able # binary RPM will be noarch, so other archs will still be able
@ -46,7 +45,7 @@
Name: ipxe Name: ipxe
Version: %{date} Version: %{date}
Release: 4.git%{hash}%{?dist} Release: 5.git%{hash}%{?dist}
Summary: A network boot loader Summary: A network boot loader
License: GPLv2 with additional permissions and BSD License: GPLv2 with additional permissions and BSD
@ -159,7 +158,9 @@ make_ipxe ISOLINUX_BIN=/usr/share/syslinux/isolinux.bin \
# build roms with efi support for qemu # build roms with efi support for qemu
mkdir bin-combined mkdir bin-combined
for rom in %{qemuroms}; do for romstr in %{qemuroms}; do
rom=$(echo "$romstr" | cut -d ":" -f 1)
make_ipxe CONFIG=qemu bin/${rom}.rom make_ipxe CONFIG=qemu bin/${rom}.rom
make_ipxe CONFIG=qemu bin-x86_64-efi/${rom}.efidrv make_ipxe CONFIG=qemu bin-x86_64-efi/${rom}.efidrv
vid="0x${rom%%????}" vid="0x${rom%%????}"
@ -199,17 +200,28 @@ popd
cp -a src/bin-i386-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-i386.efi cp -a src/bin-i386-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-i386.efi
cp -a src/bin-x86_64-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-x86_64.efi cp -a src/bin-x86_64-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/ipxe-x86_64.efi
# the roms supported by qemu will be packaged separatedly mkdir -p %{buildroot}%{_datadir}/%{name}/qemu/
# remove from the main rom list and add them to qemu.list
for rom in %{qemuroms}; do for romstr in %{qemuroms}; do
# the roms supported by qemu will be packaged separatedly
# remove from the main rom list and add them to qemu.list
rom=$(echo "$romstr" | cut -d ":" -f 1)
qemuname=$(echo "$romstr" | cut -d ":" -f 2)
sed -i -e "/\/${rom}.rom/d" rom.list sed -i -e "/\/${rom}.rom/d" rom.list
echo %{_datadir}/%{name}/${rom}.rom >> qemu.rom.list echo %{_datadir}/%{name}/${rom}.rom >> qemu.rom.list
cp src/bin-combined/${rom}.rom %{buildroot}/%{_datadir}/%{name}.efi/ cp src/bin-combined/${rom}.rom %{buildroot}/%{_datadir}/%{name}.efi/
echo %{_datadir}/%{name}.efi/${rom}.rom >> qemu.rom.list echo %{_datadir}/%{name}.efi/${rom}.rom >> qemu.rom.list
# Set up symlinks with expected qemu firmware names
ln -s ../../ipxe/${rom}.rom %{buildroot}%{_datadir}/%{name}/qemu/pxe-${qemuname}.rom
ln -s ../../ipxe.efi/${rom}.rom %{buildroot}%{_datadir}/%{name}/qemu/efi-${qemuname}.rom
done done
# endif buildarches
%endif %endif
%ifarch %{buildarches} %ifarch %{buildarches}
%files bootimgs %files bootimgs
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
@ -229,10 +241,14 @@ done
%files roms-qemu -f qemu.rom.list %files roms-qemu -f qemu.rom.list
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}.efi %dir %{_datadir}/%{name}.efi
%{_datadir}/%{name}/qemu
%doc COPYING COPYING.GPLv2 COPYING.UBDL %doc COPYING COPYING.GPLv2 COPYING.UBDL
%endif %endif
%changelog %changelog
* Wed Jul 07 2021 Cole Robinson <crobinso@redhat.com> - 20200823-5.git4bd064de
- Generate qemu compatible rom filenames
* Mon Jun 14 2021 Jiri Kucera <jkucera@redhat.com> - 20200823-4.git4bd064de * Mon Jun 14 2021 Jiri Kucera <jkucera@redhat.com> - 20200823-4.git4bd064de
- Replace genisoimage by xorriso - Replace genisoimage by xorriso