diff --git a/profiles/os/ipados-27.0.1-24A446/profile.toml b/profiles/os/ipados-27.0.1-24A446/profile.toml index 4dcaf41..a0a2561 100644 --- a/profiles/os/ipados-27.0.1-24A446/profile.toml +++ b/profiles/os/ipados-27.0.1-24A446/profile.toml @@ -34,7 +34,7 @@ # The AMFI wrapper that calls _initializeAppleMobileFileIntegrity and returns 0; the kernel patch calls it early. "early_security_init" = "com.apple.driver.AppleMobileFileIntegrity=0xfffffe00092551ac" # Bring-up: match against the symbol-bearing RELEASE build of the same XNU source -# (local-tools/build-fileset-release-reference.py --lto) and send unmatched calls to the +# (scripts/build-fileset-release-reference.py --lto) and send unmatched calls to the # reporting stub of fileset-unmapped-call.patch. "extra_args" = ["--fileset-reference", "build/xnu/fileset-reference/mach.release.bcm2837.unstripped.noctf", "--allow-missing"] "roots" = ["com.apple.AppleFSCompression.AppleFSCompressionTypeZlib", "com.apple.driver.AppleARMPlatform", "com.apple.driver.AppleARMWatchdogTimer", "com.apple.driver.AppleAudioClockLibs", "com.apple.driver.AppleEffaceableStorage", "com.apple.driver.AppleIISController", "com.apple.driver.AppleM2ScalerCSCDriver", "com.apple.driver.AppleMobileFileIntegrity", "com.apple.driver.ApplePMGR", "com.apple.driver.IODARTFamily", "com.apple.filesystems.apfs", "com.apple.iokit.CoreAnalyticsFamily", "com.apple.iokit.IOAVFamily", "com.apple.iokit.IOAudio2Family", "com.apple.iokit.IOCECFamily", "com.apple.iokit.IOCryptoAcceleratorFamily", "com.apple.iokit.IOGPUFamily", "com.apple.iokit.IOHDCPFamily", "com.apple.iokit.IOMobileGraphicsFamily", "com.apple.iokit.IOReportFamily", "com.apple.iokit.IOSlowAdaptiveClockingFamily", "com.apple.iokit.IOStorageFamily", "com.apple.iokit.IOSurface", "com.apple.kec.Libm", "com.apple.kec.corecrypto", "com.apple.kext.AppleMatch", "com.apple.kext.CoreTrust", "com.apple.security.AppleImage4", "com.apple.security.sandbox", "com.apple.iokit.IOHIDFamily", "com.apple.iokit.IOHIDEventDriver"] diff --git a/scripts/addon-add-dir.py b/scripts/addon-add-dir.py new file mode 100644 index 0000000..97626c5 --- /dev/null +++ b/scripts/addon-add-dir.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +"""Copy a GPU addon (NGPUADD2, see UniXNU scripts/make-gpu-addon.py) and add the files of DIR below PREFIX. +usage: addon-add-dir.py IN.bin OUT.bin PREFIX DIR [PREFIX DIR ...] (executables keep 0755, the rest 0644)""" +import os +import struct +import sys +import zlib +from pathlib import Path + + +def pad(b): + return b + bytes(-len(b) % 8) + + +def read(path): + data = Path(path).read_bytes() + assert data[:8] == b'NGPUADD2', 'not an addon' + count = struct.unpack_from(' len(data): + raise SystemExit('DER exceeds input') + return tag, data[at:at + size], at + size + + +def module(path): + data = Path(path).read_bytes() + if data[:1] == b'\x30': + tag, seq, end = der(data, 0) + fields, at = [], 0 + while at < len(seq): + kind, value, at = der(seq, at); fields.append((kind, value)) + if fields[0][1] != b'IM4P' or fields[3][0] != 4: + raise SystemExit(f'{path}: not an IM4P') + data = fields[3][1] + version, = struct.unpack_from('/export/manifest.json + files/) into one SHEXP001 pack for +make-gpu-addon.py --pipeline-pack. Later directories win on equal paths. usage: make-m2vpack.py OUT EXPORT_DIR...""" +import json, struct, sys, zlib +from pathlib import Path +out, dirs = Path(sys.argv[1]), [Path(d) for d in sys.argv[2:]] +merged, root = {}, '/' +for d in dirs: + m = json.loads((d / 'manifest.json').read_text()) + root = m['directory'] + for f in m['files']: + merged[f['path']] = (f['mode'], f['uid'], f['gid'], (d / 'files' / f['path']).read_bytes()) +stream = bytearray(b'M2VCACH1' + struct.pack(' {len(modules)} modules, last has {len(hashes)} hashes') diff --git a/scripts/turnip-kmd-patch.py b/scripts/turnip-kmd-patch.py new file mode 100644 index 0000000..ecfb156 --- /dev/null +++ b/scripts/turnip-kmd-patch.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Edit the new-file hunk of turnip-darwin-kmd.patch as a real file: `extract OUT.cc` and `inject IN.cc` (rewrites the hunk header).""" +import re, sys +from pathlib import Path +PATCH = str(Path(__file__).resolve().parents[1] / 'patches/mesa/turnip-darwin-kmd.patch') +HEAD = 'diff --git a/src/freedreno/vulkan/tu_knl_darwin.cc b/src/freedreno/vulkan/tu_knl_darwin.cc\n' +p = open(PATCH).read() +a = p.index(HEAD) +m = re.search(r'^@@ -0,0 \+1,(\d+) @@\n', p[a:], re.M) +start = a + m.end() +n = int(m.group(1)) +lines = p[start:].split('\n') +body = lines[:n] +assert all(l.startswith('+') for l in body) +rest_start = start + sum(len(l) + 1 for l in body) +if sys.argv[1] == 'extract': + open(sys.argv[2], 'w').write('\n'.join(l[1:] for l in body) + '\n') +else: + text = open(sys.argv[2]).read().rstrip('\n').split('\n') + new = ''.join('+' + l + '\n' for l in text) + out = p[:a + m.start()] + '@@ -0,0 +1,%d @@\n' % len(text) + new + p[rest_start:] + open(PATCH, 'w').write(out)