Skip to content

Add Rust↔C interop demo: ODP_PatinaDebugLibDemo #88

@kat-perez

Description

@kat-perez

Description

Add a new demo driver under uefi/OdpPkg/Drivers/ that mirrors ODP_PatinaSmbiosDemo's structure but demonstrates Rust calling into a C UEFI library. The driver should be a Patina component that invokes a DebugLib library function (e.g. DEBUG((DEBUG_INFO, "...")) via FFI) to prove that code written in the Patina component model can transparently call into the existing EDK II C library ecosystem through the patina_tianocore bridge.

This complements ODP_PatinaSmbiosDemo (Patina-only, no C protocol/library calls) by showing the other half of the interop story: Rust drivers don't have to be hermetic — they can consume legacy C library APIs the same way C drivers do.

Scope

  • New crate uefi/OdpPkg/Drivers/ODP_PatinaDebugLibDemo/ with Cargo.toml, src/main.rs, src/platform.rs, README.md, .depex
  • A Patina #[component] that calls a DebugLib function via extern "C" FFI bindings
  • Build instructions + runtime verification on QEMU OVMF Q35 (same harness as ODP_PatinaSmbiosDemo)
  • README explaining the C-linkage story, the build wiring (LIB linkage in the .fdf FILE DRIVER block), and any caveats

Out of scope

  • Defining new DebugLib instances — use whatever DebugLib is already linked in the platform
  • Wiring into a Patina-native DXE core (separate follow-up; the C library call only makes sense on TianoCore)

Acceptance

  • Driver builds cleanly with cargo build --target x86_64-unknown-uefi --release
  • Boots on QEMU OVMF Q35 via the established harness, log shows the DebugLib output (e.g. via [INFO ] ConOut + COM1)
  • README documents the FFI binding pattern so future drivers can call other C libraries the same way

References

  • ODP_PatinaSmbiosDemo — sibling crate this should mirror in layout and build/test approach
  • patina_tianocore — bridge crate that already exposes the TianoCore boot services (Rust → C is just extern "C" over the C ABI)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions