Skip to content

[Task] patina_boot: Support partial device path expansion #1280

@kat-perez

Description

@kat-perez

Description

Implement support for expanding partial device paths to full device paths during boot option processing.

Background

UEFI Boot#### variables can contain partial (short-form) device paths that specify only a portion of the full hardware path. For example, a hard drive boot option might contain only HD(1,GPT,<GUID>) without the preceding PCI path. These partial paths must be expanded by matching against the current device topology before they can be used for booting.

Requirements

  • Detect partial vs full device paths by examining the first node type:
    • Full paths: start with hardware/ACPI root nodes (PciRoot, Acpi)
    • Partial paths: start with media nodes (HD, CDROM), messaging nodes without root, or file paths
  • Expand partial device paths to full device paths by matching against discovered device topology
  • Support common partial path types:
    • Hard drive media device paths (partition GUID/signature matching)
    • File path-only device paths
    • Short-form device paths
  • Handle cases where partial path matches multiple devices (prioritization strategy)

Design

Provide two functions to support different use cases:

Function Use Case
boot_from_device_path() Simple case: pass any device path and boot. Expansion happens transparently.
expand_device_path() Advanced case: explicit control over expansion for caching, custom prioritization when multiple devices match, or pre-boot validation.

Rationale: Providing both functions ensures the library remains composable and future-proof. Most platforms just call boot_from_device_path() and it works transparently. Platforms needing explicit control can call expand_device_path() directly.

// Simple: just boot, expansion handled internally
boot_from_device_path(&partial_path)?;

// Advanced: expand first for caching/custom logic, then boot
let full_path = expand_device_path(&partial_path)?;
boot_from_device_path(&full_path)?;

Related

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions