Run a virtual iPhone on an Apple Silicon Mac.
Swift
Keep iBEC and LLB patched on minimal and watchos
Lakr233ed5610e6fc3a
diff --git a/Research/0_binary_patch_comparison.md b/Research/0_binary_patch_comparison.mdindex 92c4c7fd..e9871ff4 100644--- a/Research/0_binary_patch_comparison.md+++ b/Research/0_binary_patch_comparison.md@@ -4416,6 +4416,8 @@ gone. The preset names three sets:23E5207q 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.+ Reverted 2026-11-03: the stock LLB needs more guest memory than 4096 MB; see+ "`minimal` and `watchos` keep iBEC and LLB again" 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@@ -4610,6 +4612,45 @@ logged "LLB: no patches" and restored;its serial log shows the stock LLB's "Local boot" banner on the first boot andagain after a reboot, and SpringBoard and vphoned came up both times.+## `minimal` and `watchos` keep iBEC and LLB again (2026-11-03)++The stock boot chain above was checked only at the default 8192 MB. A guest+with 4096 MB does not boot. On a macOS 26.7.2 host OpenAVB logs `iLLB+container accepted`, `iLLB decompressed` and `virtual firmware prepared`, and+the virtual machine stops at once (`VZErrorDomain` 1, "The virtual machine+stopped unexpectedly"), so `vm create` ends with "Boot check ended before the+guest connected"; on a macOS 27.2 host it keeps running and vphoned never+answers within the 300 s first boot check. That is the same stop the userspace debugging section below+records for a watch guest at 2048 MB. With the ten iBEC and LLB patches back+on (`FirmwarePatchSetCatalog.minimalBootChainPatches`, as before 2026-11-01)+the same guests boot at 4096 MB. AVPBooter, iBSS, TXM and the restore ramdisk+stay stock, and the rest of `minimal` (the signed `launchd.plist` instead of+the `launchd_cache_loader` gate, the kernel sets named for userspace+debugging) is unchanged.++The regression sweep for bundle 2.15.0 plus `main` at 58368476 created every+machine with `--cpu 4 --memory 4096` on Mac mini M4 hosts (Mac16,10, 16 GB),+one VM per row:++| Host macOS | Bundle | Guest | Memory | Result |+| --- | --- | --- | --- | --- |+| 26.7.2 | `main` 58368476 | iPhone17,3 26.6.2 23G90, cloudOS 23E5207q, `minimal` | 4096 MB | stops after `iLLB decompressed`; `vm config --rom apple` reaches the iBoot banner but no vphoned in 120 s |+| 26.7.2 | `main` 58368476 | Watch7,18 26.4 23T240, cloudOS 23E244, `watchos` | 4096 MB | stops on the first boot check |+| 26.7.2 | release 2.15.0 (iBEC and LLB patched) | iPhone17,3 26.6.2, `minimal` | 4096 MB | first boot, vphoned ping |+| 26.7.2 | release 2.15.0 | Watch7,18 26.4, `watchos` | 4096 MB | first boot, vphoned ping |+| 27.2 | `main` 58368476 | iPhone17,3 26.6.2, `minimal` | 4096 MB | no vphoned within the 300 s first boot check |+| 27.2 | `main` 58368476 | iPhone17,3 26.6.2, `minimal` | 8192 MB | two boots, vphoned `device.info` 26.6.2, no panic |+| 27.2 | this change | iPhone17,3 26.6.2, `minimal` | 4096 MB | two boots, vphoned `device.info` 26.6.2, no panic |+| 27.2 | this change | Watch7,18 26.4, `watchos` | 4096 MB | two boots, vphoned `device.info` 26.4, no panic |++Neither preset installs the roothide bootstrap: `irisin-cli` is refused as a+bad executable on a stock kernel, with release 2.15.0 as with `main`, so+`--bootstrap` is not part of these presets' checks.++Which LLB patch the smaller guest needs, and why memory matters to a stock+LLB, is open. Until it is known, a stock boot chain is not the default for a+preset that can be created with less than 8192 MB.+## 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 4de56d65..e5b17aa5 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwarePatchSetCatalog.swift@@ -394,26 +394,37 @@ public enum FirmwarePatchSetCatalog {"devicetree-cfw-watch_companion",]- /// A guest on a stock boot chain, kernel and TXM: the system is customised- /// before the restore instead (``FirmwareRestoreImagePatchSet``), and- /// nothing after it. It names the two kernel sets but selects nothing from- /// them, so the kernel stays stock and no kernel patcher is built; naming- /// them is what lets a machine turn on ``userspaceDebugging``. No guest set- /// is named.- ///- /// 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 boot chain patches ``minimalPreset`` and ``watchOSPreset`` keep: iBEC's+ /// and LLB's. A stock LLB boots a guest with 8192 MB, but with 4096 MB+ /// OpenAVB accepts and decompresses it and the virtual machine stops at+ /// once (iOS 26.6.2 23G90 on cloudOS 26.4 23E5207q and watchOS 26.4 23T240+ /// on cloudOS 26.4 23E244, 2026-11-03), even with every BuildManifest+ /// digest rehashed; with these patches both boot at 4096 MB. 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+ /// (``minimalBootChainPatches``): the system is customised before the+ /// restore instead (``FirmwareRestoreImagePatchSet``), and nothing after+ /// it. It names the two kernel sets but selects nothing from them, so the+ /// kernel stays stock and no kernel patcher is built; naming them is what+ /// lets a machine turn on ``userspaceDebugging``. No guest set is named./// The shipped `minimal.plist` must match this.public static let minimalPreset = VPhonePatchPreset(identifier: VPhonePatchPreset.minimalIdentifier,title: "Minimal",- 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.",+ 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.",patchSets: [.bundled(FirmwareBootChainPatchSet.identifier),.bundled(FirmwareKernelBasePatchSet.identifier),@@ -423,7 +434,8 @@ public enum FirmwarePatchSetCatalog {.bundled(FirmwareRestoreImagePatchSet.identifier),],selection: .allow(- minimalDeviceTreePatches+ minimalBootChainPatches+ .union(minimalDeviceTreePatches).union(FirmwareResearchBoardPatchSet.manifest.patches.map(\.identifier)).union(FirmwareRestoreImagePatchSet.presetPatches).subtracting([FirmwareRestoreImagePatchSet.launchdCacheLoader]),@@ -446,17 +458,16 @@ public enum FirmwarePatchSetCatalog {]/// ``minimalPreset`` for an Apple Watch: its device tree presents the watch- /// 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.+ /// board, and it keeps the same iBEC and LLB patches. 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(- watchOSDeviceTreePatches+ minimalBootChainPatches+ .union(watchOSDeviceTreePatches).union(FirmwareResearchBoardPatchSet.manifest.patches.map(\.identifier)).union(FirmwareRestoreImagePatchSet.presetPatches).subtracting([FirmwareRestoreImagePatchSet.launchdCacheLoader]),diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/Pipeline/FirmwarePipelineComponents.swiftindex 3e4a84b0..b6fe4c7f 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 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.+ // preset that keeps the set for some components only (`minimal` and+ // `watchos`: iBEC and LLB) 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 dc10e33a..b94691b3 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 boot chain, kernel or TXM patcher`() throws {+ @Test func `the minimal preset builds no kernel or TXM patcher, and of the boot chain only iBEC's and LLB's`() throws {let root = URL(fileURLWithPath: NSTemporaryDirectory())func patched(_ preset: VPhonePatchPreset) throws -> [String] {let plan = try VPhonePatchPlan.resolve(@@ -646,8 +646,8 @@ struct FirmwarePipelineTests {let minimal = try patched(FirmwarePatchSetCatalog.minimalPreset)#expect(!minimal.contains("kernelcache"))#expect(!minimal.contains("TXM"))- #expect(Set(minimal).isDisjoint(with: ["AVPBooter", "iBSS", "iBEC", "LLB"]))- #expect(Set(["DeviceTree", "Filesystem", "Manifest"]).isSubset(of: Set(minimal)))+ #expect(Set(minimal).isDisjoint(with: ["AVPBooter", "iBSS"]))+ #expect(Set(["iBEC", "LLB", "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 06985b4c..9c9ffac1 100644--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwarePatchSetCatalogTests.swift@@ -211,10 +211,11 @@ 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` and `watchos` drop every boot chain patch, and- // every kernel patch of the two sets they name only so a- // machine can turn some on: their system is customised- // before the restore instead, onto a stock kernel.+ // `minimal` and `watchos` drop every boot chain patch but+ // iBEC's and LLB's, and every kernel patch of the two sets+ // they name only so a machine can turn some on: their system+ // is customised before the restore instead, onto a stock+ // kernel.let restoreImagePresets = [VPhonePatchPreset.minimalIdentifier, VPhonePatchPreset.watchOSIdentifier]let droppable = Set([FirmwareBootChainPatchSet.manifest, FirmwareKernelBasePatchSet.manifest, FirmwareKernelCustomFirmwarePatchSet.manifest]@@ -224,6 +225,7 @@ struct FirmwarePatchSetCatalogTests {Set(plan.droppedBootEssentials).isSubset(of: FirmwarePatchSetCatalog.tvOSBlockedPatches)} else if restoreImagePresets.contains(preset.identifier) {Set(plan.droppedBootEssentials).isSubset(of: droppable)+ && Set(plan.droppedBootEssentials).isDisjoint(with: FirmwarePatchSetCatalog.minimalBootChainPatches)} else {plan.droppedBootEssentials.isEmpty}@@ -251,7 +253,7 @@ struct FirmwarePatchSetCatalogTests {}@Test- func `Only minimal and its watch form name the restore image, and patch only the device tree and the research board besides`() throws {+ 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 {for preset in FirmwarePatchSetCatalog.builtInPresets {let namesRestoreImage = preset.patchSets.map(\.identifier).contains(FirmwareRestoreImagePatchSet.identifier)let restoreImagePresets = [VPhonePatchPreset.minimalIdentifier, VPhonePatchPreset.watchOSIdentifier]@@ -270,18 +272,15 @@ struct FirmwarePatchSetCatalogTests {// The unsecure-cache gate stays out: the launchd.plist minimal edits is// signed and in the trust cache, so the stock launchd_cache_loader takes it.#expect(!plan.isEnabled(FirmwareRestoreImagePatchSet.launchdCacheLoader))+ let bootChain = FirmwarePatchSetCatalog.minimalBootChainPatches+ let allBootChain = Set(FirmwareBootChainPatchSet.manifest.patches.map(\.identifier))+ #expect(bootChain.isSubset(of: allBootChain))#expect(plan.enabled == restoreImage.subtracting([FirmwareRestoreImagePatchSet.launchdCacheLoader])- .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"))+ .union(FirmwarePatchSetCatalog.minimalDeviceTreePatches).union(bootChain).union(researchBoard))+ // A stock LLB does not reach the kernel on an OpenAVB machine: iBEC and+ // LLB stay patched, AVPBooter and iBSS stay stock.+ #expect(plan.enabled.intersection(allBootChain) == bootChain)+ #expect(plan.droppedBootEssentials.allSatisfy { !$0.hasPrefix("ibec-") && !$0.hasPrefix("llb-") })let watch = try VPhonePatchPlan.resolve(preset: FirmwarePatchSetCatalog.watchOSPreset,@@ -291,8 +290,8 @@ struct FirmwarePatchSetCatalogTests {)#expect(!watch.isEnabled(FirmwareRestoreImagePatchSet.launchdCacheLoader))#expect(watch.enabled == restoreImage.subtracting([FirmwareRestoreImagePatchSet.launchdCacheLoader])- .union(FirmwarePatchSetCatalog.watchOSDeviceTreePatches).union(researchBoard))- #expect(watch.enabled.isDisjoint(with: FirmwareBootChainPatchSet.manifest.patches.map(\.identifier)))+ .union(FirmwarePatchSetCatalog.watchOSDeviceTreePatches).union(bootChain).union(researchBoard))+ #expect(watch.enabled.intersection(allBootChain) == bootChain)}@Testdiff --git a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plistindex 03d2edee..c5b47633 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/minimal.plist@@ -64,13 +64,23 @@<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>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>+ <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><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 2580d94a..99729fe5 100644--- a/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plist+++ b/VPhoneExecutable/VPhoneVirtualization/Resources/patches_presets/watchos.plist@@ -67,7 +67,17 @@<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>