summaryrefslogtreecommitdiff
path: root/source/a/efibootmgr/efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
blob: a1d9831d057f5bc8a9cf32a03b11ee05e0a55fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 6edc3ed5479b575f87eb51e335957b05fdd04fe8 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <pjones@fedoraproject.org>
Date: Wed, 28 Nov 2012 16:49:18 -0500
Subject: [PATCH 1/5] Work around broken Apple firmware

Alex Murray found that Apple's firmware sets an invalid EFI attribute on
BootCurrent, which newer versions of the kernel then reject. This patch
from him simply masks off the extraneous bit.
---
 src/lib/efivars_sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/efivars_sysfs.c b/src/lib/efivars_sysfs.c
index 182c70f..ea87325 100644
--- a/src/lib/efivars_sysfs.c
+++ b/src/lib/efivars_sysfs.c
@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, efi_variable_t *var)
 		return EFI_INVALID_PARAMETER;
 	}
 	close(fd);
+	/* 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 */
+	var->Attributes = var->Attributes & ~(1 << 31);
 	return var->Status;
 }
 
-- 
1.8.0