Skip to content

Commit 97434a4

Browse files
committed
Clear NVRAM if flashing darp6
1 parent be9ade7 commit 97434a4

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/app/bios.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ pub struct BiosComponent {
1515
bios_vendor: String,
1616
bios_version: String,
1717
system_version: String,
18+
clear_nvram: bool,
1819
}
1920

2021
impl BiosComponent {
2122
pub fn new() -> BiosComponent {
2223
let mut bios_vendor = String::new();
2324
let mut bios_version = String::new();
2425
let mut system_version = String::new();
26+
let mut clear_nvram = false;
2527

2628
for table in crate::dmi::dmi() {
2729
match table.header.kind {
@@ -52,10 +54,21 @@ impl BiosComponent {
5254
}
5355
}
5456

57+
match bios_vendor.as_str() {
58+
"coreboot" => match system_version.as_str() {
59+
"darp6" => {
60+
// Clear NVRAM if flashing darp6, as workaround for
61+
// https://github.com/system76/firmware-open/issues/127
62+
clear_nvram = true;
63+
}
64+
}
65+
}
66+
5567
BiosComponent {
5668
bios_vendor,
5769
bios_version,
5870
system_version,
71+
clear_nvram,
5972
}
6073
}
6174

@@ -258,9 +271,11 @@ impl Component for BiosComponent {
258271
}
259272

260273
// Copy old areas to new areas
261-
let area_names = [
262-
"SMMSTORE".to_string(),
263-
];
274+
let area_names = if self.clear_nvram {
275+
Vec::new()
276+
} else {
277+
vec!["SMMSTORE".to_string()]
278+
};
264279
for area_name in &area_names {
265280
if let Some(new_area) = new_areas.get(area_name) {
266281
let new_offset = new_area.offset as usize;

0 commit comments

Comments
 (0)