Add NVRAM WriteFlash setting for degarded systems

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/831
This commit is contained in:
Mykola Grymalyuk
2021-12-24 09:37:09 -07:00
parent 9b5d25b2be
commit 5ff1110e90
4 changed files with 32 additions and 2 deletions

View File

@@ -899,6 +899,9 @@ class BuildOpenCore:
if self.constants.disable_connectdrivers is True:
print("- Disabling ConnectDrivers")
self.config["UEFI"]["ConnectDrivers"] = False
if self.constants.nvram_write is False:
print("- Disabling Hardware NVRAM Write")
self.config["NVRAM"]["WriteFlash"] = False
# if self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] is True:
# # Add Content Caching patch
# print("- Fixing Content Caching support")

View File

@@ -866,6 +866,30 @@ Supported Options:
else:
print("Invalid input, returning to previous menu")
self.set_fu_settings()
def set_nvram_write(self):
utilities.cls()
utilities.header(["Set NVRAM Write"])
print(
"""
By default, OpenCore will write NVRAM variables to flash. This is
recommended for majority of systems however for extremely degraded
or fragile systems, you may wish to disable this.
Supported Options:
1. Enable NVRAM Write
2. Disable NVRAM Write
"""
)
change_menu = input("Set NVRAM Write (ie. 1): ")
if change_menu == "1":
self.constants.nvram_write = True
elif change_menu == "2":
self.constants.nvram_write = False
else:
print("Invalid input, returning to previous menu")
self.set_nvram_write()
def credits(self):
utilities.TUIOnlyPrint(
@@ -1089,6 +1113,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle],
[f"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
[f"Set FeatureUnlock: \tCurrently {self.constants.fu_status}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_fu_settings],
[f"Set NVRAM Write:\t\tCurrently {self.constants.nvram_write}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_nvram_write],
]
for option in options:

View File

@@ -106,8 +106,9 @@ class Constants:
## OpenCore Settings
self.opencore_debug = False
self.opencore_build = "RELEASE"
self.showpicker = True # Show or Hide OpenCore's Boot Picker
self.boot_efi = False # Use EFI/BOOT/BOOTx64.efi bootstrap
self.showpicker = True # Show or Hide OpenCore's Boot Picker
self.boot_efi = False # Use EFI/BOOT/BOOTx64.efi bootstrap
self.nvram_write = True # Write to hardware NVRAM
## Kext Settings
self.kext_debug = False # Enables Lilu debug and DebugEnhancer