Skip to content

Commit 0958763

Browse files
committed
Launch iPXE if part of the firmware image
1 parent 28cce15 commit 0958763

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/app/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static FIRMWARENSH: &'static str = concat!("\\", env!("BASEDIR"), "\\res\\firmwa
3939
static FIRMWAREROM: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\firmware.rom");
4040
static IFLASHV: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\iflashv.efi");
4141
static IFLASHVTAG: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\iflashv.tag");
42+
static IPXEEFI: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\ipxe.efi");
4243
static MESETTAG: &'static str = concat!("\\", env!("BASEDIR"), "\\firmware\\meset.tag");
4344
static SHELLEFI: &'static str = concat!("\\", env!("BASEDIR"), "\\res\\shell.efi");
4445
static SPLASHBMP: &'static str = concat!("\\", env!("BASEDIR"), "\\res\\splash.bmp");
@@ -206,6 +207,7 @@ fn remove_override(option: u16) -> Result<()> {
206207

207208
fn inner() -> Result<()> {
208209
let mut shutdown = false;
210+
let mut success = false;
209211

210212
let option = set_override()?;
211213

@@ -249,9 +251,7 @@ fn inner() -> Result<()> {
249251

250252
if c == '\n' || c == '\r' {
251253
shutdown = true;
252-
253-
let mut success = true;
254-
254+
success = true;
255255
for (component, validation) in components.iter().zip(validations.iter()) {
256256
if *validation == ValidateKind::Found {
257257
match component.flash() {
@@ -297,6 +297,18 @@ fn inner() -> Result<()> {
297297

298298
remove_override(option)?;
299299

300+
if success && find(IPXEEFI).is_ok() {
301+
println!("Launching iPXE...");
302+
match exec_path(IPXEEFI, &[]) {
303+
Ok(status) => {
304+
println!("iPXE exited with status {}", status);
305+
},
306+
Err(err) => {
307+
println!("Failed to launch iPXE: {:?}", err);
308+
}
309+
}
310+
}
311+
300312
if shutdown {
301313
println!("Press any key to shutdown...");
302314
raw_key()?;

0 commit comments

Comments
 (0)