Booting macOS's WindowServer on your jailbroken iDevice for real (WIP)
Some paths are currently hardcoded for rootless jailbreak, but you can change them to work with rootful jailbreak. Some tools are hardcoded for Dopamine jailbreak.
You need these from simulator runtime: MTLSimDriver.framework, MTLSimImplementation.framework, MetalSerializer.framework
- TODO
- Copy
/System/Volumes/Data/System/Library/CoreServices/CoreTypes.bundle/Contents/Library
TODO: make a script
- Extract full filesystem dmg to a directory, e.g.
/var/mnt/rootfs
Extract App cryptex dmg to(for Safari only, which is not needed)rootfs/System/Volumes/Preboot/Cryptexes/App
- Extract OS cryptex dmg to
rootfs/System/Volumes/Preboot/Cryptexes/OS
- Copy-merge folders from
rootfs/System/Library/Templates/Data
to yourrootfs
- Symlink
rootfs/System/Volumes/Data
->../..
- Symlink
/home
->rootfs/System/Volumes/Data/home
(optional?) - Symlink
rootfs/var/folders/zz
->/var/folders/zz
- mkdir
rootfs/Users/root
- Copy
/etc
from macOS installation torootfs/etc
(optional?) - Bind mount
rootfs/var/jb
->/var/jb
- Patch
dyld
,launchservicesd
andWindowServer
as described below. - Modify
cpusubtype
inInstaller Progress
andWindowServer
- For every executable you wanna run, sign and merge with
entitlements.plist
in this repo. - Load macOS trustcaches using
loadtc /path/to/trustcache
launchctl unload /System/Library/LaunchDaemons/com.apple.{SpringBoard,backboardd}.plist
launchctl load /var/jb/usr/macOS/LaunchDaemons
Note
- Some offsets are hardcoded for iOS 16.5/macOS 13.4
- means it is automated or handled by hooks
- means you need to patch it by hand
-
mach-o file, but is an incompatible architecture (have 'arm64e', need 'arm64')
becauseGradedArchs::grade
disallows loading non-system arm64e libraries to arm64 processes. (not really this function but the caller of it I forgot).
- Missing syscalls:
audit_token_to_asid
,audit_token_to_auid
,auditon
,getaudit_addr
- This daemon needs to be converted to a dylib using LiveContainer's method. Please make sure to resign dylib without entitlements to avoid codesign panic (#2).
-
Error (non-fatal) enumerating <private>: Error Domain=NSCocoaErrorDomain Code=256 "The file “Library” couldn’t be opened." UserInfo={NSURL=Library/ -- file:///System/Library/CoreServices/CoreTypes.bundle/Contents/, NSFilePath=/System/Library/CoreServices/CoreTypes.bundle/Contents/Library, NSUnderlyingError=0x13d5a73b0 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"}}
: because/System/Volumes/Data/System/Library/CoreServices/CoreTypes.bundle/Contents/Library
might be missing.
-
failed assertion _limits.maxColorAttachments > 0 at line 3791 in -[_MTLDevice initLimits]
, can be bypassed usingCFPreferencesSetAppValue(@"EnableSimApple5", @1, @"com.apple.Metal")
-
-[MTLTextureDescriptorInternal validateWithDevice:], line 1344: error 'Texture Descriptor Validation invalid storageMode (1). Must be one of MTLStorageModeShared(0) MTLStorageModeMemoryless(3) MTLStorageModePrivate(2)
: because macOS defaults toMTLStorageModeManaged
, while iOS always has unified memory so it doesn't allow that. -
Attempt to pass a malloc(3)ed region to xpc_shmem_create().
: while regular drivers accept passingmalloc
ed region tonewBufferWithBytesNoCopy:length:options:deallocator:
, doing so to simulator is not allowed since XPC has to share the memory withMTLSimDriverHost.xpc
process. Workaround is to create a mirrored region usingvm_remap
that can be shared across processes. -
Unimplemented pixel format of 645346401 used in WSCompositeDestinationCreateWithIOSurface.
due to missing implementation of-[MTLSimDevice acceleratorPort]
, which mysteriously caused WindowServer to fallback to software rendering in some places, causing said fatal error. -
-[MTLSimDevice newRenderPipelineStateWithTileDescriptor:options:reflection:error:], line 2124: error 'not supported in the simulator'
. FIXME: this is not implemented at all. However, it is only used byQuartzCore'CA::OGL::BlurState::tile_downsample(int)
which is skipped by the hook. -
-[MTLSimTexture initWithDescriptor:decompressedPixelFormat:iosurface:plane:textureRef:heap:device:]:813: failed assertion 'IOSurface backed XR10 textures are not supported in the simulator'
: patch out the check, since it actually works fine. -
-[MTLSimBuffer newTextureWithDescriptor:offset:bytesPerRow:]
: patchstorageMode == private
check.
- It hangs twice when calling
NXClickTime
andNXGetClickSpace
. Hooked to do nothing instead since both were deprecated. - Missing light theme when using macOS recovery. Can be fixed by copying
/System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources
from full macOS installation.
-
MTLCompilerObject::readModuleFromBinaryRequest
: patch platform check to allow cross-platform compilation. MTLCompilerBypassOSCheck compares against hardcoded instruction so it might not be reliable across iOS versions.
-
Path not allowed in target domain
is raised when attempting to load XPC bundles not declared inlaunchd.plist
(MTLSimDriverHost.xpc
in this case). This can be bypassed by addingcom.apple.private.domain-extension
entitlement.
- Install
WatchDisable
tweak from this repo which automatically runs @zhuowei'swho_let_the_dogs_out.c
at boot.