Skip to content

Conversation

@hnanoto
Copy link
Contributor

@hnanoto hnanoto commented Jan 8, 2026

Summary

This PR introduces native support for booting macOS Recovery directly from BaseSystem.dmg located in the com.apple.recovery.boot directory, similar to the method used by OpenCore. This feature eliminates the need to restore the DMG to a dedicated HFS+ partition, simplifying the creation of USB installers and recovery drives, especially for users creating media from Windows/Linux.

Changes

  • rEFIt_UEFI/entry_scan/loader.cpp:

    • Added detection logic for BaseSystem.dmg within \com.apple.recovery.boot\.
    • Implemented automatic injection of the root-dmg boot argument (e.g., root-dmg=file:///com.apple.recovery.boot/BaseSystem.dmg) for these specific entries. This ensures the kernel correctly mounts the DMG as the root device during boot.
    • Created a new boot menu entry type "Recovery DMG" distinct from the legacy boot.efi recovery.
  • rEFIt_UEFI/Platform/Hibernate.h:

    • Added a forward declaration for class LOADER_ENTRY to resolve a circular dependency issue encountered during compilation with newer toolchains (e.g., Xcode 16 / GCC 15).

Motivation

Currently, Clover requires extracting the Recovery DMG content to a partition for it to be bootable. This enhancement modernizes Clover's capabilities by leveraging the existing OpenCore integration logic (already present in main.cpp via InternalLoadDmg) to support direct DMG loading.

Testing

  • Environment: Compiled with GCC 15.2.0.
  • Verification:
    • Successfully detected BaseSystem.dmg on a FAT32 partition.
    • Successfully booted macOS Recovery (tested with macOS 15/16 environments).
    • Verified that root-dmg argument is correctly passed to the kernel, resolving "Waiting for Root Device" errors without user intervention.
    • Verified normal boot functionality of installed macOS systems remains unaffected.

Notes

Code style follows existing project conventions.
This feature relies on the BaseSystem.chunklist file being present alongside the DMG, which is standard behavior for Apple's recovery images.

Contributed by @hnanoto

hnanoto added 30 commits May 28, 2025 20:02
hnanoto and others added 20 commits May 28, 2025 21:33
Fix directory handling in clone_OpenCorePkg
…os-scripts

Add shebang and error handling to test scripts
- Implements detection and boot entry creation for BaseSystem.dmg in com.apple.recovery.boot
- Automatically injects 'root-dmg' boot argument for Recovery DMG entries
- Fixes circular dependency in Hibernate.h with forward declaration
@SergeySlice SergeySlice merged commit 5cf9d82 into CloverHackyColor:master Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants