c236306
# EFI/UEFI binaries are not ELF, but PE32/PE32+/COFF
c236306
%global debug_package %{nil}
c236306
c236306
# Vendor name for the EFI System Partition directory
c236306
%global efi_vendor %{name}
c236306
c236306
# Git commit mentioned at https://github.com/pbatard/efifs
afd58a2
%global grub2_version    2.11-0
ded19c5
%global grub2_commit     d9b4638c50b16d4722e66d334e2c1a674b4a45cc
c236306
c236306
# Preferrably the latest stable version shipped in Fedora
2192197
%global edk2_stable_date 20240524
2192197
%global edk2_stable_str  edk2-stable%(d=%{edk2_stable_date}; echo ${d:0:6})
c236306
c236306
Summary:        Free software EFI/UEFI standalone file system drivers
c236306
Name:           efifs
ded19c5
Version:        1.9
2192197
Release:        6%{?dist}
2e181a7
License:        GPL-3.0-or-later
c236306
URL:            https://efi.akeo.ie/
c236306
Source0:        https://github.com/pbatard/efifs/archive/v%{version}/%{name}-%{version}.tar.gz
c236306
# Fedora's grub2 RPM packages don't provide neither a -devel subpackage nor any
c236306
# patched GRUB2 sources such as grub-core/{kern/{err,list,misc},fs/{fshelp,<fs>}.c
c236306
Source1:        https://git.savannah.gnu.org/cgit/grub.git/snapshot/grub-%{grub2_commit}.tar.gz
c236306
# Fedora's edk2 RPM packages might be nice, but unusable for EfiFs depending on
c236306
# EDK II build artifacts and files such as MdePkg/MdePkg.dec, ShellPkg/ShellPkg.dec
c236306
Source2:        https://github.com/tianocore/edk2/archive/%{edk2_stable_str}.tar.gz
c236306
# Small helper script to enable EfiFs drivers using efibootmgr
c236306
Source3:        efifs-enable.sh
c236306
BuildRequires:  gcc
c236306
BuildRequires:  gcc-c++
c236306
BuildRequires:  make
c236306
BuildRequires:  libuuid-devel
c236306
BuildRequires:  python3
c236306
%ifarch x86_64 %{ix86}
c236306
BuildRequires:  nasm
c236306
%endif
c236306
BuildRequires:  efi-srpm-macros
c236306
ExclusiveArch:  %{efi}
c236306
Requires:       efi-filesystem
c236306
Provides:       bundled(grub2-efi-modules) = %{grub2_version}.git%(c=%{grub2_commit}; echo ${c:0:7})
2192197
Provides:       bundled(edk2-tools) = %{edk2_stable_date}
c236306
c236306
%description
c236306
Free software EFI/UEFI standalone file system drivers, based on the GRUB 2.0
c236306
read-only drivers: AFFS (Amiga Fast FileSystem), BFS (BeOS FileSystem), btrfs,
c236306
exFAT, ext2/ext3/ext4, F2FS (experimental), HFS and HFS+ (Mac OS, including
c236306
the compression support), ISO9660, JFS (Journaled FileSystem), nilfs2, NTFS
c236306
(including compression support), ReiserFS, SFS (Amiga Smart FileSystem), UDF,
c236306
UFS/FFS, UFS2/FFS2, XFS, ZFS and more.
c236306
c236306
%prep
c236306
%setup -q -T -c %{name}-%{version} -a 0 -a 2
c236306
cp -p %{SOURCE3} .
c236306
c236306
pushd %{name}-%{version}
c236306
# Extract GRUB2 into place (Git submodule)
c236306
tar -xf %{SOURCE1} --strip-components=1 --directory grub
c236306
c236306
# Apply EfiFs upstream patch to GRUB2
c236306
cd grub && patch -Np1 -i ../0001-GRUB-fixes.patch
c236306
popd
c236306
c236306
pushd edk2-%{edk2_stable_str}
22b8d9c
c236306
# Do not build BrotliCompress (because it's unused)
c236306
sed -e '/BrotliCompress/d' -i BaseTools/Source/C/GNUmakefile
c236306
2192197
# Remove include path pointing to unused sub-module
2192197
sed -e '/mipisyst/d' -i MdePkg/MdePkg.dec
2192197
c236306
# Symlink EfiFs into EDK II build-time working directory
c236306
ln -s ../%{name}-%{version} EfiFsPkg
c236306
popd
c236306
c236306
%build
c236306
pushd edk2-%{edk2_stable_str}
c236306
export PYTHON_COMMAND=%{__python3}
c236306
%make_build -C BaseTools EXTRA_OPTFLAGS="$RPM_OPT_FLAGS" EXTRA_LDFLAGS="$RPM_LD_FLAGS"
c236306
source ./edksetup.sh --reconfig
c236306
c236306
# EDK II violates UEFI 2.8 specification by not using AA64
c236306
%ifarch aarch64
c236306
%global efi_arch_upper AARCH64
c236306
%endif
c236306
c236306
# Fedora's armv7hl expects hardware floating-point ABI
c236306
%ifarch %{arm}
c236306
sed -e 's/-mfloat-abi=soft/-mfloat-abi=hard/' -i Conf/tools_def.txt
c236306
%endif
c236306
c236306
./EfiFsPkg/set_grub_cpu.sh %{efi_arch_upper}
c236306
build -a %{efi_arch_upper} -b RELEASE -t GCC5 -p EfiFsPkg/EfiFsPkg.dsc
c236306
c236306
%install
c236306
install -d -m 0700 $RPM_BUILD_ROOT%{efi_esp_dir}/
c236306
install -p -m 0700 edk2-%{edk2_stable_str}/Build/EfiFs/RELEASE_GCC5/%{efi_arch_upper}/*.efi $RPM_BUILD_ROOT%{efi_esp_dir}/
c236306
c236306
%files
c236306
%license %{name}-%{version}/LICENSE %{name}-%{version}/grub/COPYING
c236306
%doc %{name}-%{version}/ChangeLog.txt %{name}-%{version}/README.md efifs-enable.sh
c236306
%{efi_esp_dir}/
c236306
c236306
%changelog
2192197
* Sun Jun 02 2024 Robert Scheck <robert@fedoraproject.org> 1.9-6
2192197
- Update bundled edk2 to 20240524 (#2284243)
2192197
f003088
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-5
f003088
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
f003088
f391a20
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-4
f391a20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
f391a20
437a016
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-3
437a016
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
437a016
a9be6df
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.9-2
a9be6df
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
a9be6df
ded19c5
* Tue Sep 06 2022 Robert Scheck <robert@fedoraproject.org> 1.9-1
ded19c5
- Upgrade to 1.9 (#2124389)
ded19c5
19b8076
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-4
19b8076
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
19b8076
22b8d9c
* Mon Apr 18 2022 Robert Scheck <robert@fedoraproject.org> 1.8-3
22b8d9c
- Update bundled edk2 to 202202 and add GCC 12 fixes (#2045335)
22b8d9c
a34c402
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.8-2
a34c402
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
a34c402
afd58a2
* Sat Aug 21 2021 Robert Scheck <robert@fedoraproject.org> 1.8-1
afd58a2
- Upgrade to 1.8 (#1996231)
afd58a2
e6bed50
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.7-3
e6bed50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
e6bed50
c236306
* Sun Nov 29 2020 Robert Scheck <robert@fedoraproject.org> 1.7-2
c236306
- Changes to match the Fedora Packaging Guidelines (#1902498)
c236306
c236306
* Wed Nov 25 2020 Robert Scheck <robert@fedoraproject.org> 1.7-1
c236306
- Upgrade to 1.7
c236306
c236306
* Fri May 01 2020 Robert Scheck <robert@fedoraproject.org> 1.5-1
c236306
- Upgrade to 1.5
c236306
- Initial spec file for Fedora and Red Hat Enterprise Linux