Blob Blame History Raw
# EFI/UEFI binaries are not ELF, but PE32/PE32+/COFF
%global debug_package %{nil}

# Vendor name for the EFI System Partition directory
%global efi_vendor %{name}

# Git commit mentioned at
%global grub2_version    2.11-0
%global grub2_commit     d9b4638c50b16d4722e66d334e2c1a674b4a45cc

# Preferrably the latest stable version shipped in Fedora
%global edk2_stable_date 202205
%global edk2_stable_str  edk2-stable%{edk2_stable_date}

Summary:        Free software EFI/UEFI standalone file system drivers
Name:           efifs
Version:        1.9
Release:        1%{?dist}
License:        GPLv3+
# Fedora's grub2 RPM packages don't provide neither a -devel subpackage nor any
# patched GRUB2 sources such as grub-core/{kern/{err,list,misc},fs/{fshelp,<fs>}.c
# Fedora's edk2 RPM packages might be nice, but unusable for EfiFs depending on
# EDK II build artifacts and files such as MdePkg/MdePkg.dec, ShellPkg/ShellPkg.dec
# Small helper script to enable EfiFs drivers using efibootmgr
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  libuuid-devel
BuildRequires:  python3
%ifarch x86_64 %{ix86}
BuildRequires:  nasm
BuildRequires:  efi-srpm-macros
ExclusiveArch:  %{efi}
Requires:       efi-filesystem
Provides:       bundled(grub2-efi-modules) = %{grub2_version}.git%(c=%{grub2_commit}; echo ${c:0:7})
Provides:       bundled(edk2-tools) = %{edk2_stable_date}01stable

Free software EFI/UEFI standalone file system drivers, based on the GRUB 2.0
read-only drivers: AFFS (Amiga Fast FileSystem), BFS (BeOS FileSystem), btrfs,
exFAT, ext2/ext3/ext4, F2FS (experimental), HFS and HFS+ (Mac OS, including
the compression support), ISO9660, JFS (Journaled FileSystem), nilfs2, NTFS
(including compression support), ReiserFS, SFS (Amiga Smart FileSystem), UDF,
UFS/FFS, UFS2/FFS2, XFS, ZFS and more.

%setup -q -T -c %{name}-%{version} -a 0 -a 2
cp -p %{SOURCE3} .

pushd %{name}-%{version}
# Extract GRUB2 into place (Git submodule)
tar -xf %{SOURCE1} --strip-components=1 --directory grub

# Apply EfiFs upstream patch to GRUB2
cd grub && patch -Np1 -i ../0001-GRUB-fixes.patch

pushd edk2-%{edk2_stable_str}

# Do not build BrotliCompress (because it's unused)
sed -e '/BrotliCompress/d' -i BaseTools/Source/C/GNUmakefile

# Symlink EfiFs into EDK II build-time working directory
ln -s ../%{name}-%{version} EfiFsPkg

pushd edk2-%{edk2_stable_str}
export PYTHON_COMMAND=%{__python3}
source ./ --reconfig

# EDK II violates UEFI 2.8 specification by not using AA64
%ifarch aarch64
%global efi_arch_upper AARCH64

# Fedora's armv7hl expects hardware floating-point ABI
%ifarch %{arm}
sed -e 's/-mfloat-abi=soft/-mfloat-abi=hard/' -i Conf/tools_def.txt

./EfiFsPkg/ %{efi_arch_upper}
build -a %{efi_arch_upper} -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc

install -d -m 0700 $RPM_BUILD_ROOT%{efi_esp_dir}/
install -p -m 0700 edk2-%{edk2_stable_str}/Build/EfiFs/RELEASE_GCC5/%{efi_arch_upper}/*.efi $RPM_BUILD_ROOT%{efi_esp_dir}/

%license %{name}-%{version}/LICENSE %{name}-%{version}/grub/COPYING
%doc %{name}-%{version}/ChangeLog.txt %{name}-%{version}/

* Tue Sep 06 2022 Robert Scheck <> 1.9-1
- Upgrade to 1.9 (#2124389)

* Thu Jul 21 2022 Fedora Release Engineering <> - 1.8-4
- Rebuilt for

* Mon Apr 18 2022 Robert Scheck <> 1.8-3
- Update bundled edk2 to 202202 and add GCC 12 fixes (#2045335)

* Thu Jan 20 2022 Fedora Release Engineering <> - 1.8-2
- Rebuilt for

* Sat Aug 21 2021 Robert Scheck <> 1.8-1
- Upgrade to 1.8 (#1996231)

* Wed Jul 21 2021 Fedora Release Engineering <> - 1.7-3
- Rebuilt for

* Sun Nov 29 2020 Robert Scheck <> 1.7-2
- Changes to match the Fedora Packaging Guidelines (#1902498)

* Wed Nov 25 2020 Robert Scheck <> 1.7-1
- Upgrade to 1.7

* Fri May 01 2020 Robert Scheck <> 1.5-1
- Upgrade to 1.5
- Initial spec file for Fedora and Red Hat Enterprise Linux