Skip to content

Commit 9044efc

Browse files
committed
fix(dt_fixup): correctly patch arm-io/sep/iop-sep-nub/InvalidateHmac
This adds support for pre-SPTM macOS, tested on Macmini9,1 25G70. dt_fixup was inadvertently not patching InvalidateHmac, as InvalidateHmac is a node, not a prop. We need to patch InvalidateHmac to to pass invalidate_hmac in com.apple.kec.InvalidateHmac; this is required for booting pre-SPTM macOS. Introduce __contains__ method on ADTNode to check for the existence of child nodes and properly handle InvalidateHmac.
1 parent ca81f7e commit 9044efc

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,10 @@ If you've ever compiled Linux + busybox and booted in qemu (with `-kernel` and
9999
| M4 Mac Mini | `Mac16,10` | `t8132` |||
100100
| M3 Macbook Air | `Mac15,13` | `t8122` |||
101101
| M2 Mac Mini | `Mac14,3` | `t8112` |||
102-
| M1 Mac Mini | `Macmini9,1` | `t8103` |||
103-
102+
| M1 Mac Mini | `Macmini9,1` | `t8103` |||
104103

105104
✅ = boots to root shell and can run commands
106105

107-
❌ = panics before `launchd` / shell
108-
109106
Notes:
110107
- If you don't need MIE, use something without it, as emulating MIE can be slow.
111108
- Occasionally the system can randomly crash during early boot; if you see a
@@ -364,7 +361,7 @@ with `darwin-vm` too.
364361
To boot a `development` kernel, we need to create a new kernelcache combining
365362
the kernel we want to use plus all the kexts for the system we're targeting.
366363

367-
### 1. Select a Mac and macOS version. You need to know
364+
### 1. Select a Mac and macOS version. You need to know:
368365

369366
- The device name of the Mac you want to use (eg. `Mac16,10` is an M4 Mac Mini).
370367
- The exact macOS version number to target (eg. `25G70`).

dt_fixup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ def __getitem__(self, key):
2222
return c
2323
raise ValueError(f"key {key} not present in node {self.props['name']}")
2424

25+
def __contains__(self, key):
26+
return any(c.props['name'] == key for c in self.children)
27+
2528
def remove_child(self, child_name):
2629
for c in self.children:
2730
if c.props['name'] == child_name:
@@ -191,7 +194,7 @@ def fixup(d, nvram_file):
191194
d['chosen'].props['nvram-total-size'] = f"u32:{len(d['chosen'].props['nvram-proxy-data'])}"
192195
d['chosen'].props['nvram-bank-size'] = f"u32:{len(d['chosen'].props['nvram-proxy-data'])}"
193196

194-
if 'InvalidateHmac' in d['arm-io']['sep']['iop-sep-nub'].props:
197+
if 'InvalidateHmac' in d['arm-io']['sep']['iop-sep-nub']:
195198
d['arm-io']['sep']['iop-sep-nub']['InvalidateHmac'].props['config'] = "u32:1"
196199
d['arm-io']['sep']['iop-sep-nub']['InvalidateHmac'].props['sio-hmac1-offset'] = "u64:0"
197200
d['arm-io']['sep']['iop-sep-nub']['InvalidateHmac'].props['sio-hmac1-disable-mask'] = "u64:0xffffffffffffffff"

0 commit comments

Comments
 (0)