Skip to content

Commit 31f983a

Browse files
test-runner: Use freestanding boot functions in shell_launcher
Use boot::load_image and boot::start_image in shell_launcher. Drop the `efi_main` args as they are no longer needed.
1 parent 1f67d02 commit 31f983a

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

uefi-test-runner/src/bin/shell_launcher.rs

+11-16
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ extern crate alloc;
1313

1414
use alloc::vec::Vec;
1515
use log::info;
16-
use uefi::boot;
16+
use uefi::boot::{self, LoadImageSource};
1717
use uefi::prelude::*;
1818
use uefi::proto::device_path::build::{self, DevicePathBuilder};
1919
use uefi::proto::device_path::{DevicePath, DeviceSubType, DeviceType, LoadedImageDevicePath};
2020
use uefi::proto::loaded_image::LoadedImage;
21-
use uefi::table::boot::LoadImageSource;
2221

2322
/// Get the device path of the shell app. This is the same as the
2423
/// currently-loaded image's device path, but with the file path part changed.
@@ -43,23 +42,21 @@ fn get_shell_app_device_path(storage: &mut Vec<u8>) -> &DevicePath {
4342
}
4443

4544
#[entry]
46-
fn efi_main(image: Handle, st: SystemTable<Boot>) -> Status {
45+
fn efi_main() -> Status {
4746
uefi::helpers::init().unwrap();
48-
let boot_services = st.boot_services();
4947

5048
let mut storage = Vec::new();
5149
let shell_image_path = get_shell_app_device_path(&mut storage);
5250

5351
// Load the shell app.
54-
let shell_image_handle = boot_services
55-
.load_image(
56-
image,
57-
LoadImageSource::FromDevicePath {
58-
device_path: shell_image_path,
59-
from_boot_manager: false,
60-
},
61-
)
62-
.expect("failed to load shell app");
52+
let shell_image_handle = boot::load_image(
53+
boot::image_handle(),
54+
LoadImageSource::FromDevicePath {
55+
device_path: shell_image_path,
56+
from_boot_manager: false,
57+
},
58+
)
59+
.expect("failed to load shell app");
6360

6461
// Set the command line passed to the shell app so that it will run the
6562
// test-runner app. This automatically turns off the five-second delay.
@@ -74,9 +71,7 @@ fn efi_main(image: Handle, st: SystemTable<Boot>) -> Status {
7471
}
7572

7673
info!("launching the shell app");
77-
boot_services
78-
.start_image(shell_image_handle)
79-
.expect("failed to launch the shell app");
74+
boot::start_image(shell_image_handle).expect("failed to launch the shell app");
8075

8176
Status::SUCCESS
8277
}

0 commit comments

Comments
 (0)