3 Commits
Author SHA1 Message Date
Anees Iqbal 5ca3b10683 🔥 Drop ReimsVgpu.kext, which served apple-gfx alone
reims-vgpu deletes apple-gfx, Apple's paravirtualized GPU (owner, 2026-11-07).
ReimsVgpu.kext, the Lilu plugin images loaded on macOS 26, patched macOS's own
driver for that device: the interface version its x86-64 build asks for, and
what the driver and its Metal plugin hardcode. With the device gone, no guest
needs it.

- kext/ goes: the built kext the binary embedded, its sources, Makefile and
  sources.sha256, the tests that checked them, and probes/features.m, a guest
  probe of Metal's answers that came with the kext and that nothing here runs.
- Of reims-util's own kexts, images carry Lilu alone, first in Kernel > Add on
  Darwin 25.0.0 to 25.99.99 as before; kexts given with --add-kext load after
  it, and opencore's done result lists the kexts without ReimsVgpu.kext.
- --no-kexts stays, and now leaves out Lilu alone: the image then carries only
  the kexts --add-kext gives, a Lilu of one's own among them, or none.
- LICENSES/BSD-3-Clause-Lilu.txt goes with the only Lilu code the repository
  held, the plugin_start.cpp linked into the built kext. Lilu's release, which
  images carry, keeps its own license, as before.
- README.md, LICENSE and the help of --no-kexts and --add-kext lose the
  kext's account.

Checked on homelab-gem10-1 (potluck job m3-max-5842): cargo fmt --check, cargo
clippy --all-targets -D warnings, and cargo test (46 pass: the 48 before, less
the kext's two).
2026-11-07 17:02:20 -08:00
Anees Iqbal 5405b2d13b 🆕 Put a guest kext for reims-vgpu's GPU in the OpenCore image
x86-64 macOS guests drive reims-vgpu's GPU through AppleParavirtGPU.kext,
whose setupVersion asks for binary version 6 and turns every later feature
off; arm64 guests ask for 245. ReimsVgpu.kext (kext/), a Lilu plugin,
routes setupVersion to ask for 245 and set its features, and leaves the
driver's own negotiation to a host that does not store it. It also patches
what the x86-64 driver and its Metal plugin hardcode where arm64's ask the
device:

- AppleParavirtResourceHeap::addObject adds a two-plane D32S8 or X32S8
  texture as type 12, as arm64 does, not as type 2, which the host reads as
  one plane and faults on.
- -[AppleParavirtDevice featureProfile] returns 10001, not 10000, adding
  the Mac2 and Common3 families that ANGLE's Metal backend, so
  GPU-accelerated Chrome, needs.
- -[AppleParavirtTexture initTiledWithBuffer:...] no longer refuses
  SkyLight's tiles of a window wider than 2048 px, whose real bytes fit;
  the host accepts them from their real footprint (reims-vgpu's fdf661fee).

The plugin's bytes are patched through UserPatch, since Lilu's own user
patcher is off from macOS 11: it routes _cs_validate_page and rewrites a
page after the kernel has validated its pristine bytes, so code signing
does not notice and no other binary is touched.

The image carries the kext with Lilu 1.7.2's RELEASE build, pinned by
SHA-256 and cached like OpenCore, and loads both on macOS 26 alone (Darwin
25), so every other macOS boots with no kexts, as before. --no-kexts leaves
them out.

A kext builds on a Mac alone, and reims-util builds anywhere, so the built
kext is kept in the repository at kext/ReimsVgpu.kext and included in the
binary. kext/Makefile writes it there, against a DEBUG Lilu.kext and
MacKernelSDK, with the build date Lilu's plugin_start.cpp stamps pinned so
the same sources build the same bytes, and writes kext/sources.sha256,
which a test checks the sources against. The built kext holds Lilu's
plugin_start.cpp, so Lilu's BSD-3-Clause license is kept beside ours.
kext/probes/features.m prints what Metal's device answers in a guest.

Moved from reims-vgpu, where it was ec923f9f9, 4a4a882fb and 2e564d3f8 on
steelbrain/x86-metal-lilu.

Checked on msi-laptop (RTX 5080, macOS 26.6.1 guest): the host stores 245
and the desktop comes up; chrome://gpu reports hardware acceleration; a
clear to a D32S8 target that faulted the host completes. ocvalidate
(OpenCore 1.0.8) finds no issues in the image's config.plist, and the
kexts in the image match the built kext and Lilu's release byte for byte.
Not yet booted from a reims-util image.
2026-10-13 19:10:51 +03:00
Anees Iqbal 2686f02b38 🆕 Make OpenCore images and macOS installers for x86-64 VMs
reims-ctl and its docs send people to OSX-KVM or ULTMOS for two things: an
OpenCore boot image with OVMF, and a way to install macOS. This does both in
one program with no other tools to install, on Linux and macOS, so reims-ctl
can point at it instead. Each job writes one file that reims-ctl takes as it
is.

- opencore: a 128 MiB GPT disk (qcow2 or raw) whose FAT32 EFI partition holds
  OpenCore 1.0.8 with a config.plist made from the release's Sample.plist for
  a q35 VM on KVM (no kexts, one SSDT for EC and USBX, a fresh SMBIOS
  identity), plus OVMF from a pinned Arch edk2-ovmf package. Both downloads
  are pinned by SHA-256 and cached.
- online-installer VERSION: Apple's recovery image for High Sierra to Tahoe,
  as macOS-<name>-online-installer.dmg, checked chunk by chunk against its
  chunklist, whose RSA signature must be Apple's, since both come over plain
  HTTP. It installs the newest release of its macOS over the network.
- offline-installer VERSION: one exact release of macOS 11 to 26 for Intel
  Macs, from the software update catalog, as one raw GPT disk,
  macOS-<name>-<version>-<build>-offline-installer.img:
  - FAT32 RECOVERY: com.apple.recovery.boot/BaseSystem.dmg and its chunklist,
    which OpenCore boots, checking Apple's signature, as from a USB stick;
  - exFAT Installer: InstallAssistant.pkg (12 to 18 GB, past FAT32's 4 GiB
    limit), checked against its chunklist and the catalog's digest of its
    table of contents, and install-macos.sh, run from Recovery's Terminal.

The script installs the package onto the erased disk and starts the app's
startosinstall. The package's postinstall writes to $3Applications, which
for a volume lands beside it on Recovery's RAM disk, so a link sends it onto
the volume; it also sets CM_BUILD and fixes the app's modes, as mist-cli does.

Both of the offline installer's files are downloaded straight into their
places in the image, so the package is never on disk twice. A disk is built
as byte ranges, with a reserved place for each download, and the package's
volume first so its place stays put when Apple's recovery image changes size.
The FAT32, exFAT and GPT writers are our own (fatfs made volumes macOS's
fsck_msdos rejected); fsck_exfat and fsck_msdos pass the volumes. An image
already there is checked read-only, since a VM may be running from it, kept
when its package checks out, and repaired otherwise.

Downloads resume from a .part file (or the image's place) after checking what
is already there against Apple's chunklists, and carry on through slow or
dropped connections. The same jobs run from a small inline terminal
interface, from subcommands, and with --json for scripts.

Licensed GPL-2.0-or-later OR LGPL-3.0-or-later, as reims-vgpu is. The serial
number tables come from OpenCorePkg's macserial, so its BSD-3-Clause license
is kept beside ours for that file.
2026-10-12 17:57:06 +03:00