macOS: current Lilu/VirtualSMC/WhateverGreen/RestrictEvents, no isa-applesmc
The OSX-KVM ESP ships Lilu 1.6.8 / VirtualSMC 1.3.3 / WhateverGreen 1.6.7,
which disable themselves on macOS 26; Apple's SMC driver then runs on QEMU's
isa-applesmc stub and the restart path panics (SMCWDT smcWriteKey
kSMCBadCommand → nested panic after MACH Reboot). Overlay pinned current
releases (upstream.json opencore.kexts) and drop isa-applesmc: with the stub
present VirtualSMC steps aside ("multiple devices present"); alone it carries
the OSK and reboots work (PE restart test: 10 s, clean). RestrictEvents with
revpatch=memtab silences MacPro7,1's "Memory Modules Misconfigured".
- makeOpenCore: kext overlay + Kernel.Add entries for overlaid kexts,
--memory-mb (4 DIMMs), bootArgs default revpatch=memtab
- qemu.nix: deviceArgsFor { appleSmc } (default false); cli: --applesmc for
images built before this change
- vm-driver: reboot-death detection (reset 60 s after a guest reboot request
that never comes back), panics wait for XNU's own auto-reboot, debug dir
works across nixbld users
- generalize: QEMU USB keyboard declared ANSI (no Keyboard Setup Assistant)
- README: architecture, reliability handling, debugging
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsESshRCoBoUVWV9qKURUF
This commit is contained in:
parent
8dc8f4265d
commit
22daf7720c
8 changed files with 97 additions and 15 deletions
|
|
@ -13,7 +13,7 @@
|
|||
uuid,
|
||||
serial ? null,
|
||||
mlb ? null,
|
||||
bootArgs ? "keepsyms=1",
|
||||
bootArgs ? "keepsyms=1 revpatch=memtab",
|
||||
resolution ? "1024x768",
|
||||
showPicker ? true,
|
||||
pickerTimeout ? 2,
|
||||
|
|
@ -22,6 +22,12 @@
|
|||
}:
|
||||
let
|
||||
ocImage = pkgs.fetchurl { inherit (upstream.opencore.image) url sha256; name = "OSX-KVM-OpenCore.qcow2"; };
|
||||
# OSX-KVM's ESP ships Lilu 1.6.8 / VirtualSMC 1.3.3 / WhateverGreen 1.6.7, which
|
||||
# disable themselves on macOS 26 ("unsupported operating system"); without
|
||||
# VirtualSMC, macOS' restart path panics on QEMU's SMC stub. Overlay the
|
||||
# current releases (upstream.opencore.kexts, pinned).
|
||||
kextZips = lib.mapAttrsToList (n: k: { name = n; zip = pkgs.fetchurl { inherit (k) url hash; }; })
|
||||
(upstream.opencore.kexts or {});
|
||||
in
|
||||
pkgs.runCommand "${name}-esp" {
|
||||
nativeBuildInputs = with pkgs; [ _7zz python3 mtools dosfstools gptfdisk jq macserial ];
|
||||
|
|
@ -45,13 +51,23 @@ pkgs.runCommand "${name}-esp" {
|
|||
mkdir -p $out/EFI/vmix
|
||||
cp -r esp/EFI/BOOT esp/EFI/OC $out/EFI/
|
||||
chmod -R u+w $out/EFI
|
||||
${lib.concatMapStringsSep "\n" (k: ''
|
||||
echo "=== vmix: updating ${k.name}.kext from ${k.zip.name} ==="
|
||||
rm -rf kext-${k.name}; mkdir kext-${k.name}
|
||||
${pkgs.unzip}/bin/unzip -q -o ${k.zip} -d kext-${k.name}
|
||||
K=$(find kext-${k.name} -type d -name "${k.name}.kext" | head -1)
|
||||
[ -n "$K" ] || { echo "${k.name}.kext not found in ${k.zip.name}"; exit 1; }
|
||||
rm -rf "$out/EFI/OC/Kexts/${k.name}.kext"
|
||||
cp -r "$K" "$out/EFI/OC/Kexts/${k.name}.kext"
|
||||
grep -A1 CFBundleVersion "$out/EFI/OC/Kexts/${k.name}.kext/Contents/Info.plist" | tail -1
|
||||
'') kextZips}
|
||||
# hide OpenCore's own launcher from its picker (otherwise it is the default entry and loops)
|
||||
echo -n Disabled > $out/EFI/BOOT/.contentVisibility
|
||||
python3 ${./oc-config.py} --base esp/EFI/OC/config.plist --esp esp --out $out/EFI/OC/config.plist \
|
||||
--model "${model}" --serial "$SERIAL" --mlb "$MLB" --uuid "${uuid}" --mac "${mac}" \
|
||||
--nic-path "${qemu.nicDevicePath}" --boot-args "${bootArgs}" --resolution "${resolution}" \
|
||||
--show-picker "${lib.boolToString showPicker}" --timeout ${toString pickerTimeout} \
|
||||
--extra-json ${lib.escapeShellArg (builtins.toJSON extraConfig)} --memory-mb ${toString memSize}
|
||||
--extra-json ${lib.escapeShellArg (builtins.toJSON extraConfig)} --memory-mb ${toString memSize} --add-kexts ${lib.concatStringsSep "," (map (k: k.name) kextZips)}
|
||||
ocvalidate $out/EFI/OC/config.plist || echo "vmix: ocvalidate reported issues (OpenCore version may differ from validator), continuing"
|
||||
|
||||
jq -n --arg model "${model}" --arg serial "$SERIAL" --arg mlb "$MLB" --arg uuid "${uuid}" --arg mac "${mac}" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue