🆕 Give OpenCore's picker icons and a boot chime

The image booted to OpenCore's text list. It now loads OpenCanopy with
OcBinaryData's GoldenGate icons, and AudioDxe, which plays OpenCore's boot
chime on the first Intel HDA controller it finds (none: no chime). The chime
follows macOS's "Play sound on startup" (StartupMute).

OcBinaryData has no releases, so the image takes GitHub's archive of one
commit, pinned to its SHA-256 and cached like the OpenCore release; only the
fonts, labels, the GoldenGate icons and the chime go in the image.
--text-picker, and the form's "Graphical picker" toggle, keep the text list.

Checked on QEMU (TCG, q35, OVMF): the picker draws, takes the keyboard (the
VM's tablet is no pointer OpenCore reads), and an ich9-intel-hda with an
hda-output codec, sharing its audiodev with usb-audio, plays the 2.5 s chime.
This commit is contained in:
Anees Iqbal committed 2026-10-12 23:55:49 +03:00
1 parent 2686f02b38
commit 5216d98427
6 files changed
+173 -24

No files matched your search

+11 -4
View File
@@ -62,9 +62,10 @@ reims-util opencore -o OpenCore.qcow2
This writes a 128 MiB disk image with OpenCore 1.0.8 on its EFI partition: qcow2 for a `.qcow2`
name, and a raw disk image for anything else (`.img`). Beside it go `OVMF_CODE.fd` and
`OVMF_VARS.fd`, with OVMF's licenses. Both are downloaded from pinned releases (OpenCore's from
GitHub, OVMF from Arch Linux's `edk2-ovmf` package), checked against the hashes reims-util knows,
and cached in `~/.cache/reims-util`, so they're only downloaded once.
`OVMF_VARS.fd`, with OVMF's licenses. What goes in them is downloaded from pinned sources
(OpenCore's release and a commit of its picker icons and boot chime, OcBinaryData, from GitHub;
OVMF from Arch Linux's `edk2-ovmf` package), checked against the hashes reims-util knows, and
cached in `~/.cache/reims-util`, so it's only downloaded once.
Each image gets a Mac identity of its own: a serial number, logic board serial (MLB), system UUID
and ROM, which it prints when it's done. Keep them if you'll want the same identity in another
@@ -82,6 +83,11 @@ What's in the image, and why:
with its own driver.
- **The drivers a VM boots with**: OpenRuntime, OpenHfsPlus (recovery images and installers are
HFS+), OpenPartitionDxe (for older recovery images) and ResetNvramEntry.
- **The graphical picker**, OpenCanopy, with the GoldenGate icons. Pick with the arrow keys, Tab
and Enter; it has no mouse pointer in a VM. `--text-picker` gives OpenCore's text list instead.
- **The boot chime**, which plays on the VM's Intel HD Audio controller when it has one (QEMU's
`ich9-intel-hda` with an `hda-output` codec). Turning off "Play sound on startup" in macOS's
Sound settings silences it.
- **One ACPI table**, with the `EC` and `USBX` devices macOS looks for.
- **The CPU reported as a Skylake-SP**, which every macOS from 10.13 to 26 knows, whatever CPU
model the VM has. `--no-cpuid-spoof` turns that off.
@@ -166,4 +172,5 @@ reims-util --json online-installer tahoe -o ~/vms/mac
reims-util is licensed under GPL-2.0-or-later OR LGPL-3.0-or-later; see [LICENSE](LICENSE). The
serial number tables come from OpenCorePkg's macserial, under its BSD-3-Clause license.
OpenCore and OVMF, which reims-util downloads, keep their own licenses.
OpenCore, its picker icons and chime (OcBinaryData) and OVMF, which reims-util downloads, keep
their own licenses.
+2 -2
View File
@@ -1,5 +1,5 @@
//! Files fetched once and kept: the OpenCore release and the OVMF package, each pinned to its
//! SHA-256, under `$XDG_CACHE_HOME/reims-util` (`~/.cache/reims-util`).
//! Files fetched once and kept: the OpenCore release, OcBinaryData and the OVMF package, each
//! pinned to its SHA-256, under `$XDG_CACHE_HOME/reims-util` (`~/.cache/reims-util`).
use crate::http::{self, Dest, Download, NoCheck};
use crate::progress::Reporter;
+4
View File
@@ -101,6 +101,9 @@ pub struct OpencoreArgs {
/// Let macOS see that it runs in a VM (iCloud and the App Store then refuse to sign in)
#[arg(long)]
pub show_vm: bool,
/// Use OpenCore's text picker instead of the graphical one
#[arg(long)]
pub text_picker: bool,
/// Write no OVMF files
#[arg(long)]
pub no_ovmf: bool,
@@ -334,6 +337,7 @@ pub fn opencore_options(a: &OpencoreArgs) -> Result<opencore::Options> {
sip: !a.disable_sip,
cpuid_spoof: !a.no_cpuid_spoof,
hide_vm: !a.show_vm,
graphical_picker: !a.text_picker,
},
ovmf_dir,
})
+39 -12
View File
@@ -7,6 +7,10 @@
//! power management, USB port maps, Intel graphics) are left out:
//! - the drivers a VM boots with: OpenRuntime, OpenHfsPlus (recovery images and installers are
//! HFS+), OpenPartitionDxe (older recovery images' Apple partition maps) and ResetNvramEntry;
//! - the graphical picker, OpenCanopy, with the `Acidanthera\GoldenGate` icons (or the text
//! picker, when asked for);
//! - the boot chime, which AudioDxe plays on the first Intel HDA controller and codec it finds,
//! when the VM has one, unless macOS's "Play sound on startup" is off (`StartupMute`);
//! - no kexts: QEMU's `isa-applesmc` is the SMC, and the GPU is reims-vgpu's, which macOS drives
//! with its own driver;
//! - one ACPI table, the `EC` and `USBX` devices macOS looks for (acpi.rs);
@@ -22,13 +26,22 @@ use super::smbios::Smbios;
use anyhow::{Context, Result, bail};
use plist::{Dictionary, Value};
/// The graphical picker's icon set, under `EFI\OC\Resources\Image`.
pub const PICKER_VARIANT: &str = "Acidanthera\\GoldenGate";
/// The drivers the image carries and loads, in order.
pub const DRIVERS: &[&str] = &[
"OpenRuntime.efi",
"OpenHfsPlus.efi",
"OpenPartitionDxe.efi",
"ResetNvramEntry.efi",
];
pub fn drivers(o: &Options) -> Vec<&'static str> {
let mut d = vec!["OpenRuntime.efi", "OpenHfsPlus.efi"];
if o.graphical_picker {
d.push("OpenCanopy.efi");
}
d.extend([
"AudioDxe.efi",
"OpenPartitionDxe.efi",
"ResetNvramEntry.efi",
]);
d
}
/// Arguments for every boot: kernel symbols in panic logs, and no panics on a TLB shootdown or a
/// timeout a vCPU took because the host descheduled it.
@@ -48,6 +61,8 @@ pub struct Options {
pub sip: bool,
pub cpuid_spoof: bool,
pub hide_vm: bool,
/// OpenCanopy's graphical picker, or OpenCore's text one.
pub graphical_picker: bool,
}
pub fn make(sample: &[u8], o: &Options) -> Result<Vec<u8>> {
@@ -161,7 +176,13 @@ pub fn make(sample: &[u8], o: &Options) -> Result<Vec<u8>> {
set(c, &["Kernel", "Quirks"], "SetApfsTrimTimeout", 0.into())?;
set(c, &["Misc", "Boot"], "HideAuxiliary", false.into())?;
set(c, &["Misc", "Boot"], "PickerMode", "Builtin".into())?;
let mode = if o.graphical_picker {
"External"
} else {
"Builtin"
};
set(c, &["Misc", "Boot"], "PickerMode", mode.into())?;
set(c, &["Misc", "Boot"], "PickerVariant", PICKER_VARIANT.into())?;
set(c, &["Misc", "Boot"], "PollAppleHotKeys", true.into())?;
set(c, &["Misc", "Boot"], "ShowPicker", true.into())?;
set(c, &["Misc", "Boot"], "Timeout", (o.timeout as i64).into())?;
@@ -210,13 +231,19 @@ pub fn make(sample: &[u8], o: &Options) -> Result<Vec<u8>> {
set(c, &["UEFI", "APFS"], "MinDate", (-1i64).into())?;
set(c, &["UEFI", "APFS"], "MinVersion", (-1i64).into())?;
// The chime: an empty device path is the first HDA controller and codec AudioDxe finds, and a
// mask of -1 every output of that codec. Auto stays silent when `StartupMute` is set.
set(c, &["UEFI", "Audio"], "AudioSupport", true.into())?;
set(c, &["UEFI", "Audio"], "AudioDevice", "".into())?;
set(c, &["UEFI", "Audio"], "AudioOutMask", (-1i64).into())?;
set(c, &["UEFI", "Audio"], "PlayChime", "Auto".into())?;
set(c, &["UEFI", "Output"], "Resolution", "".into())?;
let sample_drivers: Vec<Value> = match dict(c, &["UEFI"])?.get("Drivers") {
Some(Value::Array(a)) => a.clone(),
_ => bail!("Sample.plist has no UEFI > Drivers"),
};
let mut drivers = Vec::new();
for name in DRIVERS {
let mut entries = Vec::new();
for name in drivers(o) {
let mut e = sample_drivers
.iter()
.filter_map(Value::as_dictionary)
@@ -229,13 +256,13 @@ pub fn make(sample: &[u8], o: &Options) -> Result<Vec<u8>> {
.cloned()
})
.context("Sample.plist lists no drivers")?;
e.insert("Path".into(), (*name).into());
e.insert("Path".into(), name.into());
e.insert("Arguments".into(), "".into());
e.insert("Enabled".into(), true.into());
e.insert("LoadEarly".into(), false.into());
drivers.push(Value::Dictionary(e));
entries.push(Value::Dictionary(e));
}
set(c, &["UEFI"], "Drivers", Value::Array(drivers))?;
set(c, &["UEFI"], "Drivers", Value::Array(entries))?;
set(c, &["UEFI"], "ReservedMemory", Value::Array(vec![]))?;
let mut out = Vec::new();
+111 -6
View File
@@ -1,7 +1,8 @@
//! The OpenCore boot image: a 128 MiB GPT disk whose EFI system partition holds a pinned
//! OpenCore release, the drivers and ACPI table a VM needs, and a `config.plist` made for a q35
//! VM (config.rs) with an SMBIOS identity of its own (smbios.rs). OVMF goes beside it (ovmf.rs),
//! where reims-ctl looks for it.
//! OpenCore release, the drivers and ACPI table a VM needs, the picker's icons and the boot chime
//! from a pinned commit of OcBinaryData, and a `config.plist` made for a q35 VM (config.rs) with
//! an SMBIOS identity of its own (smbios.rs). OVMF goes beside it (ovmf.rs), where reims-ctl looks
//! for it.
pub mod acpi;
pub mod config;
@@ -10,7 +11,7 @@ pub mod smbios;
use crate::cache::{self, Pinned};
use crate::image::{self, Data, Format};
use crate::progress::{self, Reporter};
use anyhow::{Context, Result};
use anyhow::{Context, Result, bail};
use std::io::Read;
use std::path::{Path, PathBuf};
@@ -23,6 +24,20 @@ const RELEASE: Pinned = Pinned {
what: "OpenCore 1.0.8",
};
/// OcBinaryData, which has no releases: GitHub's archive of a commit.
const RESOURCES: Pinned = Pinned {
name: "OcBinaryData-32500d5e3313f11cad00351ba1c6f9a4aa6cb0f7.zip",
url: "https://github.com/acidanthera/OcBinaryData/archive/32500d5e3313f11cad00351ba1c6f9a4aa6cb0f7.zip",
sha256: "1ced15b42352a3a6c1b76ca95951f337fa79899acfb4ed80f329191716623741",
what: "OpenCore's picker icons and boot chime",
};
/// The archive's folder that `EFI/OC/Resources` takes from.
const RESOURCES_ROOT: &str = "OcBinaryData-32500d5e3313f11cad00351ba1c6f9a4aa6cb0f7/Resources/";
/// The boot chime, the image's only sound.
const CHIME: &str = "Audio/OCEFIAudio_VoiceOver_Boot.mp3";
/// The image's size: room for OpenCore (about 2 MiB of it here) and for what a person may add.
const DISK_SIZE: u64 = 128 << 20;
@@ -46,8 +61,11 @@ pub struct Outputs {
pub fn build(o: &Options, r: &dyn Reporter) -> Result<Outputs> {
let zip_path = cache::fetch(&RELEASE, r)?;
progress::check(r)?;
let resources_path = cache::fetch(&RESOURCES, r)?;
progress::check(r)?;
r.step(&format!("Building the OpenCore {VERSION} image"));
let files = files(&zip_path, &o.config)?;
let mut files = files(&zip_path, &o.config)?;
files.extend(resources(&resources_path, o.config.graphical_picker)?);
let files: Vec<(String, Data)> = files
.into_iter()
.map(|(p, d)| (p, Data::Bytes(d)))
@@ -102,7 +120,7 @@ fn files(zip_path: &Path, c: &config::Options) -> Result<Vec<(String, Vec<u8>)>>
] {
files.push((p.to_string(), read(&format!("X64/{p}"))?));
}
for d in config::DRIVERS {
for d in config::drivers(c) {
files.push((
format!("EFI/OC/Drivers/{d}"),
read(&format!("X64/EFI/OC/Drivers/{d}"))?,
@@ -120,3 +138,90 @@ fn files(zip_path: &Path, c: &config::Options) -> Result<Vec<(String, Vec<u8>)>>
}
Ok(files)
}
/// The resources the image carries, from OcBinaryData's archive.
fn resources(zip_path: &Path, graphical: bool) -> Result<Vec<(String, Vec<u8>)>> {
let f =
std::fs::File::open(zip_path).with_context(|| format!("open {}", zip_path.display()))?;
let mut zip = zip::ZipArchive::new(f).context("read OcBinaryData's archive")?;
let mut files = Vec::new();
for i in 0..zip.len() {
let mut e = zip.by_index(i)?;
let name = e
.name()
.context("read OcBinaryData's archive")?
.into_owned();
let Some(path) = resource_path(&name, graphical) else {
continue;
};
let mut v = Vec::new();
e.read_to_end(&mut v)
.with_context(|| format!("read {name} from OcBinaryData's archive"))?;
files.push((path, v));
}
let chime = format!("EFI/OC/Resources/{CHIME}");
if !files.iter().any(|(p, _)| *p == chime) {
bail!("OcBinaryData's archive has no {CHIME}");
}
Ok(files)
}
/// Where the archive's entry `name` goes in the image, if it goes there: the chime, and for the
/// graphical picker its fonts, labels and icon set.
fn resource_path(name: &str, graphical: bool) -> Option<String> {
let rel = name.strip_prefix(RESOURCES_ROOT)?;
if rel.is_empty() || rel.ends_with('/') {
return None;
}
let icons = format!("Image/{}/", config::PICKER_VARIANT.replace('\\', "/"));
let take = rel == CHIME
|| (graphical
&& (rel.starts_with("Font/") || rel.starts_with("Label/") || rel.starts_with(&icons)));
take.then(|| format!("EFI/OC/Resources/{rel}"))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn resources_taken() {
let at = |rel: &str| format!("{RESOURCES_ROOT}{rel}");
let image = |rel: &str| Some(format!("EFI/OC/Resources/{rel}"));
for rel in [
CHIME,
"Font/Font_1x.png",
"Label/EFIBoot.lbl",
"Image/Acidanthera/GoldenGate/HardDrive.icns",
] {
assert_eq!(resource_path(&at(rel), true), image(rel), "{rel}");
}
assert_eq!(resource_path(&at(CHIME), false), image(CHIME));
for rel in [
"Font/Font_1x.png",
"Label/EFIBoot.lbl",
"Image/Acidanthera/GoldenGate/HardDrive.icns",
] {
assert_eq!(resource_path(&at(rel), false), None, "{rel}");
}
for rel in [
"",
"Image/Acidanthera/GoldenGate/",
"Image/Acidanthera/Syrah/HardDrive.icns",
"Audio/OCEFIAudio_en_Picker.mp3",
] {
assert_eq!(resource_path(&at(rel), true), None, "{rel}");
}
assert_eq!(
resource_path("OcBinaryData-0/Resources/Font/Font_1x.png", true),
None
);
assert_eq!(
resource_path(
&RESOURCES_ROOT.replace("Resources/", "Drivers/HfsPlus.efi"),
true
),
None
);
}
}
+6
View File
@@ -270,6 +270,7 @@ impl App {
disable_sip: !form.toggle(4),
no_cpuid_spoof: false,
show_vm: !form.toggle(5),
text_picker: !form.toggle(7),
no_ovmf: !form.toggle(3),
ovmf_dir: None,
};
@@ -657,6 +658,11 @@ fn opencore_form() -> Form {
.into(),
kind: Kind::Toggle(false),
},
Field {
label: "Graphical picker",
help: "OpenCore's boot picker with icons, or its text list when off.".into(),
kind: Kind::Toggle(true),
},
],
}
}