Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ Every change is a commit on top of the official base (`git log ebea824..main`).
- `DrogaBox/Theme/AETHER`: GoldenGate icons plus my background. `build_oc.tool` puts it in the zip under
`Resources/Image/DrogaBox/AETHER`.
- `Docs/Configuration.tex`: `AllowPickerEdit`, the editor, bit `0x0400` and AETHER with `Auto`.
- `DrogaBox/hfsplus.sh`: the zip carries Apple's `HfsPlus.efi`, which `Sample.plist` already loads and
OpenCore's docs recommend. It's downloaded from OcBinaryData at a fixed commit and its sha256 checked,
never kept in this repo. `OpenHfsPlus.efi` stays in the zip too. Stock zips only have `OpenHfsPlus.efi`,
and on a Z790 board it froze the machine before the picker, keyboard dead; `HfsPlus.efi` booted fine.

**Tests and tools**
- `Utilities/TestCanopy` (new): runs the real OpenCanopy on a Mac with a fake 1920×1080 screen and
Expand Down Expand Up @@ -142,6 +146,8 @@ usual way.
`OC/Resources/Image/DrogaBox` and set `PickerMode` to `External`. The zip has no font, same as stock
OpenCore: OpenCanopy needs `Resources/Font` from [OcBinaryData](https://github.com/acidanthera/OcBinaryData),
so copy it if you don't have it yet.
If your config loads `OpenHfsPlus.efi` under `UEFI > Drivers`, copy `OC/Drivers/HfsPlus.efi` from the
zip and change that entry's `Path` to `HfsPlus.efi`, the way `Docs/Sample.plist` has it.
4. In `config.plist`, under `Misc > Security`, add:
```xml
<key>AllowPickerEdit</key>
Expand Down Expand Up @@ -171,6 +177,11 @@ ARCHS=X64 TARGETS=RELEASE,DEBUG TOOLCHAINS=XCODE5 ./build_oc.tool

The zips end up in `Binaries/`. The first run downloads the UDK into `UDK/`.

Packaging downloads Apple's `HfsPlus.efi` from OcBinaryData (see `DrogaBox/hfsplus.sh` for the commit and
sha256). Offline, point `HFSPLUS_DIR` at a copy of OcBinaryData's `Drivers` folder. If neither works, the
build says `FALLING BACK TO OpenHfsPlus.efi`: that zip has no `HfsPlus.efi` and its sample configs load
`OpenHfsPlus.efi` instead. `REQUIRE_HFSPLUS=1` makes that an error, which is how releases are built.

Tests (the editor, the plist writer, and the picker and sheet drawn on the host, plain and with
ASan/UBSan):

Expand Down
8 changes: 8 additions & 0 deletions DrogaBox/BASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pinned_on: 2026-11-24
| `EDITOR.md` | The user guide of the `F2` editor |
| `screenshots/` | Images for the README and the guide |
| `Theme/AETHER` | The default theme, packaged into the zip (see `Theme/README.md`) |
| `hfsplus.sh` | Puts Apple's `HfsPlus.efi` in the zip, from OcBinaryData at a fixed commit with its sha256 checked; falls back to `OpenHfsPlus.efi` |
| `tools/` | `render-screen.swift` (text console to PNG) and `banner.swift` (README banner) |

## Moving to a newer official commit
Expand Down Expand Up @@ -69,6 +70,13 @@ ARCHS=X64 TARGETS=RELEASE,DEBUG TOOLCHAINS=XCODE5 ./build_oc.tool

`build_oc.tool` downloads the UDK into `UDK/`, which git ignores.

It also downloads Apple's `HfsPlus.efi` (X64) and `HfsPlus32.efi` (packaged as `HfsPlus.efi` for IA32)
from OcBinaryData at `DB_HFSPLUS_COMMIT` in `hfsplus.sh` and checks their sha256. Offline, set
`HFSPLUS_DIR=/path/to/OcBinaryData/Drivers`. Without either, the zip keeps only `OpenHfsPlus.efi`, its
`Docs/Sample*.plist` are switched to it, and the build prints `FALLING BACK TO OpenHfsPlus.efi`. Build
releases with `REQUIRE_HFSPLUS=1`, which stops instead. To move to a newer OcBinaryData, change the commit
and both hashes together.

## Versions

Our version is the OpenCore base plus our number, for example `1.0.9-db.1`. It goes in tags and release
Expand Down
117 changes: 117 additions & 0 deletions DrogaBox/hfsplus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/bash
#
# Apple's HFS+ driver in the zip. build_oc.tool sources this file and calls db_hfsplus_package.
#
# Docs/Sample.plist loads HfsPlus.efi, and OpenCore's docs recommend Apple's driver, but the
# official zip only carries OpenHfsPlus.efi, because Apple's binary can't be shipped in
# OpenCorePkg. On a Z790 board OpenHfsPlus.efi froze the machine before the picker, with the
# keyboard dead, and Apple's HfsPlus.efi fixed it (2026-11-25).
#
# So the zip gets HfsPlus.efi from OcBinaryData at a pinned commit, with its sha256 checked. The
# binary is never committed here. If it can't be had, the zip keeps only OpenHfsPlus.efi, its
# sample configs are switched to it so they still match the zip, and the build says so.
# OpenHfsPlus.efi stays in the zip either way.
#
# HFSPLUS_DIR=/path/to/OcBinaryData/Drivers take the files from there instead of downloading
# (same sha256 check)
# REQUIRE_HFSPLUS=1 stop the build instead of falling back (releases)
#

DB_HFSPLUS_COMMIT=c2a98980d30e39a571a2843ab26aa8d2b9188094
DB_HFSPLUS_URL="https://raw.githubusercontent.com/acidanthera/OcBinaryData/${DB_HFSPLUS_COMMIT}/Drivers"

# Prints "<file in OcBinaryData/Drivers> <sha256>" for an arch.
db_hfsplus_source() {
case "$1" in
X64) echo "HfsPlus.efi a55b5fff36578864ba6792c4c6369c71f6f35b61dd5a853ddf8583cd36c31d8f" ;;
IA32) echo "HfsPlus32.efi 40badc5338e4cb373ed8370aba52bad9668f1970c68f546b9cba46ed55153d18" ;;
*) return 1 ;;
esac
}

db_sha256() {
if command -v shasum >/dev/null 2>&1; then
shasum -a 256 "$1" | cut -d ' ' -f 1
else
sha256sum "$1" | cut -d ' ' -f 1
fi
}

# db_hfsplus_fetch <tmpdir> <arch>...: puts <tmpdir>/<arch>.efi for every arch, checked.
db_hfsplus_fetch() {
local tmp="$1"
shift
local arch src name sha got
for arch in "$@"; do
src=$(db_hfsplus_source "$arch") || {
echo "HfsPlus.efi: OcBinaryData has no Apple driver for ${arch}"
return 1
}
read -r name sha <<<"$src"
if [ -n "${HFSPLUS_DIR}" ]; then
cp "${HFSPLUS_DIR}/${name}" "${tmp}/${arch}.efi" || {
echo "HfsPlus.efi: cannot read ${HFSPLUS_DIR}/${name}"
return 1
}
else
curl -LfsS --retry 2 --connect-timeout 20 -o "${tmp}/${arch}.efi" "${DB_HFSPLUS_URL}/${name}" || {
echo "HfsPlus.efi: cannot download ${DB_HFSPLUS_URL}/${name}"
return 1
}
fi
got=$(db_sha256 "${tmp}/${arch}.efi")
if [ "$got" != "$sha" ]; then
echo "HfsPlus.efi: ${name} for ${arch} has sha256 ${got}, expected ${sha}"
return 1
fi
done
return 0
}

# db_hfsplus_package <package dir> <arch>...: call once the drivers and Docs are in the package dir.
db_hfsplus_package() {
local dst="$1"
shift
local tmp arch plist n ok=1

tmp=$(mktemp -d) || return 1
if db_hfsplus_fetch "$tmp" "$@"; then
for arch in "$@"; do
cp "${tmp}/${arch}.efi" "${dst}/${arch}/EFI/OC/Drivers/HfsPlus.efi" || ok=0
done
else
ok=0
fi
rm -rf "$tmp"

if [ "$ok" = "1" ]; then
echo "HfsPlus.efi: Apple's driver from OcBinaryData ${DB_HFSPLUS_COMMIT:0:12} (sha256 checked) is in the zip;" \
"OpenHfsPlus.efi stays as the fallback"
return 0
fi

for arch in "$@"; do
rm -f "${dst}/${arch}/EFI/OC/Drivers/HfsPlus.efi"
done

if [ "${REQUIRE_HFSPLUS}" = "1" ]; then
echo "ERROR: Apple's HfsPlus.efi is not available and REQUIRE_HFSPLUS=1"
return 1
fi

for plist in "${dst}/Docs/Sample.plist" "${dst}/Docs/SampleCustom.plist"; do
n=$(grep -c '<string>HfsPlus.efi</string>' "$plist")
if [ "$n" != "1" ]; then
echo "ERROR: expected one HfsPlus.efi driver entry in ${plist##*/}, found ${n}"
return 1
fi
sed 's|<string>HfsPlus.efi</string>|<string>OpenHfsPlus.efi</string>|' "$plist" > "${plist}.tmp" || return 1
mv "${plist}.tmp" "$plist" || return 1
done

echo "WARNING: FALLING BACK TO OpenHfsPlus.efi. Apple's HfsPlus.efi is NOT in this zip, and the zip's"
echo "WARNING: Docs/Sample.plist and SampleCustom.plist now load OpenHfsPlus.efi instead. OpenHfsPlus.efi"
echo "WARNING: froze at least one machine before the picker. Rebuild with network access, or with"
echo "WARNING: HFSPLUS_DIR=/path/to/OcBinaryData/Drivers, before handing this zip to anyone."
return 0
}
5 changes: 5 additions & 0 deletions build_oc.tool
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ package() {
cp "${selfdir}/Docs/${doc}" "${dstdir}/Docs"/ || exit 1
done
cp "${selfdir}/Changelog.md" "${dstdir}/Docs"/ || exit 1

# Apple's HfsPlus.efi from OcBinaryData, or OpenHfsPlus.efi as the fallback (DrogaBox/hfsplus.sh).
# shellcheck source=DrogaBox/hfsplus.sh
source "${selfdir}/DrogaBox/hfsplus.sh" || exit 1
db_hfsplus_package "${dstdir}" "${ARCHS[@]}" || exit 1
cp -r "${selfdir}/Docs/AcpiSamples/"* "${dstdir}/Docs/AcpiSamples"/ || exit 1

mkdir -p "${dstdir}/Docs/AcpiSamples/Binaries" || exit 1
Expand Down
Loading