Reinstate an accidentally dropped hack to avoid apple brain damage.
This commit is contained in:
parent
c8ba69795d
commit
737da26a56
@ -0,0 +1,65 @@
|
||||
From 15a46a8023c9925a78ddbacc8534af17db611edb Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@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@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
|
||||
|
Loading…
Reference in New Issue
Block a user