Skip to content

Commit 7e70d96

Browse files
committed
Support for serw12, only boot into setup_menu if necessary for ME disable
1 parent d8cf8de commit 7e70d96

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

res/firmware.nsh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ if "%2" == "bios" then
104104
endif
105105
endif
106106

107+
# Flash with h2offt if possible, will require reboot and then will
108+
# shut down automatically
109+
if exist h2offt.efi then
110+
h2offt.efi firmware.rom -all -n
111+
exit %lasterror%
112+
endif
113+
107114
# Set logo, should reboot automatically
108115
if exist iflashv.efi then
109116
if exist iflashv.tag then

src/app/bios.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::fs::{find, load};
99
use std::vars::{get_boot_item, get_boot_order, set_boot_item, set_boot_order};
1010
use uefi::status::{Error, Result};
1111

12-
use super::{FIRMWAREDIR, FIRMWARENSH, FIRMWAREROM, IFLASHV, UEFIFLASH, shell, Component};
12+
use super::{FIRMWAREDIR, FIRMWARENSH, FIRMWAREROM, H2OFFT, IFLASHV, UEFIFLASH, shell, Component};
1313

1414
pub struct BiosComponent {
1515
bios_vendor: String,
@@ -141,6 +141,7 @@ impl Component for BiosComponent {
141141
data.len() == 8 * 1024 * 1024 ||
142142
data.len() == 16 * 1024 * 1024 ||
143143
data.len() == 32 * 1024 * 1024 ||
144+
find(H2OFFT).is_ok() || // H2OFFT capsule support
144145
find(IFLASHV).is_ok() || // meer5 capsule support
145146
find(UEFIFLASH).is_ok() // meer4 capsule support
146147
)

src/app/mod.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static EC2ROM: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\ec2.ro
3737
static FIRMWAREDIR: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware");
3838
static FIRMWARENSH: &'static str = concat!("\\", env!("BASEDIR"), "\\res\\firmware.nsh");
3939
static FIRMWAREROM: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\firmware.rom");
40+
static H2OFFT: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\h2offt.efi");
4041
static IFLASHV: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\iflashv.efi");
4142
static IFLASHVTAG: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\iflashv.tag");
4243
static IPXEEFI: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\ipxe.efi");
@@ -218,6 +219,7 @@ fn inner() -> Result<()> {
218219
} else if ! validations.iter().any(|v| *v == ValidateKind::Found) {
219220
"* No updates were found *"
220221
} else {
222+
let mut setup_menu = false;
221223
let c = if find(ECTAG).is_ok() {
222224
// Attempt to remove EC tag
223225
let _ = shell(&format!("{} {} ec tag", FIRMWARENSH, FIRMWAREDIR));
@@ -227,7 +229,8 @@ fn inner() -> Result<()> {
227229
validations.clear();
228230
'\n'
229231
} else if find(MESETTAG).is_ok() {
230-
// Skip enter if in manufacturing mode
232+
// Skip enter if ME unlocked, and boot into firmware setup to disable ME
233+
setup_menu = true;
231234
'\n'
232235
} else if find(IFLASHVTAG).is_ok() {
233236
// Skip enter if flashing a meer5 and flashing already occured
@@ -277,14 +280,16 @@ fn inner() -> Result<()> {
277280
}
278281
}
279282

280-
let supported = get_os_indications_supported().unwrap_or(0);
281-
if supported & 1 == 1 {
282-
println!("Booting into BIOS setup on next boot");
283-
let mut indications = get_os_indications().unwrap_or(0);
284-
indications |= 1;
285-
set_os_indications(Some(indications))?;
286-
} else {
287-
println!("Cannot boot into BIOS setup automatically");
283+
if setup_menu {
284+
let supported = get_os_indications_supported().unwrap_or(0);
285+
if supported & 1 == 1 {
286+
println!("Booting into BIOS setup on next boot");
287+
let mut indications = get_os_indications().unwrap_or(0);
288+
indications |= 1;
289+
set_os_indications(Some(indications))?;
290+
} else {
291+
println!("Cannot boot into BIOS setup automatically");
292+
}
288293
}
289294

290295
"* All updates applied successfully *"
@@ -312,7 +317,11 @@ fn inner() -> Result<()> {
312317
}
313318
}
314319

315-
if shutdown {
320+
if find(H2OFFT).is_ok() {
321+
// H2OFFT will automatically shut down, so skip success confirmation
322+
println!("System will reboot in 5 seconds to perform capsule update");
323+
let _ = (std::system_table().BootServices.Stall)(5_000_000);
324+
} else if shutdown {
316325
println!("Press any key to shutdown...");
317326
raw_key()?;
318327

0 commit comments

Comments
 (0)