File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff 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
2021impl 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,23 @@ 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+ _ => ( ) ,
67+ }
68+
5569 BiosComponent {
5670 bios_vendor,
5771 bios_version,
5872 system_version,
73+ clear_nvram,
5974 }
6075 }
6176
@@ -258,9 +273,11 @@ impl Component for BiosComponent {
258273 }
259274
260275 // Copy old areas to new areas
261- let area_names = [
262- "SMMSTORE" . to_string ( ) ,
263- ] ;
276+ let area_names = if self . clear_nvram {
277+ Vec :: new ( )
278+ } else {
279+ vec ! [ "SMMSTORE" . to_string( ) ]
280+ } ;
264281 for area_name in & area_names {
265282 if let Some ( new_area) = new_areas. get ( area_name) {
266283 let new_offset = new_area. offset as usize ;
You can’t perform that action at this time.
0 commit comments