Skip to content

patina_boot: Add install_ram_disk helper#1496

Closed
kat-perez wants to merge 2 commits into
OpenDevicePartnership:mainfrom
kat-perez:kat-perez/issue-67-install-ram-disk
Closed

patina_boot: Add install_ram_disk helper#1496
kat-perez wants to merge 2 commits into
OpenDevicePartnership:mainfrom
kat-perez:kat-perez/issue-67-install-ram-disk

Conversation

@kat-perez
Copy link
Copy Markdown
Contributor

Description

Adds install_ram_disk(boot_services, bytes) -> Result<DevicePathBuf> to patina_boot::helpers. Leaks bytes into a stable heap allocation, locates the UEFI RAM Disk Protocol, and registers the buffer as a virtual disk of type RAM_DISK_VIRTUAL_DISK_GUID. Returns the firmware-assigned device path as an owned DevicePathBuf, suitable for boot_from_device_path or similar consumers.

The backing memory lives for the rest of the firmware's lifetime — there is no Drop impl that frees it. Callers may invoke the protocol's unregister to remove the device-path entry, but the memory itself stays leaked.

Closes OpenDevicePartnership/odp-platform-common#67.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all

Integration Instructions

Stacked on #1490 (RAM Disk protocol bindings). Merge #1490 first, then this rebases trivially onto feature/patina-boot.

Adds sdk/patina/src/uefi_protocol/ram_disk.rs implementing the FFI
binding for EFI_RAM_DISK_PROTOCOL per UEFI 2.10 section 13.16. Exposes
the Protocol struct, RegisterFn / UnregisterFn type aliases, and the
four well-known RamDiskType GUIDs (virtual disk, virtual CD, persistent
variants).

Used by the SRE flow to install the recovery WIM as a virtual block
device after reading it out of the NVMe boot partition into RAM.

Adds two unit tests covering the protocol GUID against the UEFI-spec
value and the distinctness of the four RamDiskType GUIDs.

Closes OpenDevicePartnership#65.
@github-actions github-actions Bot added the impact:testing Affects testing label May 4, 2026
@patina-automation
Copy link
Copy Markdown
Contributor

patina-automation Bot commented May 4, 2026

✅ QEMU Validation Passed

All QEMU validation jobs completed successfully.

Note: Q35 is only built on Windows hosts (QEMU boot is disabled due to a QEMU vfat issue).

Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/25569761337

Boot Time to EFI Shell

Platform Elapsed
Q35 (Linux Host) 26.8s
SBSA (Linux Host) 35.0s

Dependencies

Repository Ref
patina b3f0dfe
patina-dxe-core-qemu 6daf784
patina-fw-patcher 6d365f9
patina-qemu firmware v3.0.0
patina-qemu build script e0231b7

This comment was automatically generated by the Patina QEMU PR Validation Post workflow.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 95.65217% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdk/patina/src/uefi_protocol/ram_disk.rs 95.65% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kat-perez kat-perez force-pushed the feature/patina-boot branch from d9c454f to adc19cd Compare May 6, 2026 15:40
Adds patina::uefi_protocol::ram_disk::install(boot_services, bytes) ->
Result<DevicePathBuf>. Leaks bytes into a stable heap allocation, locates
the UEFI RAM Disk Protocol, and registers the buffer as a virtual disk of
type RAM_DISK_VIRTUAL_DISK_GUID. Returns the firmware-assigned device
path as an owned DevicePathBuf, suitable for boot_from_device_path or
similar consumers.

The backing memory lives for the rest of the firmware's lifetime — there
is no Drop impl that frees it. Callers may invoke the protocol's
unregister to remove the device-path entry, but the memory itself stays
leaked.

Lives next to the EFI_RAM_DISK_PROTOCOL bindings rather than in any
boot-specific crate so any consumer of patina can use it without taking
a boot-orchestration dependency. Gated behind the unstable-device-path
feature because the return type uses DevicePathBuf, which is itself
behind that feature.

Closes OpenDevicePartnership/odp-platform-common#67.
@kat-perez kat-perez force-pushed the kat-perez/issue-67-install-ram-disk branch from b9f859e to b3f0dfe Compare May 8, 2026 17:16
@kat-perez kat-perez changed the base branch from feature/patina-boot to main May 8, 2026 17:16
@kat-perez
Copy link
Copy Markdown
Contributor Author

Closing in favor of OpenDevicePartnership/patina-components#13, which moves the install helper into a new patina_ram_disk crate. The protocol binding stays in sdk/patina per patina#1490 (next to decompress / performance_measurement / status_code); only the higher-level helper moves.

@kat-perez kat-perez closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:testing Affects testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add install_ram_disk helper to patina-boot

1 participant