Skip to content

Commit

Permalink
td-shim: try to find payload image from two regions
Browse files Browse the repository at this point in the history
As upstream qemu does not support TDVF `payload` section type, try both
`Payload` and `LargePayload` region to find the firmware volume that
payload image may be packaged in.

Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
  • Loading branch information
gaojiaqi7 committed May 23, 2024
1 parent c8e4beb commit 2d5a36e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions td-shim/src/bin/td-shim/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,21 @@ fn boot_builtin_payload(
acpi_tables: &Vec<&[u8]>,
) {
// Get and parse image file from the payload firmware volume.
let fv_buffer = memslice::get_mem_slice(memslice::SliceType::ShimPayload);
let mut payload_bin = fv::get_image_from_fv(
fv_buffer,
let mut payload_bin = if let Some(image) = fv::get_image_from_fv(
memslice::get_mem_slice(memslice::SliceType::ShimPayload),
pi::fv::FV_FILETYPE_DXE_CORE,
pi::fv::SECTION_PE32,
)
.expect("Failed to get image file from Firmware Volume");
) {
image
} else if let Some(large_image) = fv::get_image_from_fv(
memslice::get_mem_slice(memslice::SliceType::LargePayload),
pi::fv::FV_FILETYPE_DXE_CORE,
pi::fv::SECTION_PE32,
) {
large_image
} else {
panic!("Failed to find payload image from ")
};

#[cfg(feature = "secure-boot")]
{
Expand Down

0 comments on commit 2d5a36e

Please sign in to comment.