[efibootmgr/f19] Reinstate an accidentally dropped hack to avoid apple brain damage.
Peter Jones
pjones at fedoraproject.org
Thu Jun 19 20:19:46 UTC 2014
commit 3a7014034aeb5454ec77c5109d56d447ce4409ba
Author: Peter Jones <pjones at redhat.com>
Date: Thu Jun 19 16:17:32 2014 -0400
Reinstate an accidentally dropped hack to avoid apple brain damage.
...ple-setting-invalid-attribute-bits-in-boo.patch | 65 ++++++++++++++++++++
efibootmgr.spec | 13 ++++-
2 files changed, 77 insertions(+), 1 deletions(-)
---
diff --git a/0001-Mitigate-apple-setting-invalid-attribute-bits-in-boo.patch b/0001-Mitigate-apple-setting-invalid-attribute-bits-in-boo.patch
new file mode 100644
index 0000000..1fe8c07
--- /dev/null
+++ b/0001-Mitigate-apple-setting-invalid-attribute-bits-in-boo.patch
@@ -0,0 +1,65 @@
+From 15a46a8023c9925a78ddbacc8534af17db611edb Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones at redhat.com>
+Date: Tue, 17 Jun 2014 14:05:31 -0400
+Subject: [PATCH] Mitigate apple setting invalid attribute bits in boot
+ variables.
+
+Signed-off-by: Peter Jones <pjones at redhat.com>
+---
+ src/efibootmgr/efibootmgr.c | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
+index e2ec5cd..f596d99 100644
+--- a/src/efibootmgr/efibootmgr.c
++++ b/src/efibootmgr/efibootmgr.c
+@@ -115,6 +115,13 @@ read_vars(char **namelist,
+ &entry->attributes);
+ if (rc < 0)
+ goto err;
++
++ /* latest apple firmware sets high bit which appears
++ * invalid to the linux kernel if we write it back so
++ * lets zero it out if it is set since it would be
++ * invalid to set it anyway */
++ entry->attributes = entry->attributes & ~(1 << 31);
++
+ entry->name = namelist[i];
+ list_add_tail(&entry->list, head);
+ }
+@@ -299,6 +306,11 @@ read_boot_order(efi_variable_t **boot_order)
+ free(new);
+ *boot_order = NULL;
+ }
++
++ /* latest apple firmware sets high bit which appears invalid
++ * to the linux kernel if we write it back so lets zero it out
++ * if it is set since it would be invalid to set it anyway */
++ bo->attributes = bo->attributes & ~(1 << 31);
+ return rc;
+ }
+
+@@ -404,7 +416,7 @@ read_boot_u16(const char *name)
+ static int
+ set_boot_u16(const char *name, uint16_t num)
+ {
+- return efi_set_variable(EFI_GLOBAL_GUID, name, (uint8_t *)&num,
++ return efi_set_variable(EFI_GLOBAL_GUID, name, (uint8_t *)&num,
+ sizeof (num), EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS);
+@@ -577,6 +589,11 @@ construct_boot_order(char *bootorder, int keep,
+ return 0;
+ }
+
++ /* latest apple firmware sets high bit which appears invalid
++ * to the linux kernel if we write it back so lets zero it out
++ * if it is set since it would be invalid to set it anyway */
++ bo.attributes = bo.attributes & ~(1 << 31);
++
+ size_t new_data_size = data_size + bo.data_size;
+ uint16_t *new_data = calloc(1, new_data_size);
+ if (!new_data)
+--
+1.9.0
+
diff --git a/efibootmgr.spec b/efibootmgr.spec
index b5f7138..30aeb85 100644
--- a/efibootmgr.spec
+++ b/efibootmgr.spec
@@ -1,7 +1,7 @@
Summary: EFI Boot Manager
Name: efibootmgr
Version: 0.7.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: https://github.com/vathpela/%{name}/
@@ -17,6 +17,7 @@ Conflicts: elilo < 3.6-6
Obsoletes: elilo < 3.6-6
Source0: https://github.com/vathpela/%{name}/archive/%{name}-%{version}.tar.bz2
+Patch0: 0001-Mitigate-apple-setting-invalid-attribute-bits-in-boo.patch
%description
%{name} displays and allows the user to edit the Intel Extensible
@@ -26,6 +27,13 @@ http://developer.intel.com/technology/efi/efi.htm and http://uefi.org/.
%prep
%setup -q
+git init
+git config user.email "shim-owner at fedoraproject.org"
+git config user.name "Fedora Ninjas"
+git add .
+git commit -a -q -m "%{version} baseline."
+git am %{patches} </dev/null
+
%build
make %{?_smp_mflags} EXTRA_CFLAGS='%{optflags}'
%install
@@ -46,6 +54,9 @@ rm -rf %{buildroot}
%doc README INSTALL COPYING
%changelog
+* Thu Jun 19 2014 Peter Jones <pjones at redhat.com> - 0.7.0-2
+- Reinstate an accidentally dropped hack to avoid apple brain damage.
+
* Tue Apr 01 2014 Peter Jones <pjones at redhat.com> - 0.7.0-1{?dist}
- Release 0.7
More information about the scm-commits
mailing list