diff --git a/SOURCES/0001-RHEL-7.x-popt-doesn-t-have-popt.pc-work-around-its-a.patch b/SOURCES/0001-RHEL-7.x-popt-doesn-t-have-popt.pc-work-around-its-a.patch new file mode 100644 index 00000000..0e6d03a8 --- /dev/null +++ b/SOURCES/0001-RHEL-7.x-popt-doesn-t-have-popt.pc-work-around-its-a.patch @@ -0,0 +1,43 @@ +From ad4f7b2b46aadb402dbfb1197151446d10c8ec6e Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 13 Mar 2017 15:33:54 -0400 +Subject: [PATCH 1/2] RHEL 7.x popt doesn't have popt.pc, work around its + absense. + +Related: rhbz#1380825 + +Signed-off-by: Peter Jones +--- + src/Makefile | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/Makefile b/src/Makefile +index 258bac1..453ddad 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -21,15 +21,19 @@ ALL_SOURCES=$(EFIBOOTMGR_SOURCES) + + efibootmgr : $(call objects-of,$(EFIBOOTMGR_SOURCES)) + efibootmgr : PKGS=efivar efiboot ++efibootmgr : LIBS=popt + + eficonman : $(call objects-of,$(EFICONMAN_SOURCES)) +-eficonman : PKGS=efivar efiboot popt ++eficonman : PKGS=efivar efiboot ++eficonman : LIBS=popt + + efibootdump : $(call objects-of,$(EFIBOOTDUMP_SOURCES)) +-efibootdump : PKGS=efivar efiboot popt ++efibootdump : PKGS=efivar efiboot ++efibootdump : LIBS=popt + + efibootnext : $(call objects-of,$(EFIBOOTNEXT_SOURCES)) +-efibootnext : PKGS=efivar efiboot popt ++efibootnext : PKGS=efivar efiboot ++efibootnext : LIBS=popt + + deps : $(ALL_SOURCES) + $(MAKE) -f $(TOPDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)" SUBDIR_CFLAGS="$(SUBDIR_CFLAGS)" +-- +2.9.3 + diff --git a/SOURCES/0002-Don-t-build-efibootdump-on-RHEL-7.4.patch b/SOURCES/0002-Don-t-build-efibootdump-on-RHEL-7.4.patch new file mode 100644 index 00000000..e6f576fd --- /dev/null +++ b/SOURCES/0002-Don-t-build-efibootdump-on-RHEL-7.4.patch @@ -0,0 +1,41 @@ +From 09df652105eb466390c00b8599d777e6fed45c41 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 13 Mar 2017 15:48:09 -0400 +Subject: [PATCH 2/2] Don't build efibootdump on RHEL 7.4... + +Because popt is ancient (1.13 released in 2007, as opposed to 1.16 +released in 2010), it does not have POPT_ARG_ARGV, which efibootdump +uses. Since there's no feature for efibootdump, and we've never shipped +it, just nerf it out of the build. + +Signed-off-by: Peter Jones +--- + src/Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/Makefile b/src/Makefile +index 453ddad..162f552 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -7,7 +7,7 @@ include $(TOPDIR)/Make.defaults + + SUBDIR_CFLAGS = -I$(SRCDIR)/include + +-BINTARGETS=efibootmgr efibootdump ++BINTARGETS=efibootmgr + TARGETS=$(BINTARGETS) + + all : deps $(TARGETS) +@@ -45,9 +45,7 @@ clean : + install : + $(INSTALL) -d -m 755 $(DESTDIR)/$(sbindir)/ + $(INSTALL) -m 755 efibootmgr $(DESTDIR)/$(sbindir)/efibootmgr +- $(INSTALL) -m 755 efibootdump $(DESTDIR)/$(sbindir)/efibootdump + $(INSTALL) -d -m 755 $(DESTDIR)/$(mandir)/man8/ + $(INSTALL) -m 644 efibootmgr.8 $(DESTDIR)/$(mandir)/man8/efibootmgr.8 +- $(INSTALL) -m 644 efibootdump.8 $(DESTDIR)/$(mandir)/man8/efibootdump.8 + + .PHONY : all deps clean install +-- +2.9.3 + diff --git a/SOURCES/0003-make_linux_load_option-check-data_size-correctly.patch b/SOURCES/0003-make_linux_load_option-check-data_size-correctly.patch new file mode 100644 index 00000000..b679be28 --- /dev/null +++ b/SOURCES/0003-make_linux_load_option-check-data_size-correctly.patch @@ -0,0 +1,33 @@ +From 2e018c08b92c800961ec010a6a4eeb34e8f3faa0 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 9 May 2017 16:46:13 -0400 +Subject: [PATCH 3/4] make_linux_load_option(): check data_size correctly. + +Coverity noticed that we're not checking data_size for NULLness before +dereferencing it to pass the value to efi_loadopt_create(). So now we +pass a temporary variable and assign it only if it's non-NULL. + +Signed-off-by: Peter Jones +--- + src/efi.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/efi.c b/src/efi.c +index 8e2664e..cf4ada6 100644 +--- a/src/efi.c ++++ b/src/efi.c +@@ -397,7 +397,10 @@ make_linux_load_option(uint8_t **data, size_t *data_size, + } + } + +- needed = efi_loadopt_create(*data, *data_size, ++ size_t data_size_tmp = 0; ++ if (data_size) ++ data_size_tmp = *data_size; ++ needed = efi_loadopt_create(*data, data_size_tmp, + attributes, dp, needed, opts.label, + optional_data, optional_data_size); + if (dp) { +-- +2.12.2 + diff --git a/SPECS/efibootmgr.spec b/SPECS/efibootmgr.spec new file mode 100644 index 00000000..9352b85a --- /dev/null +++ b/SPECS/efibootmgr.spec @@ -0,0 +1,115 @@ +%define efivar_version 31-1 + +Summary: EFI Boot Manager +Name: efibootmgr +Version: 15 +Release: 2%{?dist} +Group: System Environment/Base +License: GPLv2+ +URL: http://github.com/rhinstaller/%{name}/ +BuildRequires: git, popt-devel +BuildRequires: efivar-libs >= %{efivar_version} +BuildRequires: efivar-devel >= %{efivar_version} +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXXXX) +# EFI/UEFI don't exist on PPC +ExclusiveArch: x86_64 aarch64 + +# for RHEL / Fedora when efibootmgr was part of the elilo package +Conflicts: elilo <= 3.6-6 +Obsoletes: elilo <= 3.6-6 + +Source0: https://github.com/rhinstaller/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.bz2 +Patch0001: 0001-RHEL-7.x-popt-doesn-t-have-popt.pc-work-around-its-a.patch +Patch0002: 0002-Don-t-build-efibootdump-on-RHEL-7.4.patch +Patch0003: 0003-make_linux_load_option-check-data_size-correctly.patch + +%global efidir powerel + +%description +%{name} displays and allows the user to edit the Intel Extensible +Firmware Interface (EFI) Boot Manager variables. Additional +information about EFI can be found at +http://developer.intel.com/technology/efi/efi.htm and http://uefi.org/. + +%prep +%setup -q +git init +git config user.email "example@example.com" +git config user.name "RHEL Ninjas" +git add . +git commit -a -q -m "%{version} baseline." +git am %{patches} - 15-2 +- Fix some coverity issues + Related: rhbz#1380825 + +* Mon Mar 13 2017 Peter Jones - 15-1 +- Update to efivar 15 for fwupdate + Related: rhbz#1380825 + +* Tue Jul 19 2016 Peter Jones - 0.8.0-10 +- Another man page update for Memory Address Range Mirroring + Related: rhbz#1271412 + +* Wed Jul 13 2016 Peter Jones - 0.8.0-9 +- Update man page for Memory Address Range Mirroring + Related: rhbz#1271412 + +* Mon Jun 06 2016 Peter Jones - - 0.8.0-8 +- Add options for Memory Address Range Mirroring + Resolves: rhbz#1271412 + +* Thu Jul 09 2015 Peter Jones - 0.8.0-7 +- Fix a couple of problems parsing command line options QA is seeing. + Resolves: rhbz#1241411 + +* Tue Jun 30 2015 Peter Jones - 0.8.0-6 +- Handle -b and -o parsing in a way that matches the documentation. + Resolves: rhbz#1174964 +- Use the right GUID when setting boot entries active/inactive + Resolves: rhbz#1221771 + +* Mon Feb 02 2015 Peter Jones - 0.8.0-5 +- Fix patch merge error from -4 + Resolves: rhbz#1188313 + +* Thu Jan 08 2015 Peter Jones - 0.8.0-4 +- Fix buffer overflow when remove_from_boot_order removes nothing (lennysz) + Resolves: rhbz#1168019 + +* Wed Oct 15 2014 Peter Jones - 0.8.0-3 +- Don't error when BootOrder is unset and we're trying to add to it. + Related:rhbz#967969 + +* Wed Sep 10 2014 Peter Jones - 0.8.0-2 +- Fix some covscan related errors. + Related: rhbz#1129435 + +* Fri Sep 05 2014 Peter Jones - 0.8.0-1 +- Rebase to 0.8.0 + Resolves: rhbz#1129435