Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > 51fd834ae85ee72abbac072113f7f00d > files > 4

ipxe-20200823-7.mga9.src.rpm

# Please keep this package in sync with FC

# ROMS we want for QEMU with format PCIID:QEMUNAME
%global qemuroms \\\
  8086100e:e1000 \\\
  10ec8139:rtl8139 \\\
  1af41000:virtio \\\
  808610d3:e1000e

%if 0%{?mageia}
# Fedora specific roms
%global qemuroms %{qemuroms} \\\
  10222000:pcnet \\\
  10ec8029:ne2k_pci \\\
  80861209:eepro100 \\\
  15ad07b0:vmxnet3
%endif

# We only build the ROMs if on an EFI build host. The resulting
# binary RPM will be noarch, so other archs will still be able
# to use the binary ROMs.
%global buildarches x86_64 aarch64

# (tv) help BS not failing on arm:
ExclusiveArch: %buildarches
#BuildArch: noarch

# debugging firmwares does not go the same way as a normal program.
# moreover, all architectures providing debuginfo for a single noarch
# package is currently clashing in koji, so don't bother.
%global debug_package %{nil}

# Upstream don't do "releases" :-( So we're going to use the date
# as the version, and a GIT hash as the release. Generate new GIT
# snapshots using the folowing commands:
#
# $ hash=`git log -1 --format='%h'`
# $ date=`git log -1 --format='%cd' --date=short | tr -d -`
# $ git archive --prefix ipxe-${date}-git${hash}/ ${hash} | xz -7e > ipxe-${date}-git${hash}.tar.xz
#
# And then change these two:

%global hash 4bd064de
%global date 20200823

Name:    ipxe
Version: %{date}
Release: %mkrel 7
Summary: A network boot loader

Group:   System/Libraries
License: GPLv2 with additional permissions and BSD
URL:     http://ipxe.org/

Source0: %{name}-%{version}-git%{hash}.tar.xz

# Enable IPv6 for qemu's config
# Sent upstream: http://lists.ipxe.org/pipermail/ipxe-devel/2015-November/004494.html
Patch0001: 0001-build-customize-configuration.patch
Patch0002: 0002-Use-spec-compliant-timeouts.patch

%ifarch %{buildarches}
BuildRequires: perl
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(FindBin)
BuildRequires: perl(lib)
%ifarch x86_64
BuildRequires: syslinux
%endif
BuildRequires: mtools
BuildRequires: xorriso
# (tv) xorisso doesn't provide a symlink:
BuildRequires: genisoimage
BuildRequires: edk2-tools
BuildRequires: pkgconfig(liblzma)
BuildRequires: gcc
BuildRequires: binutils-devel
BuildRequires: make

Obsoletes: gpxe <= 1.0.1
%endif

%ifarch x86_64
%package bootimgs-x86
Summary: X86 Network boot loader images in bootable USB, CD, floppy and GRUB formats
Group:   Development/Tools
BuildArch: noarch
Provides: %{name}-bootimgs = %{version}-%{release}
Obsoletes: %{name}-bootimgs < 20200823-9.git4bd064de
Obsoletes: gpxe-bootimgs <= 1.0.1

%package roms
Summary: Network boot loader roms in .rom format
Group:  Development/Tools
Requires: %{name}-roms-qemu = %{version}-%{release}
BuildArch: noarch
Obsoletes: gpxe-roms <= 1.0.1

%package roms-qemu
Summary: Network boot loader roms supported by QEMU, .rom format
Group:  Development/Tools
BuildArch: noarch
Obsoletes: gpxe-roms-qemu <= 1.0.1

%description bootimgs-x86
iPXE is an open source network bootloader. It provides a direct
replacement for proprietary PXE ROMs, with many extra features such as
DNS, HTTP, iSCSI, etc.

This package contains the iPXE boot images in USB, CD, floppy, and PXE
UNDI formats.

%description roms
iPXE is an open source network bootloader. It provides a direct
replacement for proprietary PXE ROMs, with many extra features such as
DNS, HTTP, iSCSI, etc.

This package contains the iPXE roms in .rom format.


%description roms-qemu
iPXE is an open source network bootloader. It provides a direct
replacement for proprietary PXE ROMs, with many extra features such as
DNS, HTTP, iSCSI, etc.

This package contains the iPXE ROMs for devices emulated by QEMU, in
.rom format.
%endif

%ifarch aarch64
%package bootimgs-aarch64
Summary: ARM Network boot loader images in bootable USB and GRUB formats
BuildArch: noarch

%description bootimgs-aarch64
iPXE is an open source network bootloader. It provides a direct
replacement for proprietary PXE ROMs, with many extra features such as
DNS, HTTP, iSCSI, etc.

This package contains the iPXE ARM boot images in USB and GRUB formats.
%endif

%description
iPXE is an open source network bootloader. It provides a direct
replacement for proprietary PXE ROMs, with many extra features such as
DNS, HTTP, iSCSI, etc.

%prep
%setup -q -n %{name}-%{version}-git%{hash}
%autopatch -p1
# ath9k drivers are too big for an Option ROM, and ipxe devs say it doesn't
# make sense anyways
# http://lists.ipxe.org/pipermail/ipxe-devel/2012-March/001290.html
rm -rf src/drivers/net/ath/ath9k

%build
cd src

make_ipxe() {
    %make_build \
        NO_WERROR=1 V=1 \
        GITVERSION=%{hash} \
        "$@"
}

%ifarch x86_64

make_ipxe bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi \
    bin-x86_64-efi/snponly.efi

make_ipxe ISOLINUX_BIN=/usr/share/syslinux/isolinux.bin \
    bin/undionly.kpxe bin/ipxe.{dsk,iso,usb,lkrn} \
    allroms

# build roms with efi support for qemu
mkdir bin-combined
for romstr in %{qemuroms}; do
  rom=$(echo "$romstr" | cut -d ":" -f 1)

  make_ipxe CONFIG=qemu bin/${rom}.rom
  make_ipxe CONFIG=qemu bin-x86_64-efi/${rom}.efidrv
  vid="0x${rom%%????}"
  did="0x${rom#????}"
  EfiRom -f "$vid" -i "$did" --pci23 \
         -ec bin-x86_64-efi/${rom}.efidrv \
         -o  bin-combined/${rom}.eficrom
  util/catrom.pl \
      bin/${rom}.rom \
      bin-combined/${rom}.eficrom \
      > bin-combined/${rom}.rom
  EfiRom -d  bin-combined/${rom}.rom
  # truncate to at least 256KiB
  truncate -s \>256K bin-combined/${rom}.rom
  # verify rom fits in 256KiB
  test $(stat -c '%s' bin-combined/${rom}.rom) -le $((256 * 1024))
done

%endif

%ifarch aarch64
make_ipxe bin-arm64-efi/snponly.efi
%if 0%{?mageia}
make_ipxe bin-arm64-efi/ipxe.efi
%endif
%endif

%install
%ifarch x86_64
mkdir -p %{buildroot}/%{_datadir}/%{name}/
mkdir -p %{buildroot}/%{_datadir}/%{name}.efi/
pushd src/bin/

cp -a undionly.kpxe ipxe.{iso,usb,dsk,lkrn} %{buildroot}/%{_datadir}/%{name}/

for img in *.rom; do
  if [ -e $img ]; then
    cp -a $img %{buildroot}/%{_datadir}/%{name}/
    echo %{_datadir}/%{name}/$img >> ../../rom.list
  fi
done
popd

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/snponly.efi %{buildroot}/%{_datadir}/%{name}/ipxe-snponly-x86_64.efi

mkdir -p %{buildroot}%{_datadir}/%{name}/qemu/

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
  echo %{_datadir}/%{name}/${rom}.rom >> qemu.rom.list

  cp src/bin-combined/${rom}.rom %{buildroot}/%{_datadir}/%{name}.efi/
  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

# endif x86_64
%endif

%ifarch aarch64
mkdir -p %{buildroot}/%{_datadir}/%{name}/arm64-efi
cp -a src/bin-arm64-efi/snponly.efi %{buildroot}/%{_datadir}/%{name}/arm64-efi/snponly.efi
%if 0%{?mageia}
cp -a src/bin-arm64-efi/ipxe.efi %{buildroot}/%{_datadir}/%{name}/arm64-efi/ipxe.efi
%endif
%endif

%ifarch x86_64
%files bootimgs-x86
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/ipxe.iso
%{_datadir}/%{name}/ipxe.usb
%{_datadir}/%{name}/ipxe.dsk
%{_datadir}/%{name}/ipxe.lkrn
%{_datadir}/%{name}/ipxe-i386.efi
%{_datadir}/%{name}/ipxe-x86_64.efi
%{_datadir}/%{name}/undionly.kpxe
%{_datadir}/%{name}/ipxe-snponly-x86_64.efi
%doc COPYING COPYING.GPLv2 COPYING.UBDL

%files roms -f rom.list
%dir %{_datadir}/%{name}
%doc COPYING COPYING.GPLv2 COPYING.UBDL

%files roms-qemu -f qemu.rom.list
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}.efi
%{_datadir}/%{name}/qemu
%doc COPYING COPYING.GPLv2 COPYING.UBDL
%endif
 
%ifarch aarch64
%files bootimgs-aarch64
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/arm64-efi
%if 0%{?mageia}
%{_datadir}/%{name}/arm64-efi/ipxe.efi
%endif
%{_datadir}/%{name}/arm64-efi/snponly.efi
%endif



%changelog
* Tue Apr 05 2022 tv <tv> 20200823-7.mga9
+ Revision: 1845157
- Add aarch64 EFI artifacts (rhbz#2058680)
- Add snponly build (rhbz#1981799)
- Need to drop noarch on SRPM for %%ifarch to work (let's see how BS likes that :-( )

* Wed Mar 30 2022 umeabot <umeabot> 20200823-6.mga9
+ Revision: 1834238
- Mageia 9 Mass Rebuild

* Thu Oct 28 2021 tv <tv> 20200823-5.mga9
+ Revision: 1753202
- Reabuild for latest libs
+ pterjan <pterjan>
- Make the main package noarch and drop ifarch conditions

* Fri Jul 09 2021 tv <tv> 20200823-4.mga9
+ Revision: 1735346
- Restore arched empty pkg to make BS happy
- Bump rel b/c of "ERROR: could not copy rpm files... (Bad file descriptor)"
- Reenable size test
- Drop empty ipxe package
- Generate qemu compatible rom filenames
- Replace genisoimage with xorriso

* Sun Feb 28 2021 tv <tv> 20200823-2.mga9
+ Revision: 1693306
- combine BIOS and EFI roms using "util/catrom.pl"

* Wed Sep 16 2020 tv <tv> 20200823-1.mga8
+ Revision: 1626897
- Update to newer git snapshot, synced with qemu.git
- Re-enable HTTPS support, with edk2 fix included (bz 1820836)
- Workaound fatal GCC 9 compilation/link errors

* Tue Aug 18 2020 tv <tv> 20200803-6.mga8
+ Revision: 1615071
- Revert HTTPS support, causes boot hangs with UEFI (rhbz#1869102)

* Wed Aug 12 2020 tv <tv> 20200803-5.mga8
+ Revision: 1613518
- Enable HTTPS support (rhbz#1820836)

* Mon Aug 10 2020 bcornec <bcornec> 20200803-4.mga8
+ Revision: 1613064
- Disable ROM size check which makes the build fail and update to latest version 20200803
+ tv <tv>
- Explicitly BR perl-FindBin and perl-lib.

* Sat Feb 15 2020 umeabot <umeabot> 20190125-3.mga8
+ Revision: 1527655
- Mageia 8 Mass Rebuild

* Sat Jul 20 2019 tv <tv> 20190125-2.mga8
+ Revision: 1423054
- Allow removing IA32 EFI images from combined oproms
- Check that the ROMs fit in 256K and pad them

* Sat Feb 16 2019 tv <tv> 20190125-1.mga7
+ Revision: 1367798
- new git snapshot

* Tue Jan 01 2019 bcornec <bcornec> 1.mga7-current
+ Revision: 1348048
- update to upstream version of 20180917

* Sun Sep 23 2018 umeabot <umeabot> 20170710-7.mga7
+ Revision: 1298318
- Mageia 7 Mass Rebuild

* Wed Feb 07 2018 tv <tv> 20170710-6.mga7
+ Revision: 1199566
- new release

* Sat Apr 02 2016 tv <tv> 20150821-6.mga6
+ Revision: 997662
- add a dummy main package hoping BS will let it go through (previous builds succeeded but were declared as failed)
- revert; try again with ExclusiveArch
- make the main package noarch hoping BS will let it go through (previous builds succeeded but were declared as failed)
- use cross compiler
- restrict to x86_64 until we've a cross compiler
- imported package ipxe