Run a virtual iPhone on an Apple Silicon Mac.
Swift
Boot the minimal and watchos presets on a stock boot chain
Maximilian Paß83075f115759
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.mdindex c735f18c..706fc70a 100644--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@ -4298,6 +4298,7 @@ gone. The preset names three sets:does not get the restored guest to its kernel: on 26.6 with cloudOS23E5207q it restarts right after its banner, with Apple's ROMs as withOpenAVB and OpenSEP (2026-10-19). Which of LLB's patches it needs is open.+ Superseded 2026-11-01/02: none; see "`minimal` boots a stock boot chain" below.- `com.vphone.patchset.devicetree`, allowing only the board presentation(`devicetree-cfw-serial_number`, `-home_button_type`,`-artwork_device_subtype`, `-island_notch_location`) and the haptics and@@ -4412,6 +4413,86 @@ first boot task ("launchd_cache_loader - posix_spawn: 85: Bad executable").vphoned, its launch daemon plist and the rewritten `launchd.plist` belong toroot:wheel, as the system's own; they kept the host user's owner and group.++## `minimal` boots a stock boot chain (2026-11-01, iBEC 2026-11-02)++`minimal` allows no boot chain patch. It still names+`com.vphone.patchset.bootchain`, so `--allow` (`fw set-patches`) can turn one+back on, but with none on the pipeline builds no AVPBooter, iBSS, iBEC or LLB+patcher, and the restore writes Apple's LLB byte for byte (SHA-1 of the+restore tree's `LLB.vresearch101.RELEASE.im4p` equal to the IPSW's). The ten+it named before (`ibec-boot-boot_args`, `ibec-boot-bootx_precondition`,+`ibec-boot-image4_callback`, `ibec-cfw-serial_label`,+`llb-boot-image4_callback`, `llb-boot-boot_args`, `llb-boot-rootfs`,+`llb-boot-panic_bypass`, `llb-cfw-serial_label`, `llb-cfw-display_scale`) are+off. `watchos` allows none either: a Watch7,18 watchOS 26.4 (23T240) guest on+cloudOS 26.4 (23E244), created with `--preset watchos` and the ten blocked,+logged "iBEC: no patches" and "LLB: no patches", was sent the stock iBEC+(380,676 bytes; 746,427 patched), had iBEC and LLB SHA-256-equal to the+cloudOS IPSW's during the restore, and booted to the pairing screen with+vphoned answering `device.info` and `processes.list` (2026-11-02).++LLB is the only iBoot stage of a normal boot: its banner ("Local boot") is+followed directly by the kernel; the `iBoot` image the restore writes to NOR+is not used. With every BuildManifest digest rehashed+(`manifest-boot-digest_rehash`) the TSS ticket covers the images the restore+installs, so the stock LLB's Image4 checks, its APFS sealed-volume checks+(the `0x3B7`/`0x3C2`/`0x110` sites `llb-boot-rootfs` skips; the values are+source line numbers in the APFS mount path that looks up the+`com.apple.os.update-<root hash>` snapshot) and the check `llb-boot-panic_bypass`+skips (`bl; cbnz w0` to a panic at source line 699 on 26.5) all pass.++Checked with Launchpad (`vm create --preset minimal --no-template --block …`),+one VM per row:++| Date | Guest | iBEC | LLB | Result |+| --- | --- | --- | --- | --- |+| 11-01 | iPhone17,3 26.5 23F77, cloudOS 26.5 23F75 | stock | stock | restore finished; boot to SpringBoard (Hello screen) and vphoned |+| 11-01 | iPhone11,6 18.6 22G86, cloudOS 18.6 22G86 | stock | stock | restore failed: the host lost iBEC after it loaded the restore ramdisk, as RestoreDeviceTree was sent ("Unable to find device") |+| 11-01 | iPhone11,6 18.6 22G86, cloudOS 18.6 22G86 | `ibec-boot-image4_callback` only | stock | restore finished; boot to SpringBoard and vphoned |+| 11-02 | iPhone11,6 18.6 22G86, cloudOS 18.6 22G86 | stock | stock | restore finished; boot to SpringBoard and vphoned (bundle 2.12.2-local.4cc10e87) |+| 11-02 | iPhone11,6 18.6 22G86, cloudOS 18.6 22G86 | stock | stock | restore finished; boot to SpringBoard and vphoned |++The failed 18.6 restore was the host's USB connection, not an Image4 check.+iBEC runs only in the DFU restore (it loads the restore SPTM, TXM, trust+cache, ramdisk, device tree, SEP and kernel), and `ibec-boot-image4_callback`+does not relax one property: on 18.6 (iBoot-11881.140.96, the same binary as+iBSS and LLB) its `b.ne` is the stack-canary check in the epilogue of the+property callback (0x91BC) and its `mov x0, x22` the return value, so every+property (AMNM, BNCH, BORD, CEPO, CHIP, CPRO, CSEC, SDOM, ECID, `osev`,+`slvn`, `anrd`, `dpoc`, `hclo`, `nrde`, `pndp`; DGST, EKEY, EPRO, ESEC, DPRO)+passes. In the failed run the stock callback had accepted the ramdisk ("loaded+ramdisk" is printed only after the `rdsk` load returns 0, 0x4ae20), and the+device tree never reached iBEC: no `ea0f64a4253252:981` (a USB request, 0x25050)+follows. The three `337a834f05a86eb:373` after it are iBoot's USB+SET_CONFIGURATION handler (0x23f9c), so iBEC was still running and answered+three re-enumerations by the host, which invalidated idevicerestore's handle.+The stock-iBEC repeats show the same serial log as the patched run: "loaded+device tree" after the ramdisk, then restore mode.++Without `ibec-boot-boot_args`/`llb-boot-boot_args` the kernel gets no+`serial=3 -v`, so the serial log ends at "End of iBoot serial output";+turn the patches back on with `--allow` (`fw set-patches`) for a verbose+kernel log. The serial labels only renamed the iBoot banner, and the display+scale patch is emitted only for a guest that is not 3x, which `minimal` does+not configure (it has no iPad device tree patches).++Why a stock LLB "restarted right after its banner" on 2026-10-19 (26.6 on+cloudOS 23E5207q) was not reproduced: those IPSWs are no longer on this host,+and that day's pipeline still computed a wrong root hash for+the resealed system (both fixed since, see above). Those are the inputs of+the sealed-volume checks `llb-boot-rootfs` skipped, but this is not proven.++Checked again on 2026-11-02 together with the other Minimal changes of that+week (launch-constraint categories in the static trust cache, a signed+`launchd.plist` instead of the `launchd_cache_loader` patch, vphoned's+paravirtual user-client entitlements): int-186 (iPhone11,6 18.6 22G86 on+cloudOS 22G86, `--preset minimal` with no `--allow`/`--block`) applied the+two iBEC image-4 callback instructions (the preset still kept them then),+logged "LLB: no patches" and restored;+its serial log shows the stock LLB's "Local boot" banner on the first boot and+again after a reboot, and SpringBoard and vphoned came up both times.+## The research board stands in for vphone600 (2026-10-19)Only the 26.1–26.4 beta cloudOS releases (up to 23E5207q) carry a vphone600apdiff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swiftindex 964e7621..5847df54 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift@@ -386,33 +386,24 @@ public enum FirmwarePatchSetCatalog {"devicetree-cfw-watch_companion",]- /// The boot chain patches ``minimalPreset`` keeps: iBEC's and LLB's, which the- /// old `.less` variant applied too. A stock LLB does not get the restored- /// guest to its kernel (it restarts after its banner, with Apple's ROMs as- /// with OpenAVB and OpenSEP). AVPBooter, iBSS, TXM and the restore ramdisk- /// stay stock.- public static let minimalBootChainPatches: Set<String> = [- "ibec-cfw-serial_label",- "ibec-boot-image4_callback",- "ibec-boot-boot_args",- "ibec-boot-bootx_precondition",- "llb-cfw-serial_label",- "llb-boot-image4_callback",- "llb-boot-boot_args",- "llb-boot-rootfs",- "llb-boot-panic_bypass",- "llb-cfw-display_scale",- ]-- /// A guest on a stock kernel and TXM, with only iBEC and LLB patched: the- /// system is customised before the restore instead- /// (``FirmwareRestoreImagePatchSet``), and nothing after it. Names only the- /// sets it draws on, so no kernel or guest patcher is built.+ /// A guest on a stock boot chain, kernel and TXM: the system is customised+ /// before the restore instead (``FirmwareRestoreImagePatchSet``), and+ /// nothing after it. Names no kernel or guest set, so no kernel or guest+ /// patcher is built.+ ///+ /// With every BuildManifest digest rehashed (`manifest-boot-digest_rehash`)+ /// the ticket covers the images as they are: a stock iBEC restores the+ /// guest and a stock LLB boots it to SpringBoard and vphoned (iOS 26.5+ /// 23F77 on cloudOS 23F75, 2026-11-01, and iOS 18.6 22G86 on cloudOS 22G86,+ /// 2026-11-02).+ /// The boot chain set is named with none of its patches on, so `--allow`+ /// can still turn one back on (the boot-args for a verbose kernel log), and+ /// no iBEC or LLB patcher is built./// The shipped `minimal.plist` must match this.public static let minimalPreset = VPhonePatchPreset(identifier: VPhonePatchPreset.minimalIdentifier,title: "Minimal",- summary: "No kernel or TXM patches and only iBEC and LLB in the boot chain: the restore installs a resealed system with vphoned, the GPU driver and activation, and nothing writes it afterwards.",+ summary: "A stock boot chain, kernel and TXM: the restore installs a resealed system with vphoned, the GPU driver and activation, and nothing writes it afterwards.",patchSets: [.bundled(FirmwareBootChainPatchSet.identifier),.bundled(FirmwareResearchBoardPatchSet.identifier),@@ -420,8 +411,7 @@ public enum FirmwarePatchSetCatalog {.bundled(FirmwareRestoreImagePatchSet.identifier),],selection: .allow(- minimalBootChainPatches- .union(minimalDeviceTreePatches)+ minimalDeviceTreePatches.union(FirmwareResearchBoardPatchSet.manifest.patches.map(\.identifier)).union(FirmwareRestoreImagePatchSet.manifest.patches.map(\.identifier)),),@@ -443,15 +433,17 @@ public enum FirmwarePatchSetCatalog {]/// ``minimalPreset`` for an Apple Watch: its device tree presents the watch- /// board. The shipped `watchos.plist` must match this.+ /// board. Its boot chain is stock too: a stock iBEC restores the guest and a+ /// stock LLB boots it to the pairing screen and vphoned (watchOS 26.4 23T240+ /// on cloudOS 26.4 23E244, 2026-11-02). The shipped `watchos.plist` must+ /// match this.public static let watchOSPreset = VPhonePatchPreset(identifier: VPhonePatchPreset.watchOSIdentifier,title: "Apple Watch",summary: "Minimal for an Apple Watch guest: the watch board's device tree, and a resealed system with vphoned, the GPU driver, speaker audio and activation restored onto a stock kernel and TXM.",patchSets: minimalPreset.patchSets,selection: .allow(- minimalBootChainPatches- .union(watchOSDeviceTreePatches)+ watchOSDeviceTreePatches.union(FirmwareResearchBoardPatchSet.manifest.patches.map(\.identifier)).union(FirmwareRestoreImagePatchSet.manifest.patches.map(\.identifier)),),diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swiftindex fc720c5d..d2ffac10 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift@@ -46,9 +46,9 @@ extension FirmwarePipeline {let includeBootChain = includesSet(FirmwareBootChainPatchSet.identifier)// Whether the plan turns on any patch for a boot chain component. A- // preset that keeps the set for some components only (`minimal`: iBEC and- // LLB) leaves the others stock, and a patcher built to write nothing- // would only log that it found nothing.+ // preset that names the set but turns on patches for some components only+ // (`minimal` and `watchos`: none) leaves the others stock, and a patcher+ // built to write nothing would only log that it found nothing.func patchesBootChain(_ component: VPhoneFirmwareComponent) -> Bool {guard includeBootChain else { return false }guard let plan else { return true }diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swiftindex 7381adbe..dc10e33a 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/Core/FirmwarePatcherTests.swift@@ -629,7 +629,7 @@ struct FirmwarePipelineTests {#expect(components.first { $0.name == "Manifest" }?.patcherFactories.isEmpty == true)}- @Test func `the minimal preset builds no kernel or TXM patcher`() throws {+ @Test func `the minimal preset builds no boot chain, kernel or TXM patcher`() throws {let root = URL(fileURLWithPath: NSTemporaryDirectory())func patched(_ preset: VPhonePatchPreset) throws -> [String] {let plan = try VPhonePatchPlan.resolve(@@ -646,7 +646,8 @@ struct FirmwarePipelineTests {let minimal = try patched(FirmwarePatchSetCatalog.minimalPreset)#expect(!minimal.contains("kernelcache"))#expect(!minimal.contains("TXM"))- #expect(Set(["iBEC", "LLB", "DeviceTree", "Filesystem", "Manifest"]).isSubset(of: Set(minimal)))+ #expect(Set(minimal).isDisjoint(with: ["AVPBooter", "iBSS", "iBEC", "LLB"]))+ #expect(Set(["DeviceTree", "Filesystem", "Manifest"]).isSubset(of: Set(minimal)))let standard = try patched(FirmwarePatchSetCatalog.standardPreset)#expect(!standard.contains("Filesystem"))#expect(!standard.contains("Manifest"))diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swiftindex 25e29d1b..b70bac1d 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift@@ -183,14 +183,13 @@ struct FirmwarePatchSetCatalogTests {// patch: these are the combinations we claim boot. The tvOS// presets drop exactly the iOS ones an Apple TV has no port of.let tvPresets = [VPhonePatchPreset.homeViewIdentifier, VPhonePatchPreset.tvOSIdentifier, VPhonePatchPreset.tvOS4KIdentifier, VPhonePatchPreset.homePodMiniIdentifier]- // `minimal` drops every boot chain patch but iBEC's and LLB's:- // its system is customised before the restore instead.+ // `minimal` and `watchos` drop every boot chain patch: their+ // system is customised before the restore instead.let restoreImagePresets = [VPhonePatchPreset.minimalIdentifier, VPhonePatchPreset.watchOSIdentifier]let expected = if tvPresets.contains(preset.identifier) {Set(plan.droppedBootEssentials).isSubset(of: FirmwarePatchSetCatalog.tvOSBlockedPatches)} else if restoreImagePresets.contains(preset.identifier) {- Set(plan.droppedBootEssentials).isDisjoint(with: FirmwarePatchSetCatalog.minimalBootChainPatches)- && plan.droppedBootEssentials.allSatisfy {+ plan.droppedBootEssentials.allSatisfy {FirmwareBootChainPatchSet.manifest.patches.map(\.identifier).contains($0)}} else {@@ -220,7 +219,7 @@ struct FirmwarePatchSetCatalogTests {}@Test- func `Only minimal and its watch form name the restore image, and patch only iBEC, LLB, the device tree and the research board besides`() throws {+ func `Only minimal and its watch form name the restore image, and patch only the device tree and the research board besides`() throws {for preset in FirmwarePatchSetCatalog.builtInPresets {let namesRestoreImage = preset.patchSets.map(\.identifier).contains(FirmwareRestoreImagePatchSet.identifier)let restoreImagePresets = [VPhonePatchPreset.minimalIdentifier, VPhonePatchPreset.watchOSIdentifier]@@ -233,10 +232,18 @@ struct FirmwarePatchSetCatalogTests {cloudOS: VPhoneVersion("26.4"),)let restoreImage = Set(FirmwareRestoreImagePatchSet.manifest.patches.map(\.identifier))- let bootChain = FirmwarePatchSetCatalog.minimalBootChainPatcheslet researchBoard = Set(FirmwareResearchBoardPatchSet.manifest.patches.map(\.identifier))- #expect(plan.enabled == restoreImage.union(FirmwarePatchSetCatalog.minimalDeviceTreePatches).union(bootChain).union(researchBoard))- #expect(plan.droppedBootEssentials.allSatisfy { !$0.hasPrefix("ibec-") && !$0.hasPrefix("llb-") })+ #expect(plan.enabled == restoreImage.union(FirmwarePatchSetCatalog.minimalDeviceTreePatches).union(researchBoard))+ #expect(plan.enabled.isDisjoint(with: FirmwareBootChainPatchSet.manifest.patches.map(\.identifier)))+ // The set stays named, so `--allow` can turn a boot chain patch back on.+ let verbose = try VPhonePatchPlan.resolve(+ preset: FirmwarePatchSetCatalog.minimalPreset,+ patchSets: FirmwarePatchSetCatalog.bundled,+ iOSBase: VPhoneVersion("26.4"),+ cloudOS: VPhoneVersion("26.4"),+ allowed: ["llb-boot-boot_args"],+ )+ #expect(verbose.enabled.contains("llb-boot-boot_args"))let watch = try VPhonePatchPlan.resolve(preset: FirmwarePatchSetCatalog.watchOSPreset,@@ -245,7 +252,9 @@ struct FirmwarePatchSetCatalogTests {cloudOS: VPhoneVersion("26.4"),)#expect(watch.enabled == restoreImage- .union(FirmwarePatchSetCatalog.watchOSDeviceTreePatches).union(bootChain).union(researchBoard))+ .union(FirmwarePatchSetCatalog.watchOSDeviceTreePatches)+ .union(researchBoard))+ #expect(watch.enabled.isDisjoint(with: FirmwareBootChainPatchSet.manifest.patches.map(\.identifier)))}@Testdiff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plistindex e4a383e4..8db75e1f 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist@@ -53,23 +53,13 @@<string>filesystem-boot-vphoned</string><string>filesystem-exp-btvc_le_connection</string><string>filesystem-exp-watch_audio</string>- <string>ibec-boot-boot_args</string>- <string>ibec-boot-bootx_precondition</string>- <string>ibec-boot-image4_callback</string>- <string>ibec-cfw-serial_label</string><string>kernel-boot-vresearch101_kext_mix</string>- <string>llb-boot-boot_args</string>- <string>llb-boot-image4_callback</string>- <string>llb-boot-panic_bypass</string>- <string>llb-boot-rootfs</string>- <string>llb-cfw-display_scale</string>- <string>llb-cfw-serial_label</string><string>manifest-boot-digest_rehash</string><string>sep-boot-vresearch101_sepd_dispatch</string></array></dict><key>Summary</key>- <string>No kernel or TXM patches and only iBEC and LLB in the boot chain: the restore installs a resealed system with vphoned, the GPU driver and activation, and nothing writes it afterwards.</string>+ <string>A stock boot chain, kernel and TXM: the restore installs a resealed system with vphoned, the GPU driver and activation, and nothing writes it afterwards.</string><key>Title</key><string>Minimal</string></dict>diff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plistindex f4e9bc8b..75638f09 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plist@@ -56,17 +56,7 @@<string>filesystem-boot-vphoned</string><string>filesystem-exp-btvc_le_connection</string><string>filesystem-exp-watch_audio</string>- <string>ibec-boot-boot_args</string>- <string>ibec-boot-bootx_precondition</string>- <string>ibec-boot-image4_callback</string>- <string>ibec-cfw-serial_label</string><string>kernel-boot-vresearch101_kext_mix</string>- <string>llb-boot-boot_args</string>- <string>llb-boot-image4_callback</string>- <string>llb-boot-panic_bypass</string>- <string>llb-boot-rootfs</string>- <string>llb-cfw-display_scale</string>- <string>llb-cfw-serial_label</string><string>manifest-boot-digest_rehash</string><string>sep-boot-vresearch101_sepd_dispatch</string></array>